scout-gear 10.8.0 → 10.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a3b309720cd9c3116460e682e1da0810a8601a406de1a86bb2e63c2dc1b2e7e
4
- data.tar.gz: 03ee884261ff3393b2d9e52c1361260bd2c55d3038c244251dc75b357891eb93
3
+ metadata.gz: a469436e6ab560158eead4f0fae044ebddebe65d611a97a69837ab7884cad3e4
4
+ data.tar.gz: a60763c026694b77083f23cf14784e4e6575bd34886980c4af28ead001f8590e
5
5
  SHA512:
6
- metadata.gz: 66b6d4780304a2f50f6a7aa384c86df78909851d1c9176d71ebaa67c7bb43b334b10b092fb4d636d1dbeada466db19d17af12d28f181de27ec0fd54450a1367c
7
- data.tar.gz: 4efa2ebbc04db80cae4592887ab7f825cdc4783ffd381c1073c5d1e762f034b9c0c0a6e581948bfca96195653d88500c07525e922d7229c81306893a13e41809
6
+ metadata.gz: 5620d8f89b1c5b7bff57c21c2fb28bac8c31168220a7fd8b9804179e9381b75603e9844440e233f07c0d80ebc7de8f684235a34297263ca927679a4f08aa348c
7
+ data.tar.gz: b91fb51fec1e97b351a2d7a91b07186498b49d2b8bdf4561bb806b7b38cf45c2c2239642830bc1bfb9909b2f5ed7f173b3ce3707ca2f9fd799fd89d246217fa3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.8.0
1
+ 10.8.2
data/bin/scout CHANGED
@@ -66,7 +66,7 @@ require 'scout/simple_opt'
66
66
  require 'scout/log'
67
67
 
68
68
  options = SOPT.setup <<EOF
69
- Ruby bioinformatics toolkit
69
+ Scout
70
70
 
71
71
  $ #{$0} <command> <subcommand> ... -a --arg1 --arg2='value' --arg3 'another-value'
72
72
 
@@ -75,7 +75,7 @@ $ #{$0} <command> <subcommand> ... -a --arg1 --arg2='value' --arg3 'another-valu
75
75
  --dev* #{Log.color :yellow, "Find development libraries in the directory specified"}
76
76
  --nocolor #{Log.color :yellow, "Disable colored output"}
77
77
  --nobar #{Log.color :yellow, "Disable progress report"}
78
- --locate_file #{Log.color :yellow, "Report the location of the script instead of executing it"}
78
+ --locate_file #{Log.color :yellow, "Report the location of the script but do not execute it"}
79
79
  -ck--config_keys* #{Log.color :yellow, "Override some config keys"}
80
80
  EOF
81
81
 
@@ -106,7 +106,7 @@ class KnowledgeBase
106
106
  new_paths = _fp(rest, clean_matches, new_assignments)
107
107
  next unless new_paths
108
108
  paths[match] = new_paths
109
- end
109
+ end if matches
110
110
 
111
111
  return false if paths.empty?
112
112
 
@@ -2,11 +2,21 @@ require 'scout/entity'
2
2
  require 'scout/workflow'
3
3
 
4
4
  module EntityWorkflow
5
+ attr_accessor :entity_name
6
+
7
+ def entity_name=(name)
8
+ @entity_name = name
9
+ helper name do
10
+ entity
11
+ end
12
+ end
5
13
 
6
14
  def self.extended(base)
7
15
  base.extend Workflow
8
16
  base.extend Entity
9
17
 
18
+ base.entity_name ||= 'entity'
19
+
10
20
  base.instance_variable_set(:@annotation_inputs, IndiferentHash.setup({})) unless base.instance_variables.include?(:@annotation_inputs)
11
21
  class << base
12
22
  def annotation_input(name, type=nil, desc=nil, default=nil, options = {})
@@ -20,7 +30,7 @@ module EntityWorkflow
20
30
  base.setup(clean_name.dup, inputs.to_hash)
21
31
  end
22
32
 
23
- base.helper :entity_list do
33
+ base.helper :entity_list do
24
34
  list = inputs.last
25
35
  list = list.load if Step === list
26
36
  base.setup(list, inputs.to_hash)
