scout-gear 10.7.3 → 10.7.4

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: 469b6e128a39e5612de5698005de8f4859c015bf3d65a5490a58f2f9f0312a39
4
- data.tar.gz: 0a76edd86052c35af31f6de227c0bc43c71bb6b64fdc757e1179bf88a4ce8701
3
+ metadata.gz: 92262edf62404f5935bf749d3ab71d2ce39ffc7292a1b3d860fd5dc712501fcb
4
+ data.tar.gz: 47f69a80c0a135d3a9b3b42558e7b91e766b7781ff2360cd8344ef9c0f7ac8b9
5
5
  SHA512:
6
- metadata.gz: c8753c031fda58c461afdefa3412a0d7996c6d5139a30653b1e6fcfaeba7fdf31b4d300bb2cb07060e7eb12d63891fc7a157cec3964c59d5cc68584ffc8823c8
7
- data.tar.gz: 05cbb772edf0384f2889ad1be2cc597425d071da8c488364a8c72b23e6b7098aea0089247c180da09165f3eb7d899de494dca9ce2a00f285dcfaa564c8dc3e68
6
+ metadata.gz: 3d532c6a4ac2bd3d0b5584761531b0364f381c317a9864b85b22c7a23bd61dbf2b31d1655f5fc7085c893c843f1b3f36a1b23fffae4c4b9dc2253352f3f5febf
7
+ data.tar.gz: 50e36c694239f0d74528b9156435b8769d16ae172dd87029ee741c0002b8ef3606f5088fc2c8f881d413b78f1f00f66134f06fc14129da3015648546130809c6
data/.vimproject CHANGED
@@ -31,6 +31,7 @@ scout-gear=/$PWD filter="*.rb *.yaml" {
31
31
  task=task{
32
32
  dependencies.rb
33
33
  inputs.rb
34
+ info.rb
34
35
  }
35
36
  deployment.rb
36
37
  deployment=deployment{
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.7.3
1
+ 10.7.4
data/bin/scout CHANGED
@@ -52,6 +52,16 @@ if dev_dir
52
52
  end
53
53
  end
54
54
 
55
+ requires = nil
56
+ if _i = ARGV.index("--require")
57
+ requires = ARGV[_i+1].split(",")
58
+ ARGV.delete_at _i + 1
59
+ ARGV.delete_at _i
60
+ requires.each do |p|
61
+ require p
62
+ end
63
+ end
64
+
55
65
  require 'scout-gear'
56
66
 
57
67
  require 'scout/simple_opt'
@@ -97,8 +107,11 @@ if config_keys = options.delete(:config_keys)
97
107
  end
98
108
  end
99
109
 
100
- $scout_command_dir = Scout.bin.scout
101
- $scout_command_dir.path_maps[:scout_commands] = File.join(File.dirname(__dir__), "{PATH/bin\\/scout/scout_commands}")
110
+ #$scout_command_dir = Scout.bin.scout
111
+ #$scout_command_dir.path_maps[:scout_commands] = File.join(File.dirname(__dir__), "{PATH/bin\\/scout/scout_commands}")
112
+
113
+ $scout_command_dir = Scout.scout_commands
114
+ #$scout_command_dir.path_maps[:scout_commands] = File.join(File.dirname(__dir__), "{PATH/bin\\/scout/scout_commands}")
102
115
 
103
116
  SOPT.description =<<EOF
104
117
  This command controls many aspects of the Scout framework, from configuration tasks to running applications.
@@ -11,7 +11,9 @@ module Association
11
11
  target = kwargs.delete :target if kwargs.include?(:target)
12
12
 
13
13
  if Path.is_filename?(obj)
14
- options = TSV.parse_options(obj).merge(kwargs)
14
+ tsv_header_options = TSV.parse_options(obj)
15
+ tsv_header_options = tsv_header_options.slice(TSV.acceptable_parser_options)
16
+ options = tsv_header_options.merge(kwargs)
15
17
  else
16
18
  options = kwargs.dup
17
19
  end
@@ -116,11 +118,12 @@ module Association
116
118
  persist_options = IndiferentHash.pull_keys kwargs, :persist
117
119
 
118
120
  database_persist_options = IndiferentHash.add_defaults persist_options.dup, persist: true,
119
- prefix: "Association::Index", serializer: :list,
121
+ prefix: "Association::Index", serializer: :double,
120
122
  other_options: kwargs
121
123
 
122
124
  Persist.tsv(file, kwargs, engine: "BDB", persist_options: database_persist_options) do |data|
123
125
  tsv = open(file, *args, **kwargs)
126
+ data.serializer = TSVAdapter.serializer_module(tsv.type) if data.respond_to?(:serializer)
124
127
  if TSV::Transformer === tsv
125
128
  tsv.tsv(merge: true, data: data)
126
129
  elsif data.respond_to?(:persistence_path)
@@ -62,7 +62,6 @@ module Entity
62
62
 
63
63
  properties.push name
64
64
 
65
-
66
65
  entity_class = self
67
66
  if type == :multiple
68
67
  self.define_method(real_method) do |*args,**kwargs|
@@ -89,7 +88,7 @@ module Entity
89
88
 
90
89
  new_responses = missing.instance_exec(*args, **kwargs, &block)
91
90
 
92
- missing.each do |item,i|
91
+ missing.each do |item|
93
92
  responses[item] = Entity::Property.persist(name, item, type, options) do
94
93
  Array === new_responses ? new_responses[item.container_index] : new_responses[item]
95
94
  end
@@ -63,7 +63,7 @@ class KnowledgeBase
63
63
  entities.collect{|entity| Entity.formats[entity] }.uniq
64
64
  end
65
65
 
66
- def identifier_files(name)
66
+ def database_identifier_files(name)
67
67
  get_database(name).identifier_files.dup + self.identifier_files
68
68
  end
69
69
 
@@ -73,7 +73,11 @@ class KnowledgeBase
73
73
 
74
74
  def source_index(name)
75
75
  Persist.memory("Source index #{name}: KB directory #{dir}") do
76
- identifier_files = identifier_files(name)
76
+ if @identifier_files && @identifier_files.any?
77
+ identifier_files = @identifier_files
78
+ else
79
+ identifier_files = database_identifier_files(name)
80
+ end
77
81
  identifier_files.concat Entity.identifier_files(source(name)) if defined? Entity
78
82
  identifier_files.uniq!
79
83
  identifier_files.collect!{|f| f.annotate(f.gsub(/\bNAMESPACE\b/, namespace))} if namespace
@@ -97,7 +101,12 @@ class KnowledgeBase
97
101
 
98
102
  def identify_source(name, entity)
99
103
  return :all if entity == :all
100
- index = begin source_index(name) rescue nil end
104
+ index = begin
105
+ source_index(name)
106
+ rescue
107
+ Log.exception $!
108
+ nil
109
+ end
101
110
  return entity if index.nil?
102
111
  if Array === entity
103
112
  entity.collect{|e| index[e] || e }
@@ -43,9 +43,11 @@ class KnowledgeBase
43
43
  end
44
44
 
45
45
  def undirected(name)
46
- description(name)[2]
46
+ description(name).length == 3
47
47
  end
48
48
 
49
+ alias undirected? undirected
50
+
49
51
  def get_index(name, options = {})
50
52
  name = name.to_s
51
53
  options[:namespace] ||= self.namespace unless self.namespace.nil?
@@ -1,105 +1,112 @@
1
- require 'tokyocabinet'
2
-
3
- module ScoutCabinet
4
- attr_accessor :persistence_path, :persistence_class
5
-
6
- def self.open(path, write = true, tokyocabinet_class = TokyoCabinet::HDB)
7
- path = path.find if Path === path
8
- if String === tokyocabinet_class && tokyocabinet_class.include?(":big")
9
- big = true
10
- tokyocabinet_class = tokyocabinet_class.split(":").first
11
- else
12
- big = false
13
- end
1
+ begin
2
+ require 'tokyocabinet'
3
+ continue = true
4
+ rescue Exception
5
+ Log.warn "The Tokyocabinet gem could not be loaded: TSV persistence may not work"
6
+ continue = false
7
+ end
14
8
 
15
- dir = File.dirname(File.expand_path(path))
16
- Open.mkdir(dir) unless File.exist?(dir)
9
+ if continue
10
+ module ScoutCabinet
11
+ attr_accessor :persistence_path, :persistence_class
17
12
 
18
- tokyocabinet_class = tokyocabinet_class.to_s if Symbol === tokyocabinet_class
19
- tokyocabinet_class = TokyoCabinet::HDB if tokyocabinet_class == "HDB" or tokyocabinet_class.nil?
20
- tokyocabinet_class = TokyoCabinet::BDB if tokyocabinet_class == "BDB"
13
+ def self.open(path, write = true, tokyocabinet_class = TokyoCabinet::HDB)
14
+ path = path.find if Path === path
15
+ if String === tokyocabinet_class && tokyocabinet_class.include?(":big")
16
+ big = true
17
+ tokyocabinet_class = tokyocabinet_class.split(":").first
18
+ else
19
+ big = false
20
+ end
21
21
 
22
- # Hack - Ignore warning: undefining the allocator of T_DATA class
23
- # TokyoCabinet::HDB_data
24
- database = Log.ignore_stderr do Persist::CONNECTIONS[path] ||= tokyocabinet_class.new end
22
+ dir = File.dirname(File.expand_path(path))
23
+ Open.mkdir(dir) unless File.exist?(dir)
25
24
 
26
- if big and not Open.exists?(path)
27
- database.tune(nil, nil, nil, tokyocabinet_class::TLARGE | tokyocabinet_class::TDEFLATE)
28
- end
25
+ tokyocabinet_class = tokyocabinet_class.to_s if Symbol === tokyocabinet_class
26
+ tokyocabinet_class = TokyoCabinet::HDB if tokyocabinet_class == "HDB" or tokyocabinet_class.nil?
27
+ tokyocabinet_class = TokyoCabinet::BDB if tokyocabinet_class == "BDB"
29
28
 
30
- flags = (write ? tokyocabinet_class::OWRITER | tokyocabinet_class::OCREAT : tokyocabinet_class::OREADER)
31
- database.close
29
+ # Hack - Ignore warning: undefining the allocator of T_DATA class
30
+ # TokyoCabinet::HDB_data
31
+ database = Log.ignore_stderr do Persist::CONNECTIONS[path] ||= tokyocabinet_class.new end
32
32
 
33
- if !database.open(path, flags)
34
- ecode = database.ecode
35
- raise "Open error: #{database.errmsg(ecode)}. Trying to open file #{path}"
36
- end
33
+ if big and not Open.exists?(path)
34
+ database.tune(nil, nil, nil, tokyocabinet_class::TLARGE | tokyocabinet_class::TDEFLATE)
35
+ end
37
36
 
38
- database.extend ScoutCabinet
39
- database.persistence_path ||= path
40
- database.persistence_class = tokyocabinet_class
37
+ flags = (write ? tokyocabinet_class::OWRITER | tokyocabinet_class::OCREAT : tokyocabinet_class::OREADER)
38
+ database.close
41
39
 
42
- database.open(path, tokyocabinet_class::OREADER)
40
+ if !database.open(path, flags)
41
+ ecode = database.ecode
42
+ raise "Open error: #{database.errmsg(ecode)}. Trying to open file #{path}"
43
+ end
43
44
 
44
- database.define_singleton_method(:fingerprint){ "#{self.persistence_class}:#{self.persistence_path}" }
45
+ database.extend ScoutCabinet
46
+ database.persistence_path ||= path
47
+ database.persistence_class = tokyocabinet_class
45
48
 
46
- Persist::CONNECTIONS[path] = database
49
+ database.open(path, tokyocabinet_class::OREADER)
47
50
 
48
- database
49
- end
51
+ database.define_singleton_method(:fingerprint){ "#{self.persistence_class}:#{self.persistence_path}" }
50
52
 
51
- def close
52
- @closed = true
53
- @writable = false
54
- super
55
- end
53
+ Persist::CONNECTIONS[path] = database
56
54
 
57
- def read(force = false)
58
- return if ! @writable && ! @closed && ! force
59
- self.close
60
- if !self.open(@persistence_path, persistence_class::OREADER)
61
- ecode = self.ecode
62
- raise "Open error: #{self.errmsg(ecode)}. Trying to open file #{@persistence_path}"
55
+ database
63
56
  end
64
57
 
65
- @writable = false
66
- @closed = false
67
-
68
- self
69
- end
58
+ def close
59
+ @closed = true
60
+ @writable = false
61
+ super
62
+ end
70
63
 
71
- def write?
72
- @writable
73
- end
64
+ def read(force = false)
65
+ return if ! @writable && ! @closed && ! force
66
+ self.close
67
+ if !self.open(@persistence_path, persistence_class::OREADER)
68
+ ecode = self.ecode
69
+ raise "Open error: #{self.errmsg(ecode)}. Trying to open file #{@persistence_path}"
70
+ end
74
71
 
75
- def closed?
76
- @closed
77
- end
72
+ @writable = false
73
+ @closed = false
78
74
 
75
+ self
76
+ end
79
77
 
80
- def write(force = true)
81
- return if write? && ! closed? && ! force
82
- self.close
78
+ def write?
79
+ @writable
80
+ end
83
81
 
84
- if !self.open(@persistence_path, persistence_class::OWRITER)
85
- ecode = self.ecode
86
- raise "Open error: #{self.errmsg(ecode)}. Trying to open file #{@persistence_path}"
82
+ def closed?
83
+ @closed
87
84
  end
88
85
 
89
- @writable = true
90
- @closed = false
91
86
 
92
- self
93
- end
87
+ def write(force = true)
88
+ return if write? && ! closed? && ! force
89
+ self.close
94
90
 
95
- def write_and_read
96
- begin
97
- write
98
- yield
99
- ensure
100
- read
91
+ if !self.open(@persistence_path, persistence_class::OWRITER)
92
+ ecode = self.ecode
93
+ raise "Open error: #{self.errmsg(ecode)}. Trying to open file #{@persistence_path}"
94
+ end
95
+
96
+ @writable = true
97
+ @closed = false
98
+
99
+ self
100
+ end
101
+
102
+ def write_and_read
103
+ begin
104
+ write
105
+ yield
106
+ ensure
107
+ read
108
+ end
101
109
  end
102
- end
103
110
 
104
111
  def write_and_close
105
112
  begin
@@ -139,4 +146,5 @@ module ScoutCabinet
139
146
  end
140
147
 
141
148
  alias load_stream importtsv
149
+ end
142
150
  end
@@ -23,6 +23,7 @@ module TSVAdapter
23
23
  end
24
24
 
25
25
  def save_annotation_hash
26
+ self.close
26
27
  self.with_write do
27
28
  self.orig_set(ANNOTATION_ATTR_HASH_KEY, ANNOTATION_ATTR_HASH_SERIALIZER.dump(self.annotation_hash))
28
29
  end
@@ -165,15 +166,6 @@ module TSVAdapter
165
166
  end
166
167
  end
167
168
 
168
- def with_write(*args, &block)
169
- if @write
170
- yield
171
- elsif @closed
172
- write_and_close &block
173
- else
174
- write_and_read &block
175
- end
176
- end
177
169
 
178
170
  def close(*args)
179
171
  begin
@@ -250,12 +242,11 @@ module TSVAdapter
250
242
 
251
243
  lock do
252
244
  write(true) if closed? || ! write?
253
- res = begin
254
- yield
255
- ensure
256
- close
257
- end
258
- res
245
+ begin
246
+ yield
247
+ ensure
248
+ close
249
+ end
259
250
  end
260
251
  end
261
252
 
@@ -272,18 +263,13 @@ module TSVAdapter
272
263
  return yield
273
264
  else
274
265
  if self.read?
275
- self.write_and_read do
276
- return yield
277
- end
266
+ self.write_and_read(&block)
278
267
  else
279
- self.write_and_close do
280
- return yield
281
- end
268
+ self.write_and_close(&block)
282
269
  end
283
270
  end
284
271
  end
285
272
 
286
-
287
273
  def read_and_close
288
274
  if read? || write?
289
275
  begin
@@ -1,5 +1,15 @@
1
1
  require 'scout/named_array'
2
2
  module TSV
3
+ def self.acceptable_parser_options(func = nil)
4
+ if func.nil?
5
+ TSV.method(:parse_line).parameters.collect{|a| a.last } +
6
+ TSV.method(:parse_stream).parameters.collect{|a| a.last } +
7
+ TSV.method(:parse).parameters.collect{|a| a.last } - [:line, :block]
8
+ else
9
+ TSV.method(func).parameters.collect{|a| a.last }
10
+ end.uniq
11
+ end
12
+
3
13
  def self.cast_value(value, cast)
4
14
  if Array === value
5
15
  value.collect{|e| cast_value(e, cast) }
@@ -175,5 +175,17 @@ module TSV
175
175
  end
176
176
  res
177
177
  end
178
+
179
+ def head(max=10)
180
+ res = self.annotate({})
181
+ transformer = Transformer.new self, res
182
+ i = 0
183
+ transformer.traverse do |k,v|
184
+ i += 1
185
+ break if i > max
186
+ [k, v]
187
+ end
188
+ res
189
+ end
178
190
  end
179
191
 
@@ -30,9 +30,9 @@ module TSV
30
30
  when type == :flat
31
31
  self[key] = new_values
32
32
  else
33
- if ! values[field_pos].frozen? && ((String === values[field_pos] && String === new_values) ||
33
+ if ! values[field_pos].frozen? && ! NamedArray === values && ((String === values[field_pos] && String === new_values) ||
34
34
  (Array === values[field_pos] && Array === new_values))
35
- values[field_pos].replace new_values
35
+ values[field_pos].replace new_values
36
36
  else
37
37
  values[field_pos] = new_values
38
38
  end
@@ -13,8 +13,12 @@ module Workflow
13
13
 
14
14
  end
15
15
 
16
+ def to_s
17
+ @name || super
18
+ end
19
+
16
20
  def name
17
- @name ||= self.to_s
21
+ @name || to_s
18
22
  end
19
23
 
20
24
  def helpers
@@ -192,7 +196,7 @@ module Workflow
192
196
  when 'true'
193
197
  dep.clean
194
198
  when 'recursive'
195
- (dep.dependencies + dep.rec_dependencies).uniq.each do |d|
199
+ (dep.dependencies.to_a + dep.rec_dependencies.to_a).uniq.each do |d|
196
200
  next if d.overriden
197
201
  d.clean unless Scout::Config.get(:remove_dep, "task:#{d.task_signature}", "task:#{d.task_name}", "workflow:#{d.workflow.name}", :default => true).to_s == 'false'
198
202
  end
@@ -164,7 +164,7 @@ module Workflow
164
164
  def self.trace(seed_jobs, options = {})
165
165
  jobs = []
166
166
  seed_jobs.each do |step|
167
- jobs += step.rec_dependencies + [step]
167
+ jobs += step.rec_dependencies.to_a + [step]
168
168
  step.info[:archived_info].each do |path,ainfo|
169
169
  next unless Hash === ainfo
170
170
  archived_step = Step.new path
@@ -1,5 +1,5 @@
1
1
  class Step
2
- def rec_dependencies(connected = false, seen = [])
2
+ def rec_dependencies(connected = false, seen = Set.new)
3
3
  @rec_dependencies = {}
4
4
  @rec_dependencies[connected] ||= begin
5
5
  direct_deps = []
@@ -8,11 +8,8 @@ class Step
8
8
  next if connected && dep.done? && dep.updated?
9
9
  direct_deps << dep
10
10
  end if dependencies
11
- seen.concat direct_deps.collect{|d| d.path }
12
- seen.uniq!
13
- direct_deps.inject(direct_deps){|acc,d| acc.concat(d.rec_dependencies(connected, seen)); acc }
14
- direct_deps.uniq!
15
- direct_deps
11
+ seen += direct_deps.collect{|d| d.path }
12
+ direct_deps.inject(Set.new(direct_deps)){|acc,d| acc += d.rec_dependencies(connected, seen) }
16
13
  end
17
14
  end
18
15
 
@@ -1,5 +1,6 @@
1
+ require 'scout/config'
1
2
  class Step
2
- SERIALIZER = :marshal
3
+ SERIALIZER = Scout::Config.get(:serializer, :step_info, :info, :step, env: "SCOUT_SERIALIZER", default: :json)
3
4
  def info_file
4
5
  return nil if @path.nil?
5
6
  @info_file ||= begin
@@ -13,7 +14,11 @@ class Step
13
14
  info = begin
14
15
  Persist.load(info_file, SERIALIZER) || {}
15
16
  rescue
16
- {status: :noinfo}
17
+ begin
18
+ Persist.load(info_file, :marshal) || {}
19
+ rescue
20
+ {status: :noinfo}
21
+ end
17
22
  end
18
23
  IndiferentHash.setup(info)
19
24
  end
@@ -0,0 +1,99 @@
1
+ require_relative 'inputs'
2
+ module Workflow
3
+
4
+ def rec_inputs(task_name)
5
+ tasks[task_name].recursive_inputs.collect{|name, _| name }
6
+ end
7
+
8
+ def rec_input_types(task_name)
9
+ tasks[task_name].recursive_inputs.inject({}) do |acc,l|
10
+ name, type, desc, default, options = l
11
+ acc.merge!(name => type) unless acc.include?(name)
12
+ acc
13
+ end
14
+ end
15
+
16
+
17
+ def rec_input_descriptions(task_name)
18
+ tasks[task_name].recursive_inputs.inject({}) do |acc,l|
19
+ name, type, desc, default, options = l
20
+ acc.merge!(name => desc) unless desc.nil? || acc.include?(name)
21
+ acc
22
+ end
23
+ end
24
+
25
+ def rec_input_defaults(task_name)
26
+ tasks[task_name].recursive_inputs.inject({}) do |acc,l|
27
+ name, type, desc, default, options = l
28
+ acc.merge!(name => default) unless default.nil? || acc.include?(name)
29
+ acc
30
+ end
31
+ end
32
+
33
+ def rec_input_options(task_name)
34
+ tasks[task_name].recursive_inputs.inject({}) do |acc,l|
35
+ name, type, desc, default, options = l
36
+ acc.merge!(name => options) unless options.nil? unless acc.include?(name)
37
+ acc
38
+ end
39
+ end
40
+
41
+
42
+ def rec_input_use(task_name)
43
+ input_use = {}
44
+ task = self.tasks[task_name]
45
+ task.inputs.each do |name,_|
46
+ input_use[name] ||= {}
47
+ input_use[name][self] ||= []
48
+ input_use[name][self] << task_name
49
+ end
50
+
51
+ task.deps.inject(input_use) do |acc,p|
52
+ workflow, task_name = p
53
+ next if task_name.nil?
54
+ workflow.rec_input_use(task_name).each do |name,uses|
55
+ acc[name] ||= {}
56
+ uses.each do |workflow, task_names|
57
+ acc[name][workflow] ||= []
58
+ acc[name][workflow].concat(task_names)
59
+ end
60
+ end
61
+ acc
62
+ end if task.deps
63
+
64
+ input_use
65
+ end
66
+ def task_info(name)
67
+ name = name.to_sym
68
+ task = tasks[name]
69
+ raise "No '#{name}' task in '#{self.name}' Workflow" if task.nil?
70
+ id = File.join(self.name, name.to_s)
71
+ @task_info ||= {}
72
+ @task_info[id] ||= begin
73
+ description = task.description
74
+ returns = task.returns
75
+
76
+ inputs = rec_inputs(name).uniq
77
+ input_types = rec_input_types(name)
78
+ input_descriptions = rec_input_descriptions(name)
79
+ input_use = rec_input_use(name)
80
+ input_defaults = rec_input_defaults(name)
81
+ input_options = rec_input_options(name)
82
+ extension = task.extension
83
+
84
+ dependencies = tasks[name].deps
85
+ { :id => id,
86
+ :description => description,
87
+ :inputs => inputs,
88
+ :input_types => input_types,
89
+ :input_descriptions => input_descriptions,
90
+ :input_defaults => input_defaults,
91
+ :input_options => input_options,
92
+ :input_use => input_use,
93
+ :returns => returns,
94
+ :dependencies => dependencies,
95
+ :extension => extension
96
+ }
97
+ end
98
+ end
99
+ end
@@ -3,6 +3,7 @@ require 'scout/named_array'
3
3
  require_relative 'step'
4
4
  require_relative 'task/inputs'
5
5
  require_relative 'task/dependencies'
6
+ require_relative 'task/info'
6
7
 
7
8
  module Task
8
9
  extend Annotation
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.7.3 ruby lib
5
+ # stub: scout-gear 10.7.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-gear".freeze
9
- s.version = "10.7.3".freeze
9
+ s.version = "10.7.4".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-01-17"
14
+ s.date = "2025-03-10"
15
15
  s.description = "Temporary files, logs, path, resources, persistence, workflows, TSV, etc.".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.executables = ["scout".freeze]
@@ -121,6 +121,7 @@ Gem::Specification.new do |s|
121
121
  "lib/scout/workflow/step/status.rb",
122
122
  "lib/scout/workflow/task.rb",
123
123
  "lib/scout/workflow/task/dependencies.rb",
124
+ "lib/scout/workflow/task/info.rb",
124
125
  "lib/scout/workflow/task/inputs.rb",
125
126
  "lib/scout/workflow/usage.rb",
126
127
  "lib/scout/workflow/util.rb",
@@ -235,6 +236,7 @@ Gem::Specification.new do |s|
235
236
  "test/scout/workflow/step/test_provenance.rb",
236
237
  "test/scout/workflow/step/test_status.rb",
237
238
  "test/scout/workflow/task/test_dependencies.rb",
239
+ "test/scout/workflow/task/test_info.rb",
238
240
  "test/scout/workflow/task/test_inputs.rb",
239
241
  "test/scout/workflow/test_definition.rb",
240
242
  "test/scout/workflow/test_documentation.rb",
@@ -249,7 +251,7 @@ Gem::Specification.new do |s|
249
251
  ]
250
252
  s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
251
253
  s.licenses = ["MIT".freeze]
252
- s.rubygems_version = "3.5.23".freeze
254
+ s.rubygems_version = "3.6.5".freeze
253
255
  s.summary = "basic gear for scouts".freeze
254
256
 
255
257
  s.specification_version = 4
data/scout_commands/doc CHANGED
@@ -26,12 +26,12 @@ end
26
26
 
27
27
  module_name = ARGV.first
28
28
  if module_name.nil?
29
- puts Rbbt.doc.lib.scout.glob("**/*.md").collect{|f| File.basename(f.unset_extension) } * "\n"
29
+ puts Scout.doc.lib.scout.glob("**/*.md").collect{|f| File.basename(f.unset_extension) } * "\n"
30
30
  else
31
31
  begin
32
- puts Rbbt.doc.lib.scout[module_name].find_with_extension('md', :lib).read
32
+ puts Scout.doc.lib.scout[module_name].find_with_extension('md', :lib).read
33
33
  rescue
34
- puts Rbbt.doc.lib.scout.glob("**/*.md").select{|f| File.basename(f.unset_extension) == module_name }.first.read
34
+ puts Scout.doc.lib.scout.glob("**/*.md").select{|f| File.basename(f.unset_extension) == module_name }.first.read
35
35
  end
36
36
  end
37
37
 
@@ -19,6 +19,7 @@ $ #{$0} [<options>] <workflow> <task>
19
19
  --nostream Disable job streaming
20
20
  --update Update jobs with newer dependencies
21
21
  --deploy* Deploy mode: serial, local, or SLURM (default 'serial')
22
+ --fork Fork and return path
22
23
  -jn--jobname* Name to use as job identifier
23
24
  -li--load_inputs* Directory with inputs files to load
24
25
  -pf--printpath Print the file path
@@ -39,8 +40,8 @@ task = workflow.tasks[task_name.to_sym] if task_name
39
40
 
40
41
  options[:help] = true if task.nil?
41
42
 
42
- help, provenance, clean, recursive_clean, clean_task, load_inputs, jobname, printpath, deploy, override_deps = IndiferentHash.process_options options,
43
- :help, :provenance, :clean, :recursive_clean, :clean_task, :load_inputs, :jobname, :printpath, :deploy, :override_deps,
43
+ help, provenance, clean, recursive_clean, clean_task, load_inputs, jobname, printpath, deploy, override_deps, do_fork = IndiferentHash.process_options options,
44
+ :help, :provenance, :clean, :recursive_clean, :clean_task, :load_inputs, :jobname, :printpath, :deploy, :override_deps, :fork,
44
45
  :deploy => 'serial'
45
46
 
46
47
  if help
@@ -92,6 +93,10 @@ end
92
93
 
93
94
  if provenance
94
95
  puts Step.prov_report(job)
96
+ elsif do_fork
97
+ job.fork
98
+ puts job.path
99
+ exit 0
95
100
  else
96
101
  case deploy
97
102
  when "serial"
@@ -14,10 +14,10 @@ class TestKnowledgeBaseQuery < Test::Unit::TestCase
14
14
  kb.save_list("bro_and_sis", list)
15
15
  assert_equal list, kb.load_list("bro_and_sis")
16
16
 
17
- assert_include kb.list_files["Person"], "bro_and_sis"
17
+ assert_include kb.lists["Person"], "bro_and_sis"
18
18
  kb.delete_list("bro_and_sis")
19
19
 
20
- refute kb.list_files["simple"]
20
+ refute kb.lists["simple"]
21
21
  end
22
22
  end
23
23
 
@@ -30,11 +30,11 @@ class TestKnowledgeBaseQuery < Test::Unit::TestCase
30
30
 
31
31
  assert_equal list, kb.load_list("bro_and_sis")
32
32
 
33
- assert_include kb.list_files["simple"], "bro_and_sis"
33
+ assert_include kb.lists["simple"], "bro_and_sis"
34
34
 
35
35
  kb.delete_list("bro_and_sis")
36
36
 
37
- refute kb.list_files["simple"]
37
+ refute kb.lists["simple"].any?
38
38
  end
39
39
  end
40
40
  end
@@ -12,5 +12,24 @@ class TestKnowlegeBase < Test::Unit::TestCase
12
12
  assert_include kb.all_databases, :brothers
13
13
  end
14
14
  end
15
+
16
+ def test_registry_identifiers
17
+ identifier =<<-EOF
18
+ #Alias,Initials
19
+ Clei,CC
20
+ Miki,MV
21
+ Guille,GC
22
+ Isa,IV
23
+ EOF
24
+ TmpFile.with_dir do |dir|
25
+ TmpFile.with_file(identifier) do |identifier_file|
26
+ identifiers = TSV.open(identifier_file, sep: ",", type: :single)
27
+ brothers = datafile_test(:person).brothers
28
+ kb = KnowledgeBase.new dir
29
+ kb.register :brothers, brothers, identifiers: identifiers
30
+ assert_include kb.get_index(:brothers, source: "=>Initials"), "CC~Guille"
31
+ end
32
+ end
33
+ end
15
34
  end
16
35
 
@@ -74,6 +74,7 @@ row2 a a id3
74
74
  assert_include tsv.keys, 'row1'
75
75
  assert_include tsv.keys, 'row2'
76
76
 
77
+ tsv.close
77
78
  assert_nothing_raised do
78
79
  tsv = Persist.persist("TEST Persist TSV", :HDB) do
79
80
  raise
@@ -61,5 +61,20 @@ class TestAssociation < Test::Unit::TestCase
61
61
  database = Association.database(datadir_test.person.brothers, source: "Older=~Older (Alias)=>Name", persist: true)
62
62
  assert database.respond_to?(:persistence_path)
63
63
  end
64
+
65
+ def test_extra_options
66
+ file=<<-EOF
67
+ #: :extra_option=:test
68
+ #Key,Value
69
+ k,v
70
+ EOF
71
+
72
+ TmpFile.with_path(file.gsub(',', "\t")) do |f|
73
+ assert_nothing_raised do
74
+ Association.open(f, target: "Value", source: "Key")
75
+ end
76
+ end
77
+
78
+ end
64
79
  end
65
80
 
@@ -427,4 +427,19 @@ row2 A B Id3
427
427
  assert_equal %w(a aa aaa), tsv["row1"]
428
428
  end
429
429
  end
430
+
431
+ def test_number_key
432
+ content =<<-EOF
433
+ #Id ValueA ValueB OtherID
434
+ 1 a|aa|aaa b Id1|Id2
435
+ 2 A B Id3
436
+ EOF
437
+
438
+ TmpFile.with_file(content) do |filename|
439
+ tsv = TSV.open(filename, :sep => /\s+/, field: "ValueB")
440
+ assert_equal "b", tsv["1"]
441
+ end
442
+
443
+
444
+ end
430
445
  end
@@ -317,4 +317,8 @@ k4 a|A b|B
317
317
  assert Open.read(tmp_logfile).include?("directly into")
318
318
  end
319
319
  end
320
+
321
+ def test_acceptable_parser_options
322
+ assert_include TSV.acceptable_parser_options, :namespace
323
+ end
320
324
  end
@@ -153,4 +153,17 @@ row2 A2 B2
153
153
  tsv = TSV.open(content)
154
154
  assert_equal %w(A1), tsv.to_double["row1"]["ValueA"]
155
155
  end
156
+
157
+ def test_head
158
+ content =<<-EOF
159
+ #: :sep=" "
160
+ #ID ValueA ValueB
161
+ row1 A1 B1
162
+ row2 A2 B2
163
+ row3 A3 B3
164
+ EOF
165
+
166
+ tsv = TSV.open(content)
167
+ assert_equal ["row1", "row2"], tsv.head(2).keys
168
+ end
156
169
  end
@@ -3,6 +3,17 @@ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1
3
3
  require 'scout/workflow'
4
4
 
5
5
  class TestStepInfo < Test::Unit::TestCase
6
+ def test_benchmark
7
+ i = {a:1, b: [1,2], c: "String"}
8
+ times = 100000
9
+ Misc.benchmark(times) do
10
+ Marshal.dump(i)
11
+ end
12
+ Misc.benchmark(times) do
13
+ i.to_json
14
+ end
15
+ end
16
+
6
17
  def test_dependency
7
18
  TmpFile.with_file do |tmpdir|
8
19
  Path.setup(tmpdir)
@@ -0,0 +1,22 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ require 'scout/workflow'
5
+ class TestWorkflowInfo < Test::Unit::TestCase
6
+ def test_task_info
7
+ m = Module.new do
8
+ extend Workflow
9
+ self.name = "TestWF"
10
+
11
+ input :option1
12
+ task :step1 do end
13
+
14
+ dep :step1
15
+ input :option2
16
+ task :step2 do end
17
+ end
18
+ info = m.task_info :step2
19
+ assert_equal "TestWF/step2", info[:id]
20
+ end
21
+ end
22
+
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.7.3
4
+ version: 10.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-17 00:00:00.000000000 Z
10
+ date: 2025-03-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: scout-essentials
@@ -233,6 +232,7 @@ files:
233
232
  - lib/scout/workflow/step/status.rb
234
233
  - lib/scout/workflow/task.rb
235
234
  - lib/scout/workflow/task/dependencies.rb
235
+ - lib/scout/workflow/task/info.rb
236
236
  - lib/scout/workflow/task/inputs.rb
237
237
  - lib/scout/workflow/usage.rb
238
238
  - lib/scout/workflow/util.rb
@@ -347,6 +347,7 @@ files:
347
347
  - test/scout/workflow/step/test_provenance.rb
348
348
  - test/scout/workflow/step/test_status.rb
349
349
  - test/scout/workflow/task/test_dependencies.rb
350
+ - test/scout/workflow/task/test_info.rb
350
351
  - test/scout/workflow/task/test_inputs.rb
351
352
  - test/scout/workflow/test_definition.rb
352
353
  - test/scout/workflow/test_documentation.rb
@@ -362,7 +363,6 @@ homepage: http://github.com/mikisvaz/scout-gear
362
363
  licenses:
363
364
  - MIT
364
365
  metadata: {}
365
- post_install_message:
366
366
  rdoc_options: []
367
367
  require_paths:
368
368
  - lib
@@ -377,8 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
377
  - !ruby/object:Gem::Version
378
378
  version: '0'
379
379
  requirements: []
380
- rubygems_version: 3.5.23
381
- signing_key:
380
+ rubygems_version: 3.6.5
382
381
  specification_version: 4
383
382
  summary: basic gear for scouts
384
383
  test_files: []