scout-gear 8.0.0 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +26 -9
- data/Rakefile +6 -1
- data/VERSION +1 -1
- data/bin/scout +15 -4
- data/doc/lib/scout/path.md +35 -0
- data/doc/lib/scout/workflow/task.md +13 -0
- data/lib/scout/cmd.rb +23 -24
- data/lib/scout/concurrent_stream.rb +36 -19
- data/lib/scout/exceptions.rb +10 -0
- data/lib/scout/log/color.rb +11 -11
- data/lib/scout/log/progress/report.rb +7 -5
- data/lib/scout/log/progress/util.rb +3 -0
- data/lib/scout/log/trap.rb +3 -3
- data/lib/scout/log.rb +64 -36
- data/lib/scout/meta_extension.rb +34 -0
- data/lib/scout/misc/digest.rb +11 -2
- data/lib/scout/misc/format.rb +12 -7
- data/lib/scout/misc/monitor.rb +11 -0
- data/lib/scout/misc/system.rb +48 -0
- data/lib/scout/named_array.rb +8 -0
- data/lib/scout/offsite/ssh.rb +171 -0
- data/lib/scout/offsite/step.rb +83 -0
- data/lib/scout/offsite/sync.rb +55 -0
- data/lib/scout/offsite.rb +3 -0
- data/lib/scout/open/lock.rb +5 -24
- data/lib/scout/open/remote.rb +12 -1
- data/lib/scout/open/stream.rb +110 -122
- data/lib/scout/open/util.rb +9 -0
- data/lib/scout/open.rb +5 -4
- data/lib/scout/path/find.rb +15 -10
- data/lib/scout/path/util.rb +5 -0
- data/lib/scout/persist/serialize.rb +3 -3
- data/lib/scout/persist.rb +1 -1
- data/lib/scout/resource/path.rb +4 -0
- data/lib/scout/resource/util.rb +10 -4
- data/lib/scout/tsv/dumper.rb +2 -0
- data/lib/scout/tsv/index.rb +28 -86
- data/lib/scout/tsv/open.rb +35 -14
- data/lib/scout/tsv/parser.rb +9 -2
- data/lib/scout/tsv/persist/tokyocabinet.rb +2 -0
- data/lib/scout/tsv/stream.rb +204 -0
- data/lib/scout/tsv/transformer.rb +11 -0
- data/lib/scout/tsv.rb +9 -2
- data/lib/scout/work_queue/worker.rb +2 -2
- data/lib/scout/work_queue.rb +36 -12
- data/lib/scout/workflow/definition.rb +2 -1
- data/lib/scout/workflow/deployment/orchestrator.rb +245 -0
- data/lib/scout/workflow/deployment.rb +1 -0
- data/lib/scout/workflow/step/dependencies.rb +37 -11
- data/lib/scout/workflow/step/file.rb +5 -0
- data/lib/scout/workflow/step/info.rb +5 -3
- data/lib/scout/workflow/step/load.rb +1 -1
- data/lib/scout/workflow/step/provenance.rb +1 -0
- data/lib/scout/workflow/step/status.rb +6 -8
- data/lib/scout/workflow/step.rb +75 -30
- data/lib/scout/workflow/task/dependencies.rb +114 -0
- data/lib/scout/workflow/task/inputs.rb +27 -13
- data/lib/scout/workflow/task.rb +9 -108
- data/lib/scout/workflow/usage.rb +40 -12
- data/lib/scout/workflow.rb +4 -2
- data/lib/scout-gear.rb +2 -0
- data/lib/scout.rb +6 -0
- data/scout-gear.gemspec +32 -7
- data/scout_commands/doc +37 -0
- data/scout_commands/find +1 -0
- data/scout_commands/offsite +30 -0
- data/scout_commands/update +29 -0
- data/scout_commands/workflow/info +15 -3
- data/scout_commands/workflow/install +102 -0
- data/scout_commands/workflow/task +26 -5
- data/test/scout/offsite/test_ssh.rb +15 -0
- data/test/scout/offsite/test_step.rb +33 -0
- data/test/scout/offsite/test_sync.rb +36 -0
- data/test/scout/offsite/test_task.rb +0 -0
- data/test/scout/resource/test_path.rb +6 -0
- data/test/scout/test_named_array.rb +6 -0
- data/test/scout/test_persist.rb +3 -2
- data/test/scout/test_tsv.rb +17 -0
- data/test/scout/test_work_queue.rb +63 -41
- data/test/scout/tsv/persist/test_adapter.rb +1 -1
- data/test/scout/tsv/test_index.rb +14 -0
- data/test/scout/tsv/test_parser.rb +14 -0
- data/test/scout/tsv/test_stream.rb +200 -0
- data/test/scout/tsv/test_transformer.rb +12 -0
- data/test/scout/workflow/deployment/test_orchestrator.rb +272 -0
- data/test/scout/workflow/step/test_dependencies.rb +68 -0
- data/test/scout/workflow/step/test_info.rb +18 -0
- data/test/scout/workflow/step/test_status.rb +0 -1
- data/test/scout/workflow/task/test_dependencies.rb +355 -0
- data/test/scout/workflow/task/test_inputs.rb +53 -0
- data/test/scout/workflow/test_definition.rb +18 -0
- data/test/scout/workflow/test_documentation.rb +24 -0
- data/test/scout/workflow/test_step.rb +109 -0
- data/test/scout/workflow/test_task.rb +0 -287
- data/test/test_scout.rb +9 -0
- metadata +83 -5
- data/scout_commands/workflow/task_old +0 -706
data/scout-gear.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
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 8.
|
5
|
+
# stub: scout-gear 8.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-gear".freeze
|
9
|
-
s.version = "8.
|
9
|
+
s.version = "8.1.0"
|
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 = "2023-
|
15
|
-
s.description = "Temporary files, logs, etc.".freeze
|
14
|
+
s.date = "2023-06-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]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"bin/scout",
|
31
|
+
"doc/lib/scout/path.md",
|
32
|
+
"doc/lib/scout/workflow/task.md",
|
31
33
|
"lib/rbbt-scout.rb",
|
32
34
|
"lib/scout-gear.rb",
|
33
35
|
"lib/scout.rb",
|
@@ -56,6 +58,10 @@ Gem::Specification.new do |s|
|
|
56
58
|
"lib/scout/misc/monitor.rb",
|
57
59
|
"lib/scout/misc/system.rb",
|
58
60
|
"lib/scout/named_array.rb",
|
61
|
+
"lib/scout/offsite.rb",
|
62
|
+
"lib/scout/offsite/ssh.rb",
|
63
|
+
"lib/scout/offsite/step.rb",
|
64
|
+
"lib/scout/offsite/sync.rb",
|
59
65
|
"lib/scout/open.rb",
|
60
66
|
"lib/scout/open/lock.rb",
|
61
67
|
"lib/scout/open/lock/lockfile.rb",
|
@@ -98,6 +104,7 @@ Gem::Specification.new do |s|
|
|
98
104
|
"lib/scout/tsv/persist/fix_width_table.rb",
|
99
105
|
"lib/scout/tsv/persist/serialize.rb",
|
100
106
|
"lib/scout/tsv/persist/tokyocabinet.rb",
|
107
|
+
"lib/scout/tsv/stream.rb",
|
101
108
|
"lib/scout/tsv/transformer.rb",
|
102
109
|
"lib/scout/tsv/traverse.rb",
|
103
110
|
"lib/scout/tsv/util.rb",
|
@@ -111,6 +118,8 @@ Gem::Specification.new do |s|
|
|
111
118
|
"lib/scout/work_queue/worker.rb",
|
112
119
|
"lib/scout/workflow.rb",
|
113
120
|
"lib/scout/workflow/definition.rb",
|
121
|
+
"lib/scout/workflow/deployment.rb",
|
122
|
+
"lib/scout/workflow/deployment/orchestrator.rb",
|
114
123
|
"lib/scout/workflow/documentation.rb",
|
115
124
|
"lib/scout/workflow/step.rb",
|
116
125
|
"lib/scout/workflow/step/config.rb",
|
@@ -122,19 +131,23 @@ Gem::Specification.new do |s|
|
|
122
131
|
"lib/scout/workflow/step/provenance.rb",
|
123
132
|
"lib/scout/workflow/step/status.rb",
|
124
133
|
"lib/scout/workflow/task.rb",
|
134
|
+
"lib/scout/workflow/task/dependencies.rb",
|
125
135
|
"lib/scout/workflow/task/inputs.rb",
|
126
136
|
"lib/scout/workflow/usage.rb",
|
127
137
|
"lib/scout/workflow/util.rb",
|
128
138
|
"lib/workflow-scout.rb",
|
129
139
|
"scout-gear.gemspec",
|
130
140
|
"scout_commands/alias",
|
141
|
+
"scout_commands/doc",
|
131
142
|
"scout_commands/find",
|
132
143
|
"scout_commands/glob",
|
144
|
+
"scout_commands/offsite",
|
133
145
|
"scout_commands/rbbt",
|
146
|
+
"scout_commands/update",
|
134
147
|
"scout_commands/workflow/info",
|
148
|
+
"scout_commands/workflow/install",
|
135
149
|
"scout_commands/workflow/list",
|
136
150
|
"scout_commands/workflow/task",
|
137
|
-
"scout_commands/workflow/task_old",
|
138
151
|
"share/color/color_names",
|
139
152
|
"share/color/diverging_colors.hex",
|
140
153
|
"share/software/install_helpers",
|
@@ -146,6 +159,10 @@ Gem::Specification.new do |s|
|
|
146
159
|
"test/scout/misc/test_filesystem.rb",
|
147
160
|
"test/scout/misc/test_insist.rb",
|
148
161
|
"test/scout/misc/test_system.rb",
|
162
|
+
"test/scout/offsite/test_ssh.rb",
|
163
|
+
"test/scout/offsite/test_step.rb",
|
164
|
+
"test/scout/offsite/test_sync.rb",
|
165
|
+
"test/scout/offsite/test_task.rb",
|
149
166
|
"test/scout/open/test_lock.rb",
|
150
167
|
"test/scout/open/test_remote.rb",
|
151
168
|
"test/scout/open/test_stream.rb",
|
@@ -190,6 +207,7 @@ Gem::Specification.new do |s|
|
|
190
207
|
"test/scout/tsv/test_open.rb",
|
191
208
|
"test/scout/tsv/test_parser.rb",
|
192
209
|
"test/scout/tsv/test_persist.rb",
|
210
|
+
"test/scout/tsv/test_stream.rb",
|
193
211
|
"test/scout/tsv/test_transformer.rb",
|
194
212
|
"test/scout/tsv/test_traverse.rb",
|
195
213
|
"test/scout/tsv/test_util.rb",
|
@@ -200,11 +218,13 @@ Gem::Specification.new do |s|
|
|
200
218
|
"test/scout/tsv/util/test_unzip.rb",
|
201
219
|
"test/scout/work_queue/test_socket.rb",
|
202
220
|
"test/scout/work_queue/test_worker.rb",
|
221
|
+
"test/scout/workflow/deployment/test_orchestrator.rb",
|
203
222
|
"test/scout/workflow/step/test_dependencies.rb",
|
204
223
|
"test/scout/workflow/step/test_info.rb",
|
205
224
|
"test/scout/workflow/step/test_load.rb",
|
206
225
|
"test/scout/workflow/step/test_provenance.rb",
|
207
226
|
"test/scout/workflow/step/test_status.rb",
|
227
|
+
"test/scout/workflow/task/test_dependencies.rb",
|
208
228
|
"test/scout/workflow/task/test_inputs.rb",
|
209
229
|
"test/scout/workflow/test_definition.rb",
|
210
230
|
"test/scout/workflow/test_documentation.rb",
|
@@ -213,16 +233,21 @@ Gem::Specification.new do |s|
|
|
213
233
|
"test/scout/workflow/test_usage.rb",
|
214
234
|
"test/scout/workflow/test_util.rb",
|
215
235
|
"test/test_helper.rb",
|
216
|
-
"test/test_scout-gear.rb"
|
236
|
+
"test/test_scout-gear.rb",
|
237
|
+
"test/test_scout.rb"
|
217
238
|
]
|
218
239
|
s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
|
219
240
|
s.licenses = ["MIT".freeze]
|
220
|
-
s.rubygems_version = "3.4.
|
241
|
+
s.rubygems_version = "3.4.13".freeze
|
221
242
|
s.summary = "basic gear for scouts".freeze
|
222
243
|
|
223
244
|
s.specification_version = 4
|
224
245
|
|
225
246
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
247
|
+
s.add_runtime_dependency(%q<net-ssh>.freeze, [">= 0"])
|
248
|
+
s.add_runtime_dependency(%q<matrix>.freeze, [">= 0"])
|
249
|
+
s.add_runtime_dependency(%q<sys-proctable>.freeze, [">= 0"])
|
250
|
+
s.add_runtime_dependency(%q<RubyInline>.freeze, [">= 0"])
|
226
251
|
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
227
252
|
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
228
253
|
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
data/scout_commands/doc
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scout'
|
4
|
+
|
5
|
+
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
6
|
+
|
7
|
+
options = SOPT.setup <<EOF
|
8
|
+
|
9
|
+
Print documentation for a module
|
10
|
+
|
11
|
+
$ #{$0} [<options>] [module]
|
12
|
+
|
13
|
+
If you don't specify the module it prints those available
|
14
|
+
|
15
|
+
-h--help Print this help
|
16
|
+
EOF
|
17
|
+
if options[:help]
|
18
|
+
if defined? scout_usage
|
19
|
+
scout_usage
|
20
|
+
else
|
21
|
+
puts SOPT.doc
|
22
|
+
end
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
module_name = ARGV.first
|
28
|
+
if module_name.nil?
|
29
|
+
puts Rbbt.doc.lib.scout.glob("**/*.md").collect{|f| File.basename(f.unset_extension) } * "\n"
|
30
|
+
else
|
31
|
+
begin
|
32
|
+
puts Rbbt.doc.lib.scout[module_name].find_with_extension('md', :lib).read
|
33
|
+
rescue
|
34
|
+
puts Rbbt.doc.lib.scout.glob("**/*.md").select{|f| File.basename(f.unset_extension) == module_name }.first.read
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
data/scout_commands/find
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scout'
|
4
|
+
require 'scout/offsite'
|
5
|
+
|
6
|
+
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
7
|
+
|
8
|
+
options = SOPT.setup <<EOF
|
9
|
+
|
10
|
+
Description of the tool
|
11
|
+
|
12
|
+
$ #{$0} [<options>] <where> <command> ... -- [<protected options>]
|
13
|
+
|
14
|
+
Run a command offsite. Use -- to make sure options reach the offsite
|
15
|
+
|
16
|
+
-h--help Print this help
|
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
|
+
where = ARGV.shift
|
28
|
+
command = ARGV.shift
|
29
|
+
|
30
|
+
puts SSHLine.command(where, command, ARGV)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scout'
|
4
|
+
|
5
|
+
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
6
|
+
|
7
|
+
options = SOPT.setup <<EOF
|
8
|
+
|
9
|
+
Update scout installation
|
10
|
+
|
11
|
+
$ #{$0} [<options>] [gem]
|
12
|
+
|
13
|
+
If no gem is specified 'scout-gear' is selected.
|
14
|
+
|
15
|
+
-h--help Print this help
|
16
|
+
EOF
|
17
|
+
if options[:help]
|
18
|
+
if defined? scout_usage
|
19
|
+
scout_usage
|
20
|
+
else
|
21
|
+
puts SOPT.doc
|
22
|
+
end
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
|
26
|
+
gem_name = ARGV.first
|
27
|
+
Misc.update_git(gem_name)
|
28
|
+
|
29
|
+
|
@@ -23,7 +23,19 @@ end
|
|
23
23
|
|
24
24
|
path = ARGV.first
|
25
25
|
raise MissingParameterException.new :step_path if path.nil?
|
26
|
-
step = Step.load(path)
|
27
|
-
|
28
|
-
|
26
|
+
step = Step.load(path.dup)
|
27
|
+
|
28
|
+
step.info.each do |k,v|
|
29
|
+
case v
|
30
|
+
when nil
|
31
|
+
next
|
32
|
+
when Exception
|
33
|
+
puts Log.color(:title, "Exception")
|
34
|
+
Log.exception v
|
35
|
+
else
|
36
|
+
puts [Log.color(:title, k), Log.fingerprint(v)] * " = "
|
37
|
+
end
|
38
|
+
rescue
|
39
|
+
next
|
40
|
+
end
|
29
41
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scout'
|
4
|
+
|
5
|
+
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
6
|
+
|
7
|
+
options = SOPT.setup <<EOF
|
8
|
+
|
9
|
+
Description of the tool
|
10
|
+
|
11
|
+
$ #{$0} [<options>] <filename> [<other|->]*
|
12
|
+
|
13
|
+
Install a workflow, or a coma separated list of workflows, from its source. If
|
14
|
+
repo is not specified then 'http://github.com/Rbbt-Workflows/' will be used. If
|
15
|
+
the workflow is already installed it will be updated. If 'all' is specified
|
16
|
+
instead of a particular workflow, all installed workflows will be updated.
|
17
|
+
|
18
|
+
You can set the environment variable SCOUT_WORKFLOW_AUTOINSTALL=true to make
|
19
|
+
workflows install automatically as required.
|
20
|
+
|
21
|
+
-h--help Print this help
|
22
|
+
EOF
|
23
|
+
if options[:help]
|
24
|
+
if defined? scout_usage
|
25
|
+
scout_usage
|
26
|
+
else
|
27
|
+
puts SOPT.doc
|
28
|
+
end
|
29
|
+
exit 0
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
workflow = ARGV[0]
|
34
|
+
base_repo = ARGV[1]
|
35
|
+
|
36
|
+
raise "No workflow specified" if workflow.nil?
|
37
|
+
|
38
|
+
workflow_dir = Scout.etc.workflow_dir.exists? ? Path.setup(Scout.etc.workflow_dir.read.strip) : Scout.workflows.find(:user)
|
39
|
+
|
40
|
+
FileUtils.mkdir_p workflow_dir unless File.exist? workflow_dir
|
41
|
+
|
42
|
+
all_workflows = workflow_dir.find.glob("*/.git").collect{|d| File.basename(File.dirname(d))}
|
43
|
+
workflows = workflow == 'all' ? all_workflows : workflow.split(",")
|
44
|
+
|
45
|
+
Misc.in_dir(workflow_dir) do
|
46
|
+
workflows.each do |workflow|
|
47
|
+
case
|
48
|
+
when File.exist?(Misc.snake_case(workflow))
|
49
|
+
Log.info "Updating: " + workflow
|
50
|
+
Misc.in_dir(Misc.snake_case(workflow)) do
|
51
|
+
`git pull`
|
52
|
+
`git submodule init`
|
53
|
+
`git submodule update`
|
54
|
+
end
|
55
|
+
when File.exist?(workflow)
|
56
|
+
Misc.in_dir(workflow) do
|
57
|
+
Log.info "Updating: " + workflow
|
58
|
+
`git pull`
|
59
|
+
`git submodule init`
|
60
|
+
`git submodule update`
|
61
|
+
end
|
62
|
+
else
|
63
|
+
Log.info "Installing: " + workflow
|
64
|
+
|
65
|
+
if base_repo.nil?
|
66
|
+
repo_base_url = Rbbt.etc.workflow_repo.exists? ? Rbbt.etc.workflow_repo.read.strip : 'https://github.com/Rbbt-Workflows/'
|
67
|
+
else
|
68
|
+
repo_base_url = base_repo
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
if repo_base_url.include?(workflow) or repo_base_url.include?(Misc.snake_case(workflow))
|
73
|
+
repo = repo_base_url
|
74
|
+
else
|
75
|
+
begin
|
76
|
+
repo = File.join(repo_base_url, workflow + '.git')
|
77
|
+
CMD.cmd("wget '#{repo}' -O /dev/null").read
|
78
|
+
rescue
|
79
|
+
Log.debug "Workflow repo does not exist, trying snake_case: #{ repo }"
|
80
|
+
begin
|
81
|
+
repo = File.join(repo_base_url, Misc.snake_case(workflow) + '.git')
|
82
|
+
CMD.cmd("wget '#{repo}' -O /dev/null").read
|
83
|
+
rescue
|
84
|
+
raise "Workflow repo does not exist: #{ repo }"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Log.warn "Cloning #{ repo }"
|
90
|
+
Misc.insist do
|
91
|
+
`git clone "#{repo}" #{ Misc.snake_case(workflow) }`
|
92
|
+
raise unless $?.success?
|
93
|
+
end
|
94
|
+
Log.warn "Initializing and updating submodules for #{repo}. You might be prompted for passwords."
|
95
|
+
Misc.in_dir(Misc.snake_case(workflow)) do
|
96
|
+
`git submodule init`
|
97
|
+
`git submodule update`
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
@@ -5,7 +5,9 @@ require 'scout'
|
|
5
5
|
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
6
6
|
|
7
7
|
ENV["SCOUT_NO_STREAM"] = "true" if ARGV.include? "--nostream"
|
8
|
+
ARGV.delete '--nostream'
|
8
9
|
ENV["SCOUT_UPDATE"] = "true" if ARGV.include? "--update"
|
10
|
+
ARGV.delete '--update'
|
9
11
|
|
10
12
|
options = SOPT.setup <<EOF
|
11
13
|
|
@@ -17,11 +19,13 @@ $ #{$0} [<options>] <workflow> <task>
|
|
17
19
|
--nostream Disable job streaming
|
18
20
|
--update Update jobs with newer dependencies
|
19
21
|
-jn--job_name* Name to use as job identifier
|
22
|
+
-li--load_inputs* Directory with inputs files to load
|
20
23
|
-pf--print_filepath Print the file path
|
21
24
|
-prov--provenance Print the step provenance
|
22
25
|
-cl--clean Clean the last step
|
23
26
|
-rcl--recursive_clean Clean all steps
|
24
27
|
-ct--clean_task* Clean a particular task
|
28
|
+
-d--deploy* Deploy mode: serial, local, or SLURM (default 'serial')
|
25
29
|
EOF
|
26
30
|
|
27
31
|
workflow_name, task_name = ARGV
|
@@ -34,8 +38,9 @@ task = workflow.tasks[task_name.to_sym] if task_name
|
|
34
38
|
|
35
39
|
options[:help] = true if task.nil?
|
36
40
|
|
37
|
-
help, provenance, clean, recursive_clean, clean_task, jobname, print_filepath = IndiferentHash.process_options options,
|
38
|
-
:help, :provenance, :clean, :recursive_clean, :clean_task, :job_name, :print_filepath
|
41
|
+
help, provenance, clean, recursive_clean, clean_task, load_inputs, jobname, print_filepath, deploy = IndiferentHash.process_options options,
|
42
|
+
:help, :provenance, :clean, :recursive_clean, :clean_task, :load_inputs, :job_name, :print_filepath, :deploy,
|
43
|
+
:deploy => 'serial'
|
39
44
|
|
40
45
|
if help
|
41
46
|
if defined? scout_usage
|
@@ -48,8 +53,13 @@ if help
|
|
48
53
|
exit 0
|
49
54
|
end
|
50
55
|
|
51
|
-
|
52
|
-
|
56
|
+
if load_inputs
|
57
|
+
job_inputs = workflow.tasks[task_name].load_inputs(load_inputs)
|
58
|
+
else
|
59
|
+
job_inputs = task.get_SOPT
|
60
|
+
end
|
61
|
+
|
62
|
+
job = workflow.job(task_name, jobname, job_inputs)
|
53
63
|
|
54
64
|
job.recursive_clean if recursive_clean
|
55
65
|
job.clean if clean
|
@@ -75,7 +85,18 @@ end
|
|
75
85
|
if provenance
|
76
86
|
puts Step.prov_report(job)
|
77
87
|
else
|
78
|
-
|
88
|
+
case deploy
|
89
|
+
when "serial"
|
90
|
+
job.run(true)
|
91
|
+
when "local"
|
92
|
+
orchestrator = Workflow::Orchestrator.new 3, "cpus" => Misc.processors
|
93
|
+
orchestrator.process({}, job)
|
94
|
+
when "slurm"
|
95
|
+
SLURM.orchestrate(job)
|
96
|
+
else
|
97
|
+
OffsiteStep.setup(job, server: deploy, provided_inputs: job_inputs)
|
98
|
+
job.run
|
99
|
+
end unless job.done?
|
79
100
|
|
80
101
|
if print_filepath
|
81
102
|
job.join
|
@@ -0,0 +1,15 @@
|
|
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 TestSSH < Test::Unit::TestCase
|
5
|
+
def test_marshal
|
6
|
+
return unless SSHLine.reach?
|
7
|
+
|
8
|
+
assert TrueClass === SSHLine.rbbt(:default, 'true')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_localhost
|
12
|
+
assert SSHLine.scout('localhost', 'true')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,33 @@
|
|
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 TestOffsiteStep < Test::Unit::TestCase
|
5
|
+
def test_offsite_task
|
6
|
+
workflow_code =<<-EOF
|
7
|
+
module TestWF
|
8
|
+
extend Workflow
|
9
|
+
|
10
|
+
input :string, :string, "String", "string"
|
11
|
+
task :string => :string do |string| string end
|
12
|
+
end
|
13
|
+
|
14
|
+
TestWF.directory = Path.setup("#{tmpdir.offsite.TestWF}")
|
15
|
+
EOF
|
16
|
+
|
17
|
+
TmpFile.with_file workflow_code, :extension => 'rb' do |wffile|
|
18
|
+
wf = Workflow.require_workflow wffile
|
19
|
+
|
20
|
+
job = wf.job(:string)
|
21
|
+
|
22
|
+
sss 0
|
23
|
+
off = OffsiteStep.setup job, server: 'localhost', workflow_name: wffile
|
24
|
+
|
25
|
+
refute off.done?
|
26
|
+
assert_equal 'string', off.run
|
27
|
+
|
28
|
+
assert off.done?
|
29
|
+
assert_equal 'string', off.run
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,36 @@
|
|
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 TestSync < Test::Unit::TestCase
|
5
|
+
def test_sync
|
6
|
+
TmpFile.with_path do |tmpdir|
|
7
|
+
tmpdir = Scout.tmp.tmpdir_sync
|
8
|
+
tmpdir.dir1.foo.write("FOO")
|
9
|
+
tmpdir.dir1.bar.write("BAR")
|
10
|
+
|
11
|
+
TmpFile.with_path do |tmpdir2|
|
12
|
+
Misc.in_dir tmpdir2 do
|
13
|
+
SSHLine.sync([tmpdir.dir1], map: :current)
|
14
|
+
|
15
|
+
assert tmpdir2.glob("**/*").select{|f| f.include?('foo') }.any?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_sync_dir_map
|
22
|
+
TmpFile.with_path do |tmpdir|
|
23
|
+
tmpdir = Scout.tmp.tmpdir_sync
|
24
|
+
tmpdir.dir1.foo.write("FOO")
|
25
|
+
tmpdir.dir1.bar.write("BAR")
|
26
|
+
|
27
|
+
TmpFile.with_path do |tmpdir2|
|
28
|
+
SSHLine.sync([tmpdir.dir1], map: tmpdir2)
|
29
|
+
Misc.in_dir tmpdir2 do
|
30
|
+
assert tmpdir2.glob("**/*").select{|f| f.include?('foo') }.any?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
File without changes
|
data/test/scout/test_persist.rb
CHANGED
@@ -114,6 +114,7 @@ class TestPersist < Test::Unit::TestCase
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
117
|
+
|
117
118
|
if IO === io
|
118
119
|
Open.consume_stream(io, false)
|
119
120
|
else
|
@@ -137,8 +138,8 @@ class TestPersist < Test::Unit::TestCase
|
|
137
138
|
Open.write(output2, io)
|
138
139
|
end
|
139
140
|
end
|
140
|
-
Process.wait
|
141
|
-
Process.wait
|
141
|
+
Process.wait pid1
|
142
|
+
Process.wait pid2
|
142
143
|
|
143
144
|
assert File.exist?(output1) || File.exist?(output2)
|
144
145
|
[pid1, pid2].zip([output2, output1]).each do |pid, found|
|
data/test/scout/test_tsv.rb
CHANGED
@@ -290,4 +290,21 @@ row2 b bbb bbbb bb
|
|
290
290
|
tsv = TSV.str_setup("ID~ValueA,ValueB#:type=:flat", {})
|
291
291
|
assert_equal "ID", tsv.key_field
|
292
292
|
end
|
293
|
+
|
294
|
+
def test_cast_in_header
|
295
|
+
content =<<-EOF
|
296
|
+
#: :sep=/\\s+/#:type=:single
|
297
|
+
#Id Value
|
298
|
+
a 1
|
299
|
+
b 2
|
300
|
+
c 3
|
301
|
+
EOF
|
302
|
+
|
303
|
+
TmpFile.with_file(content) do |filename|
|
304
|
+
tsv = TSV.open(filename, :key_field => "Value", :grep => "#\\|2")
|
305
|
+
refute tsv.to_s.include?(":cast=:to_f")
|
306
|
+
tsv.cast = :to_f
|
307
|
+
assert_include tsv.to_s, ":cast=:to_f"
|
308
|
+
end
|
309
|
+
end
|
293
310
|
end
|