@@ -46,12 +56,13 @@ module EntityWorkflow
46
56
  input annotation
47
57
  end
48
58
  end
59
+
49
60
  case property_type
50
61
  when :single, :single2array
51
- input :entity, :string, "#{self.to_s} identifier", nil, jobname: true
62
+ input entity_name, :string, "#{self.to_s} identifier", nil, jobname: true
52
63
  task(task_name => result_type, &block)
53
64
  when :both
54
- input :entity, :string, "#{self.to_s} identifier", nil, jobname: true
65
+ input entity_name, :string, "#{self.to_s} identifier", nil, jobname: true
55
66
  input :list, :array, "#{self.to_s} identifier list"
56
67
  task(task_name => result_type, &block)
57
68
  else
@@ -59,7 +70,8 @@ module EntityWorkflow
59
70
  task(task_name => result_type, &block)
60
71
  end
61
72
 
62
- property task_name => property_type do |*args|
73
+ property_name = task_name.to_s.sub(/^(#{entity_name}_list|#{entity_name}|list)_/, '')
74
+ property property_name => property_type do |*args|
63
75
  job = job(task_name, *args)
64
76
  Array === job ? job.collect(&:run) : job.run
65
77
  end
@@ -83,11 +83,12 @@ module Task
83
83
 
84
84
  id = DEFAULT_NAME if id.nil?
85
85
 
86
+ sanitized_id = Path.sanitize_filename(id, 150)
86
87
  if non_default_inputs.any? && !(non_default_inputs == [jobname_input] && provided_inputs[jobname_input] == id)
87
88
  hash = Misc.digest(:inputs => input_digest_str, :dependencies => dependencies)
88
- name = [id, hash] * "_"
89
+ name = [sanitized_id, hash] * "_"
89
90
  else
90
- name = id
91
+ name = sanitized_id
91
92
  end
92
93
 
93
94
  extension = self.extension
@@ -139,14 +139,16 @@ module Workflow
139
139
  dep_tree = {}
140
140
  task = self.tasks[task_name]
141
141
  raise TaskNotFound, "Task #{task_name} in #{self.to_s}" if task.nil?
142
- task.deps.each do |workflow, task, options|
143
- next if seen.include? dep
144
- seen << [workflow, task, options.merge(seen_options)]
145
- next if task.nil?
146
142
 
147
- key = [workflow, task]
143
+ task.deps.each do |workflow, dep_task, options|
144
+ dep = [workflow, dep_task, options.merge(seen_options)]
145
+ #next if seen.include? dep
146
+ seen << dep
147
+ next if dep_task.nil?
148
148
 
149
- dep_tree[key] = workflow.dep_tree(task, seen, options.merge(seen_options))
149
+ dep_key = [workflow, dep_task]
150
+
151
+ dep_tree[dep_key] = workflow.dep_tree(dep_task, seen, options.merge(seen_options))
150
152
  end if task.deps
151
153
 
152
154
  @dep_tree[key] = dep_tree if save
@@ -163,6 +165,7 @@ module Workflow
163
165
  def _prov_tasks(tree)
164
166
  tasks = []
165
167
  heap = tree.values
168
+ heap = [tree]
166
169
  while heap.any?
167
170
  t = heap.pop
168
171
  t.each do |k,v|
@@ -188,10 +191,8 @@ module Workflow
188
191
  first = last.nil?
189
192
  last = _prov_tasks(workflow.dep_tree(task_name))
190
193
 
191
- break if child
192
-
193
194
  if child
194
- description << "->" << task_name.to_s
195
+ description << "->" << task_name.to_s
195
196
  elsif first
196
197
  description << "" << task_name.to_s
197
198
  else
@@ -204,7 +205,6 @@ module Workflow
204
205
  end
205
206
 
206
207
  def prov_tree(tree, offset = 0, seen = [])
207
-
208
208
  return "" if tree.empty?
209
209
 
210
210
  lines = []
data/scout-gear.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-gear 10.8.0 ruby lib
5
+ # stub: scout-gear 10.8.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-gear".freeze
9
- s.version = "10.8.0".freeze
9
+ s.version = "10.8.2".freeze
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2025-06-05"
14
+ s.date = "2025-06-13"
15
15
  s.description = "Scout gear: workflow, TSVs, persistence, entities, associations, and knowledge_bases.".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.executables = ["scout".freeze]
data/scout_commands/glob CHANGED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout-gear'
4
+
5
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
+
7
+ options = SOPT.setup <<EOF
8
+
9
+ Find files with glob
10
+
11
+ $ #{$0} [<options>] (<resource> <path>|<path>)
12
+
13
+ -h--help Print this help
14
+ -r--requires* Files to require; 'all' for all in Scout.etc.requires
15
+ -lw--load_workflow* Files to require; 'all' for all in Scout.etc.requires
16
+ -w--where* Where to look for the path
17
+ EOF
18
+ if options[:help]
19
+ if defined? scout_usage
20
+ scout_usage
21
+ else
22
+ puts SOPT.doc
23
+ end
24
+ exit 0
25
+ end
26
+
27
+ resource, path = ARGV
28
+ path, resource = resource, nil if path.nil?
29
+
30
+ raise MissingParameterException.new(:path) if path.nil?
31
+
32
+ case options[:workflows]
33
+ when nil, false, "false", "none"
34
+ when "all"
35
+ Scout.etc.workflows.list.each do |workflow|
36
+ Workflow.require_workflow file
37
+ end if Scout.etc.workflows.exists?
38
+ else
39
+ options[:workflows].split(/[ ,;|]/).each do |workflow|
40
+ Workflow.require_workflow workflow
41
+ end
42
+ end
43
+
44
+ case options[:requires]
45
+ when nil, false, "false", "none"
46
+ when "all"
47
+ Scout.etc.requires.list.each do |file|
48
+ require file
49
+ end if Scout.etc.requires.exists?
50
+ else
51
+ options[:requires].split(/[ ,;|]/).each do |file|
52
+ require file
53
+ end
54
+ end
55
+
56
+ location = nil
57
+ where = options[:where]
58
+ all = options[:all]
59
+
60
+ begin
61
+ resource = Workflow.require_workflow resource
62
+ rescue
63
+ begin
64
+ resource = Kernel.const_get(resource)
65
+ rescue
66
+ raise "Resource not found: #{ resource }"
67
+ end
68
+ end if resource
69
+
70
+ path = (resource || Scout)[path.dup]
71
+
72
+ if where.nil? || where == 'all' || path.path_maps.include?(where.to_sym)
73
+ case where
74
+ when nil
75
+ location = path.glob
76
+ when 'all'
77
+ location = path.glob_all
78
+ else
79
+ location = path.find(where).glob
80
+ end
81
+
82
+ if Array === location
83
+ puts location * "\n"
84
+ else
85
+ location = nil if ! Open.exists?(location)
86
+ puts location
87
+ end
88
+ else
89
+ raise ParameterException, "Where '#{where}' not identified. Try scout-camp if looking for a remote file"
90
+ end
@@ -18,7 +18,7 @@ $ #{$0} [<options>] <workflow> <task>
18
18
  -h--help Print this help
19
19
  --nostream Disable job streaming
20
20
  --update Update jobs with newer dependencies
21
- --deploy* Deploy mode: serial, local, or SLURM (default 'serial')
21
+ --deploy* Deploy mode: serial, local, queue, or SLURM (default 'serial')
22
22
  --fork Fork and return path
23
23
  --load_inputs* Directory or file with inputs files to load
24
24
  --save_inputs* Directory or tar.gz file path to store inputs
@@ -115,7 +115,8 @@ else
115
115
  when "serial"
116
116
  job.run(true)
117
117
  when "local"
118
- orchestrator = Workflow::Orchestrator.new 3, "cpus" => Misc.processors
118
+ refresh = Scout::Config.get :refresh, :deploy, :local, :orchestrator, default: 3
119
+ orchestrator = Workflow::Orchestrator.new refresh.to_f, "cpus" => Misc.processors
119
120
  orchestrator.process({}, job)
120
121
  when "slurm"
121
122
  require 'rbbt-scout'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.8.0
4
+ version: 10.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-05 00:00:00.000000000 Z
10
+ date: 2025-06-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: scout-essentials