scout-gear 10.7.0 → 10.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +2 -1
- data/VERSION +1 -1
- data/lib/scout/entity.rb +2 -0
- data/lib/scout/tsv/parser.rb +1 -0
- data/lib/scout/workflow/definition.rb +21 -6
- data/lib/scout/workflow/deployment/orchestrator.rb +2 -2
- data/lib/scout/workflow/exceptions.rb +1 -0
- data/lib/scout/workflow/path.rb +40 -0
- data/lib/scout/workflow/step/dependencies.rb +1 -1
- data/lib/scout/workflow/step/info.rb +6 -2
- data/lib/scout/workflow/step/status.rb +1 -0
- data/lib/scout/workflow/step.rb +2 -1
- data/lib/scout/workflow/task/inputs.rb +2 -0
- data/lib/scout/workflow/task.rb +0 -1
- data/lib/scout/workflow/usage.rb +1 -1
- data/lib/scout/workflow.rb +3 -0
- data/scout-gear.gemspec +6 -3
- data/test/scout/workflow/test_definition.rb +31 -0
- data/test/scout/workflow/test_path.rb +9 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e72b6d2bef9af0067bf2601e059aa992ffdab98fba772dba1e297f958edb02d
|
4
|
+
data.tar.gz: 2c2cc3591c1645ccf34dbb250f1b2acda1b69040c0b051806c02c97eb07cc253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1be99dd4127f54c5cf16833197e527a3cfa41014c7db4306ec291e8f01b78f8340cad7ee6e342dee2ed25221f2b02a6f6b665f46e81365ad5a12eea087b300d
|
7
|
+
data.tar.gz: cc3a9b28e47520f6756cba18d6037d7e83b7cd4d0cded1597a7cafc2cc167234090c1014d2b38adcc0a6a69c8d3ba1a72255538bd924e14f55b95769f3eca977
|
data/.vimproject
CHANGED
@@ -7,10 +7,12 @@ scout-gear=/$PWD filter="*.rb *.yaml" {
|
|
7
7
|
scout=scout{
|
8
8
|
workflow.rb
|
9
9
|
workflow=workflow{
|
10
|
+
exceptions.rb
|
10
11
|
definition.rb
|
11
12
|
documentation.rb
|
12
13
|
usage.rb
|
13
14
|
util.rb
|
15
|
+
path.rb
|
14
16
|
step.rb
|
15
17
|
step=step{
|
16
18
|
config.rb
|
@@ -80,7 +82,6 @@ scout-gear=/$PWD filter="*.rb *.yaml" {
|
|
80
82
|
sort.rb
|
81
83
|
unzip.rb
|
82
84
|
}
|
83
|
-
entity.rb
|
84
85
|
parser.rb
|
85
86
|
dumper.rb
|
86
87
|
transformer.rb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.7.
|
1
|
+
10.7.1
|
data/lib/scout/entity.rb
CHANGED
@@ -34,6 +34,8 @@ module Entity
|
|
34
34
|
entity = (entity.frozen? and not entity.nil?) ? entity.dup : ((Array === entity and dup_array) ? entity.collect{|e| e.nil? ? e : e.dup} : entity)
|
35
35
|
|
36
36
|
entity = mod.setup(entity, params)
|
37
|
+
|
38
|
+
entity.extend AnnotatedArray if Array === entity && ! options[:annotated_array] == FalseClass
|
37
39
|
end
|
38
40
|
|
39
41
|
entity
|
data/lib/scout/tsv/parser.rb
CHANGED
@@ -352,6 +352,7 @@ module TSV
|
|
352
352
|
all_field_names ||= [@key_field] + @fields
|
353
353
|
fields = all_field_names if fields == :all
|
354
354
|
positions = NamedArray.identify_name(all_field_names, fields)
|
355
|
+
|
355
356
|
raise "Not all fields (#{Log.fingerprint fields}) identified in #{Log.fingerprint all_field_names}" if positions.include?(nil)
|
356
357
|
kwargs[:positions] = positions
|
357
358
|
field_names = all_field_names.values_at *positions
|
@@ -140,8 +140,17 @@ module Workflow
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
|
144
|
-
|
143
|
+
FORGET_TASK_ALIAS = begin
|
144
|
+
%w(SCOUT_FORGET_TASK_ALIAS SCOUT_FORGET_DEP_TASKS RBBT_FORGET_DEP_TASKS).select do |var|
|
145
|
+
ENV[var] == 'true'
|
146
|
+
end.any?
|
147
|
+
end
|
148
|
+
REMOVE_TASK_ALIAS = begin
|
149
|
+
remove = %w(SCOUT_REMOVE_TASK_ALIAS SCOUT_REMOVE_DEP_TASKS RBBT_REMOVE_DEP_TASKS).select do |var|
|
150
|
+
ENV.include?(var) && ENV[var] != 'false'
|
151
|
+
end.first
|
152
|
+
remove.nil? ? false : remove
|
153
|
+
end
|
145
154
|
def task_alias(name, workflow, oname, *rest, &block)
|
146
155
|
dep(workflow, oname, *rest, &block)
|
147
156
|
extension :dep_task unless @extension
|
@@ -158,9 +167,15 @@ module Workflow
|
|
158
167
|
raise dep.get_exception if dep.error?
|
159
168
|
raise Aborted, "Aborted dependency #{dep.path}" if dep.aborted?
|
160
169
|
set_info :type, dep.info[:type]
|
161
|
-
|
170
|
+
|
171
|
+
forget = config :forget_task_alias, "forget_task_alias"
|
172
|
+
forget = config :forget_dep_tasks, "forget_dep_tasks", :default => FORGET_TASK_ALIAS if forget.nil?
|
173
|
+
|
162
174
|
if forget
|
163
|
-
remove = config :
|
175
|
+
remove = config :remove_task_alias, "remove_task_alias"
|
176
|
+
remove = config :remove_dep_tasks, "remove_dep_tasks", :default => REMOVE_TASK_ALIAS if remove.nil?
|
177
|
+
|
178
|
+
Log.medium "Forget task_alias (remove: #{remove}): #{short_path}"
|
164
179
|
|
165
180
|
self.archive_deps
|
166
181
|
self.copy_linked_files_dir
|
@@ -179,9 +194,9 @@ module Workflow
|
|
179
194
|
when 'recursive'
|
180
195
|
(dep.dependencies + dep.rec_dependencies).uniq.each do |d|
|
181
196
|
next if d.overriden
|
182
|
-
d.clean unless
|
197
|
+
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'
|
183
198
|
end
|
184
|
-
dep.clean unless
|
199
|
+
dep.clean unless Scout::Config.get(:remove_dep, "task:#{dep.task_signature}", "task:#{dep.task_name}", "workflow:#{dep.workflow.name}", :default => true).to_s == 'false'
|
185
200
|
end
|
186
201
|
end
|
187
202
|
else
|
@@ -253,7 +253,7 @@ module Workflow
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
|
-
def self.produce_dependencies(jobs, tasks, produce_cpus = Etc.nprocessors)
|
256
|
+
def self.produce_dependencies(jobs, tasks, produce_cpus = Etc.nprocessors, produce_timer = 5)
|
257
257
|
jobs = [jobs] unless Array === jobs
|
258
258
|
produce_list = []
|
259
259
|
jobs.each do |job|
|
@@ -265,7 +265,7 @@ module Workflow
|
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
268
|
-
orchestrator = Orchestrator.new
|
268
|
+
orchestrator = Orchestrator.new produce_timer, cpus: produce_cpus.to_i
|
269
269
|
orchestrator.process({}, produce_list)
|
270
270
|
produce_list
|
271
271
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
class TaskNotFound < StandardError; end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Path
|
2
|
+
def self.step_file?(path)
|
3
|
+
return false unless path =~ /\.files(?:\/|$)/
|
4
|
+
parts = path.split("/")
|
5
|
+
job = parts.select{|p| p =~ /\.files$/}.first
|
6
|
+
|
7
|
+
if job
|
8
|
+
i = parts.index job
|
9
|
+
begin
|
10
|
+
workflow, task = parts.values_at i - 2, i - 1
|
11
|
+
_loaded = false
|
12
|
+
begin
|
13
|
+
Kernel.const_get(workflow)
|
14
|
+
rescue
|
15
|
+
if ! _loaded
|
16
|
+
Workflow.require_workflow workflow
|
17
|
+
_loaded = true
|
18
|
+
retry
|
19
|
+
end
|
20
|
+
raise $!
|
21
|
+
end
|
22
|
+
return parts[i-2..-1] * "/"
|
23
|
+
rescue
|
24
|
+
Log.exception $!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
alias original_digest_str digest_str
|
32
|
+
|
33
|
+
def digest_str
|
34
|
+
if step_file = Path.step_file?(self)
|
35
|
+
"Step file: #{step_file}"
|
36
|
+
else
|
37
|
+
original_digest_str
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -11,7 +11,7 @@ class Step
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def recursive_inputs
|
14
|
-
recursive_inputs = NamedArray ===
|
14
|
+
recursive_inputs = NamedArray === inputs ? inputs.to_hash : {}
|
15
15
|
return recursive_inputs if dependencies.nil?
|
16
16
|
dependencies.inject(recursive_inputs) do |acc,dep|
|
17
17
|
acc.merge(dep.recursive_inputs)
|
@@ -10,7 +10,11 @@ class Step
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.load_info(info_file)
|
13
|
-
info =
|
13
|
+
info = begin
|
14
|
+
Persist.load(info_file, SERIALIZER) || {}
|
15
|
+
rescue
|
16
|
+
{status: :noinfo}
|
17
|
+
end
|
14
18
|
IndiferentHash.setup(info)
|
15
19
|
end
|
16
20
|
|
@@ -152,7 +156,7 @@ class Step
|
|
152
156
|
end
|
153
157
|
|
154
158
|
def running?
|
155
|
-
! done? && (info[:pid] && Misc.pid_alive?(info[:pid]))
|
159
|
+
! (done? && status == :done) && (info[:pid] && Misc.pid_alive?(info[:pid]))
|
156
160
|
end
|
157
161
|
|
158
162
|
def overriden?
|
data/lib/scout/workflow/step.rb
CHANGED
@@ -91,6 +91,8 @@ module Task
|
|
91
91
|
if Path.is_filename?(value)
|
92
92
|
if type == :path
|
93
93
|
Open.write(input_file + ".as_path", value)
|
94
|
+
elsif Path.step_file?(value)
|
95
|
+
Open.write(input_file + ".as_path", value)
|
94
96
|
else
|
95
97
|
relative_file = save_file_input(value, directory)
|
96
98
|
Open.write(input_file + ".as_file", relative_file)
|
data/lib/scout/workflow/task.rb
CHANGED
data/lib/scout/workflow/usage.rb
CHANGED
@@ -138,7 +138,7 @@ module Workflow
|
|
138
138
|
|
139
139
|
dep_tree = {}
|
140
140
|
task = self.tasks[task_name]
|
141
|
-
raise
|
141
|
+
raise TaskNotFound, "Task #{task_name} in #{self.to_s}" if task.nil?
|
142
142
|
task.deps.each do |workflow, task, options|
|
143
143
|
next if seen.include? dep
|
144
144
|
seen << [workflow, task, options.merge(seen_options)]
|
data/lib/scout/workflow.rb
CHANGED
@@ -5,6 +5,8 @@ require_relative 'workflow/step'
|
|
5
5
|
require_relative 'workflow/documentation'
|
6
6
|
require_relative 'workflow/usage'
|
7
7
|
require_relative 'workflow/deployment'
|
8
|
+
require_relative 'workflow/exceptions'
|
9
|
+
require_relative 'workflow/path'
|
8
10
|
|
9
11
|
require 'scout/resource'
|
10
12
|
require 'scout/resource/scout'
|
@@ -153,6 +155,7 @@ module Workflow
|
|
153
155
|
|
154
156
|
def job(name, *args)
|
155
157
|
task = tasks[name]
|
158
|
+
raise TaskNotFound, "Task #{task_name} in #{self.to_s}" if task.nil?
|
156
159
|
step = task.job(*args)
|
157
160
|
step.extend step_module
|
158
161
|
step
|
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.
|
5
|
+
# stub: scout-gear 10.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-gear".freeze
|
9
|
-
s.version = "10.7.
|
9
|
+
s.version = "10.7.1".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 = "2024-
|
14
|
+
s.date = "2024-07-01"
|
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]
|
@@ -97,6 +97,8 @@ Gem::Specification.new do |s|
|
|
97
97
|
"lib/scout/workflow/deployment/orchestrator.rb",
|
98
98
|
"lib/scout/workflow/deployment/trace.rb",
|
99
99
|
"lib/scout/workflow/documentation.rb",
|
100
|
+
"lib/scout/workflow/exceptions.rb",
|
101
|
+
"lib/scout/workflow/path.rb",
|
100
102
|
"lib/scout/workflow/step.rb",
|
101
103
|
"lib/scout/workflow/step/archive.rb",
|
102
104
|
"lib/scout/workflow/step/children.rb",
|
@@ -212,6 +214,7 @@ Gem::Specification.new do |s|
|
|
212
214
|
"test/scout/workflow/task/test_inputs.rb",
|
213
215
|
"test/scout/workflow/test_definition.rb",
|
214
216
|
"test/scout/workflow/test_documentation.rb",
|
217
|
+
"test/scout/workflow/test_path.rb",
|
215
218
|
"test/scout/workflow/test_step.rb",
|
216
219
|
"test/scout/workflow/test_task.rb",
|
217
220
|
"test/scout/workflow/test_usage.rb",
|
@@ -66,5 +66,36 @@ class TestWorkflowDefinition < Test::Unit::TestCase
|
|
66
66
|
assert_include job.archived_info, dep_path
|
67
67
|
assert_equal :done, job.archived_info[dep_path][:status]
|
68
68
|
end
|
69
|
+
|
70
|
+
def test_task_alias_remove_dep_partial
|
71
|
+
wf = Workflow.annonymous_workflow do
|
72
|
+
self.name = "CallName"
|
73
|
+
|
74
|
+
task :salute => :string do |name|
|
75
|
+
"Hi"
|
76
|
+
end
|
77
|
+
|
78
|
+
dep :salute
|
79
|
+
input :name, :string, "Name to call", nil, :jobname => true
|
80
|
+
task :call_name => :string do |name|
|
81
|
+
"#{step(:salute).load} #{name}"
|
82
|
+
end
|
83
|
+
|
84
|
+
task_alias :call_miguel, self, :call_name, name: "Miguel"
|
85
|
+
end
|
86
|
+
|
87
|
+
old_cache = Scout::Config::CACHE.dup
|
88
|
+
Scout::Config.set({:forget_dep_tasks => true, :remove_dep_tasks => :recursive}, 'task:CallName#call_miguel')
|
89
|
+
Scout::Config.set({:remove_dep => false}, 'task:CallName#call_name')
|
90
|
+
job = wf.job(:call_miguel)
|
91
|
+
call_name = job.step(:call_name)
|
92
|
+
salute = job.step(:salute)
|
93
|
+
assert_equal "Hi Miguel", job.run
|
94
|
+
refute salute.done?
|
95
|
+
assert call_name.done?
|
96
|
+
Scout::Config::CACHE.replace old_cache
|
97
|
+
assert_include job.archived_info, call_name.path
|
98
|
+
assert_equal :done, job.archived_info[call_name.path][:status]
|
99
|
+
end
|
69
100
|
end
|
70
101
|
|
@@ -0,0 +1,9 @@
|
|
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
|
+
class TestClass < Test::Unit::TestCase
|
5
|
+
def test_path_digest
|
6
|
+
iii Misc.digest_str(Path.setup("test_file"))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout-gear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.7.
|
4
|
+
version: 10.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scout-essentials
|
@@ -209,6 +209,8 @@ files:
|
|
209
209
|
- lib/scout/workflow/deployment/orchestrator.rb
|
210
210
|
- lib/scout/workflow/deployment/trace.rb
|
211
211
|
- lib/scout/workflow/documentation.rb
|
212
|
+
- lib/scout/workflow/exceptions.rb
|
213
|
+
- lib/scout/workflow/path.rb
|
212
214
|
- lib/scout/workflow/step.rb
|
213
215
|
- lib/scout/workflow/step/archive.rb
|
214
216
|
- lib/scout/workflow/step/children.rb
|
@@ -324,6 +326,7 @@ files:
|
|
324
326
|
- test/scout/workflow/task/test_inputs.rb
|
325
327
|
- test/scout/workflow/test_definition.rb
|
326
328
|
- test/scout/workflow/test_documentation.rb
|
329
|
+
- test/scout/workflow/test_path.rb
|
327
330
|
- test/scout/workflow/test_step.rb
|
328
331
|
- test/scout/workflow/test_task.rb
|
329
332
|
- test/scout/workflow/test_usage.rb
|