scout-gear 10.11.4 → 10.11.7

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.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +17 -2
  3. data/VERSION +1 -1
  4. data/bin/scout +10 -10
  5. data/lib/scout/association/fields.rb +15 -15
  6. data/lib/scout/association/index.rb +6 -6
  7. data/lib/scout/association/item.rb +18 -8
  8. data/lib/scout/association.rb +4 -4
  9. data/lib/scout/entity/identifiers.rb +5 -5
  10. data/lib/scout/entity/property.rb +2 -2
  11. data/lib/scout/entity.rb +1 -1
  12. data/lib/scout/knowledge_base/description.rb +10 -10
  13. data/lib/scout/knowledge_base/entity.rb +6 -6
  14. data/lib/scout/knowledge_base/list.rb +1 -1
  15. data/lib/scout/knowledge_base/query.rb +4 -4
  16. data/lib/scout/knowledge_base/registry.rb +6 -6
  17. data/lib/scout/knowledge_base/traverse.rb +7 -40
  18. data/lib/scout/persist/engine/fix_width_table.rb +6 -6
  19. data/lib/scout/persist/engine/packed_index.rb +2 -2
  20. data/lib/scout/persist/engine/sharder.rb +4 -4
  21. data/lib/scout/persist/engine/tkrzw.rb +1 -1
  22. data/lib/scout/persist/engine/tokyocabinet.rb +2 -2
  23. data/lib/scout/persist/tsv/adapter/fix_width_table.rb +1 -1
  24. data/lib/scout/persist/tsv/adapter/packed_index.rb +1 -1
  25. data/lib/scout/persist/tsv/adapter/tkrzw.rb +1 -1
  26. data/lib/scout/persist/tsv/adapter/tokyocabinet.rb +3 -3
  27. data/lib/scout/persist/tsv/serialize.rb +3 -3
  28. data/lib/scout/persist/tsv.rb +1 -1
  29. data/lib/scout/semaphore.rb +100 -17
  30. data/lib/scout/tsv/annotation/repo.rb +4 -4
  31. data/lib/scout/tsv/annotation.rb +2 -2
  32. data/lib/scout/tsv/attach.rb +7 -7
  33. data/lib/scout/tsv/change_id/translate.rb +1 -1
  34. data/lib/scout/tsv/csv.rb +3 -3
  35. data/lib/scout/tsv/dumper.rb +8 -8
  36. data/lib/scout/tsv/index.rb +1 -1
  37. data/lib/scout/tsv/open.rb +3 -3
  38. data/lib/scout/tsv/stream.rb +2 -2
  39. data/lib/scout/tsv/traverse.rb +4 -4
  40. data/lib/scout/tsv/util/filter.rb +9 -9
  41. data/lib/scout/tsv/util/process.rb +2 -2
  42. data/lib/scout/tsv/util/reorder.rb +2 -2
  43. data/lib/scout/tsv/util/select.rb +3 -3
  44. data/lib/scout/tsv/util/unzip.rb +2 -2
  45. data/lib/scout/tsv/util.rb +1 -1
  46. data/lib/scout/tsv.rb +2 -2
  47. data/lib/scout/work_queue/socket.rb +3 -2
  48. data/lib/scout/work_queue/worker.rb +4 -4
  49. data/lib/scout/work_queue.rb +7 -7
  50. data/lib/scout/workflow/definition.rb +18 -16
  51. data/lib/scout/workflow/deployment/local.rb +81 -62
  52. data/lib/scout/workflow/deployment/orchestrator/batches.rb +66 -5
  53. data/lib/scout/workflow/deployment/orchestrator/chains.rb +47 -30
  54. data/lib/scout/workflow/deployment/orchestrator/rules.rb +3 -3
  55. data/lib/scout/workflow/deployment/orchestrator/workload.rb +11 -22
  56. data/lib/scout/workflow/deployment/scheduler/job.rb +34 -36
  57. data/lib/scout/workflow/deployment/scheduler/lfs.rb +1 -1
  58. data/lib/scout/workflow/deployment/scheduler/pbs.rb +4 -4
  59. data/lib/scout/workflow/deployment/scheduler/slurm.rb +2 -2
  60. data/lib/scout/workflow/deployment/scheduler.rb +23 -12
  61. data/lib/scout/workflow/deployment/trace.rb +2 -2
  62. data/lib/scout/workflow/documentation.rb +4 -4
  63. data/lib/scout/workflow/export.rb +1 -1
  64. data/lib/scout/workflow/path.rb +2 -2
  65. data/lib/scout/workflow/step/children.rb +1 -1
  66. data/lib/scout/workflow/step/dependencies.rb +36 -3
  67. data/lib/scout/workflow/step/info.rb +5 -19
  68. data/lib/scout/workflow/step/inputs.rb +1 -1
  69. data/lib/scout/workflow/step/progress.rb +2 -2
  70. data/lib/scout/workflow/step/provenance.rb +4 -4
  71. data/lib/scout/workflow/step/status.rb +23 -9
  72. data/lib/scout/workflow/step.rb +21 -19
  73. data/lib/scout/workflow/task/dependencies.rb +10 -3
  74. data/lib/scout/workflow/task/info.rb +3 -3
  75. data/lib/scout/workflow/task/inputs.rb +8 -8
  76. data/lib/scout/workflow/task.rb +37 -22
  77. data/lib/scout/workflow/usage.rb +13 -13
  78. data/lib/scout/workflow/util.rb +1 -1
  79. data/lib/scout/workflow.rb +6 -6
  80. data/scout-gear.gemspec +4 -3
  81. data/scout_commands/alias +1 -1
  82. data/scout_commands/batch/clean +12 -12
  83. data/scout_commands/batch/list +26 -25
  84. data/scout_commands/batch/tail +9 -5
  85. data/scout_commands/cat +1 -1
  86. data/scout_commands/doc +2 -2
  87. data/scout_commands/entity +4 -4
  88. data/scout_commands/find +1 -1
  89. data/scout_commands/kb/config +1 -1
  90. data/scout_commands/kb/entities +1 -1
  91. data/scout_commands/kb/list +1 -1
  92. data/scout_commands/kb/query +2 -2
  93. data/scout_commands/kb/register +1 -1
  94. data/scout_commands/kb/show +1 -1
  95. data/scout_commands/kb/traverse +1 -1
  96. data/scout_commands/log +6 -6
  97. data/scout_commands/resource/produce +2 -2
  98. data/scout_commands/resource/sync +1 -1
  99. data/scout_commands/system/clean +7 -7
  100. data/scout_commands/system/status +4 -4
  101. data/scout_commands/template +1 -1
  102. data/scout_commands/update +1 -1
  103. data/scout_commands/workflow/cmd +2 -1
  104. data/scout_commands/workflow/example +123 -0
  105. data/scout_commands/workflow/info +10 -1
  106. data/scout_commands/workflow/install +1 -1
  107. data/scout_commands/workflow/list +2 -2
  108. data/scout_commands/workflow/process +2 -2
  109. data/scout_commands/workflow/prov +3 -3
  110. data/scout_commands/workflow/task +36 -11
  111. data/scout_commands/workflow/trace +1 -1
  112. data/scout_commands/workflow/write_info +2 -2
  113. data/share/templates/command +1 -1
  114. data/test/scout/association/test_item.rb +5 -0
  115. data/test/scout/entity/test_property.rb +3 -3
  116. data/test/scout/knowledge_base/test_description.rb +1 -1
  117. data/test/scout/knowledge_base/test_traverse.rb +2 -2
  118. data/test/scout/persist/engine/test_packed_index.rb +6 -6
  119. data/test/scout/persist/test_tsv.rb +4 -4
  120. data/test/scout/persist/tsv/adapter/test_packed_index.rb +4 -4
  121. data/test/scout/persist/tsv/adapter/test_sharder.rb +23 -23
  122. data/test/scout/persist/tsv/adapter/test_tokyocabinet.rb +1 -1
  123. data/test/scout/persist/tsv/test_serialize.rb +1 -1
  124. data/test/scout/test_association.rb +1 -1
  125. data/test/scout/test_tsv.rb +2 -2
  126. data/test/scout/test_workflow.rb +2 -2
  127. data/test/scout/tsv/test_annotation.rb +4 -4
  128. data/test/scout/tsv/test_index.rb +1 -1
  129. data/test/scout/tsv/test_open.rb +2 -2
  130. data/test/scout/tsv/test_parser.rb +2 -2
  131. data/test/scout/tsv/test_stream.rb +1 -1
  132. data/test/scout/tsv/test_transformer.rb +1 -1
  133. data/test/scout/tsv/util/test_filter.rb +1 -1
  134. data/test/scout/tsv/util/test_melt.rb +1 -1
  135. data/test/scout/tsv/util/test_reorder.rb +1 -1
  136. data/test/scout/work_queue/test_socket.rb +3 -3
  137. data/test/scout/work_queue/test_worker.rb +2 -2
  138. data/test/scout/workflow/deployment/orchestrator/test_batches.rb +13 -3
  139. data/test/scout/workflow/deployment/orchestrator/test_chains.rb +15 -13
  140. data/test/scout/workflow/deployment/orchestrator/test_workload.rb +1 -1
  141. data/test/scout/workflow/deployment/test_local.rb +2 -2
  142. data/test/scout/workflow/deployment/test_scheduler.rb +1 -2
  143. data/test/scout/workflow/step/test_children.rb +1 -1
  144. data/test/scout/workflow/step/test_dependencies.rb +36 -1
  145. data/test/scout/workflow/step/test_info.rb +3 -35
  146. data/test/scout/workflow/step/test_load.rb +1 -1
  147. data/test/scout/workflow/step/test_provenance.rb +1 -1
  148. data/test/scout/workflow/step/test_status.rb +33 -1
  149. data/test/scout/workflow/task/test_dependencies.rb +9 -7
  150. data/test/scout/workflow/task/test_inputs.rb +1 -1
  151. data/test/scout/workflow/test_definition.rb +1 -1
  152. data/test/scout/workflow/test_documentation.rb +1 -1
  153. data/test/scout/workflow/test_entity.rb +2 -2
  154. data/test/scout/workflow/test_step.rb +13 -13
  155. data/test/scout/workflow/test_usage.rb +1 -1
  156. data/test/test_helper.rb +1 -1
  157. metadata +3 -2
@@ -21,7 +21,7 @@ $ #{$0} [<options>] <name> <entity>
21
21
  EOF
22
22
  if options[:help]
23
23
  if defined? scout_usage
24
- scout_usage
24
+ scout_usage
25
25
  else
26
26
  puts SOPT.doc
27
27
  end
@@ -70,7 +70,7 @@ if matches.any?
70
70
  else
71
71
  matches.each do |match|
72
72
  puts Log.color :magenta, (reverse ? match.invert : match)
73
- puts index[match].prety_print
73
+ puts index[match].prety_print
74
74
  end
75
75
  end
76
76
  else
@@ -23,7 +23,7 @@ $ #{$0} [<options>] <name> <filename>
23
23
  EOF
24
24
  if options.delete :help
25
25
  if defined? scout_usage
26
- scout_usage
26
+ scout_usage
27
27
  else
28
28
  puts SOPT.doc
29
29
  end
@@ -16,7 +16,7 @@ $ #{$0} [<options>] <name>
16
16
  EOF
17
17
  if options[:help]
18
18
  if defined? scout_usage
19
- scout_usage
19
+ scout_usage
20
20
  else
21
21
  puts SOPT.doc
22
22
  end
@@ -20,7 +20,7 @@ $ #{$0} [<options>] <traversal>
20
20
  EOF
21
21
  if options[:help]
22
22
  if defined? scout_usage
23
- scout_usage
23
+ scout_usage
24
24
  else
25
25
  puts SOPT.doc
26
26
  end
data/scout_commands/log CHANGED
@@ -23,7 +23,7 @@ NONE
23
23
  EOF
24
24
  if options[:help]
25
25
  if defined? scout_usage
26
- scout_usage
26
+ scout_usage
27
27
  else
28
28
  puts SOPT.doc
29
29
  end
@@ -31,11 +31,11 @@ if options[:help]
31
31
  end
32
32
 
33
33
  if ARGV.empty?
34
- if Scout.etc.log_severity.exists?
35
- puts Scout.etc.log_severity.read
36
- else
37
- puts Scout.etc.log_severity.find + ' does not exist'
38
- end
34
+ if Scout.etc.log_severity.exists?
35
+ puts Scout.etc.log_severity.read
36
+ else
37
+ puts Scout.etc.log_severity.find + ' does not exist'
38
+ end
39
39
  else
40
40
  level = ARGV[0]
41
41
  level = %w(DEBUG LOW MEDIUM HIGH INFO WARN ERROR NONE)[level.to_i] if level =~ /^\d+$/
@@ -8,7 +8,7 @@ options = SOPT.setup <<EOF
8
8
 
9
9
  Produce a resource
10
10
 
11
- $ #{$0} [<options>] <Resource> <file>
11
+ $ #{$0} [<options>] <Resource> <file>
12
12
 
13
13
  -h--help Print this help
14
14
  -W--workflows* Workflows to use; 'all' for all in Scout.etc.workflows:
@@ -17,7 +17,7 @@ $ #{$0} [<options>] <Resource> <file>
17
17
  EOF
18
18
  if options[:help]
19
19
  if defined? scout_usage
20
- scout_usage
20
+ scout_usage
21
21
  else
22
22
  puts SOPT.doc
23
23
  end
@@ -19,7 +19,7 @@ Path map defaults to :user
19
19
  EOF
20
20
  if options[:help]
21
21
  if defined? scout_usage
22
- scout_usage
22
+ scout_usage
23
23
  else
24
24
  puts SOPT.doc
25
25
  end
@@ -47,7 +47,7 @@ if locks.any?
47
47
  locks.each do |file,info|
48
48
  if force or (info[:pid] && ! Misc.pid_alive?(info[:pid]))
49
49
  puts " Removing #{ file }"
50
- File.unlink file
50
+ File.unlink file
51
51
  end
52
52
  end
53
53
  end
@@ -59,7 +59,7 @@ if persists.any?
59
59
  persists.each do |file,info|
60
60
  if force or (info[:pid] and Misc.pid_alive? info[:pid])
61
61
  puts " Removing #{ file }"
62
- File.unlink file
62
+ File.unlink file
63
63
  end
64
64
  end
65
65
  end
@@ -71,7 +71,7 @@ if sensiblewrites.any?
71
71
  sensiblewrites.each do |file,info|
72
72
  if force or (info[:pid] and Misc.pid_alive? info[:pid])
73
73
  puts " Removing #{ file }"
74
- File.unlink file
74
+ File.unlink file
75
75
  end
76
76
  end
77
77
  end
@@ -134,13 +134,13 @@ TSV.traverse jobs do |file,i|
134
134
  end
135
135
  end
136
136
 
137
- if (force && status !~ /done/) or
137
+ if (force && status !~ /done/) or
138
138
  status =~ /\b(old|dirty|nopid|error|missing|aborted|dead|sync|waiting)$/ or
139
139
  (status == "noinfo" and not done) or
140
- status == ""
140
+ status == ""
141
141
 
142
- puts " Removing #{ file } - #{status}"
143
- Step.clean(file)
142
+ puts " Removing #{ file } - #{status}"
143
+ Step.clean(file)
144
144
  end
145
145
  end
146
146
 
@@ -177,7 +177,7 @@ workflows.sort.each do |workflow,tasks|
177
177
  if options[:quick] and i[:done]
178
178
  status = 'done'
179
179
  str << " #{ Step.prov_status_msg status }"
180
- if inputs and inputs.any?
180
+ if inputs and inputs.any?
181
181
  str << input_msg(file, inputs)
182
182
  end
183
183
 
@@ -210,15 +210,15 @@ workflows.sort.each do |workflow,tasks|
210
210
  status = status.to_s
211
211
  if status != "done" and pid and not Misc.pid_alive?(pid)
212
212
  if File.exist? file
213
- status << Log.color(:red, " (out of sync)")
213
+ status << Log.color(:red, " (out of sync)")
214
214
  else
215
- status << Log.color(:red, " (dead)")
215
+ status << Log.color(:red, " (dead)")
216
216
  end
217
217
  end
218
218
  str << " #{ Step.prov_status_msg status }"
219
219
  str << " (dirty)" if status == 'done' && Step.new(file).dirty?
220
220
 
221
- if inputs and inputs.any?
221
+ if inputs and inputs.any?
222
222
  str << input_msg(file, inputs)
223
223
  end
224
224
 
@@ -19,7 +19,7 @@ Print a template making the substitutions that follow
19
19
  EOF
20
20
  if options[:help]
21
21
  if defined? scout_usage
22
- scout_usage
22
+ scout_usage
23
23
  else
24
24
  puts SOPT.doc
25
25
  end
@@ -16,7 +16,7 @@ If no gem is specified 'scout-gear' is selected.
16
16
  EOF
17
17
  if options[:help]
18
18
  if defined? scout_usage
19
- scout_usage
19
+ scout_usage
20
20
  else
21
21
  puts SOPT.doc
22
22
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'scout'
4
4
 
5
+ exec = $0
5
6
  $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
7
 
7
8
  options = SOPT.setup <<EOF
@@ -76,7 +77,7 @@ begin
76
77
  CMD.cmd_log('ruby', wf.libdir["test_workflow.rb"].find)
77
78
  else
78
79
  Log.info "No bootstrap for #{ workflow }, running examples instead"
79
- CMD.cmd_log("scout workflow example #{ workflow }")
80
+ CMD.cmd_log("#{exec} workflow example #{ workflow }")
80
81
  exit 0
81
82
  end
82
83
  end
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'scout'
5
+
6
+ cmd = $previous_commands ?
7
+ "scout #{$previous_commands.any? ? "#{$previous_commands * ' '} " : ''}#{File.basename(__FILE__)}" :
8
+ $PROGRAM_NAME
9
+
10
+ options = SOPT.setup <<~EOF
11
+ Run examples
12
+
13
+ $ #{cmd} <workflow> [<task>] [<name>] -- [<task_options>]
14
+
15
+ Run workflow examples. You can define tasks and example names. You can also override task options
16
+
17
+ -h--help Print this help
18
+ EOF
19
+ if options[:help]
20
+ if defined? scout_usage
21
+ scout_usage
22
+ else
23
+ puts SOPT.doc
24
+ end
25
+ exit 0
26
+ end
27
+
28
+ help = IndiferentHash.process_options options, :help
29
+
30
+ filename, _ = ARGV
31
+
32
+
33
+ raise MissingParameterException, :filename if filename.nil?
34
+
35
+ def run_task(workflow, task, name)
36
+ Log.info "Running example #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
37
+
38
+ example_dir = workflow.libdir.examples[task][name].find
39
+ Log.debug "Using #{example_dir}"
40
+
41
+ ARGV.replace([workflow.to_s, task, '--load_inputs', example_dir, '--jobname', name,'-pf'] + $saved_args)
42
+
43
+ path = nil
44
+ success = nil
45
+ TmpFile.with_file do |res|
46
+ Open.open(res, :mode => 'w') do |file|
47
+ @pid = Process.fork{
48
+ STDOUT.reopen res
49
+ load Rbbt.share.rbbt_commands.workflow.task.find
50
+ }
51
+ Signal.trap(:INT) do
52
+ begin
53
+ Process.kill "INT", @pid
54
+ ensure
55
+ Kernel.exit! -1
56
+ end
57
+ end
58
+ file.close
59
+ begin
60
+ p,s = Process.waitpid2 @pid
61
+ success = s.success?
62
+ rescue Errno::ECHILD
63
+ success = true
64
+ end
65
+ end
66
+ sleep 0.5
67
+ path = Open.read(res).strip.split("\n").last if File.exist? res
68
+ end
69
+ path = "NO RESULT" if path.nil? or path.empty?
70
+
71
+ if success
72
+ Log.info "#{Log.color :green, "SUCCESS"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
73
+ return [path, true]
74
+ else
75
+ Log.info "#{Log.color :red, "ERROR"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
76
+ return [path, false]
77
+ end
78
+ end
79
+
80
+ workflow = ARGV.shift
81
+ raise ParameterException if workflow.nil?
82
+
83
+ task = ARGV.shift
84
+ task = nil if task == '--'
85
+
86
+ name = ARGV.shift if task
87
+ name = nil if name == '--'
88
+
89
+ orig_name = name
90
+
91
+ $saved_args = ARGV.dup
92
+
93
+ $saved_args.shift if $saved_args.include? '--'
94
+
95
+ workflow = Workflow.require_workflow workflow
96
+
97
+ tasks = task ? [task] : workflow.libdir.examples.glob('*').collect{|file| File.basename file }
98
+
99
+ task_result = {}
100
+ TSV.traverse tasks do |task|
101
+ names = name ? [name] : workflow.libdir.examples[task].glob('*').collect{|file| File.basename file }
102
+ TSV.traverse names do |name|
103
+ success = run_task workflow, task, name
104
+ task_result[[task, name]] = success
105
+ end
106
+ end
107
+
108
+
109
+ task_result.each do |code,res|
110
+ task, name = code
111
+ path, success = res
112
+ if success
113
+ if orig_name
114
+ puts Open.read(path)
115
+ else
116
+ STDERR.puts "#{Log.color :green, "SUCCESS"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
117
+ puts path
118
+ end
119
+ else
120
+ STDERR.puts "#{Log.color :red, "ERROR"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
121
+ puts path
122
+ end
123
+ end
@@ -16,7 +16,7 @@ $ #{$0} [<options>] <step_path>
16
16
  EOF
17
17
  if options[:help]
18
18
  if defined? scout_usage
19
- scout_usage
19
+ scout_usage
20
20
  else
21
21
  puts SOPT.doc
22
22
  end
@@ -38,6 +38,7 @@ elsif options[:recursive_inputs]
38
38
  end
39
39
  else
40
40
  step.info.each do |k,v|
41
+ next if k.to_s == 'exception'
41
42
  case v
42
43
  when nil
43
44
  next
@@ -50,5 +51,13 @@ else
50
51
  rescue
51
52
  next
52
53
  end
54
+ if step.error?
55
+ if exception = step.exception
56
+ begin
57
+ Log.exception exception
58
+ rescue
59
+ end
60
+ end
61
+ end
53
62
  end
54
63
 
@@ -22,7 +22,7 @@ workflows install automatically as required.
22
22
  EOF
23
23
  if options[:help]
24
24
  if defined? scout_usage
25
- scout_usage
25
+ scout_usage
26
26
  else
27
27
  puts SOPT.doc
28
28
  end
@@ -8,13 +8,13 @@ options = SOPT.setup <<EOF
8
8
 
9
9
  List all workflows
10
10
 
11
- $ #{$0} [<options>]
11
+ $ #{$0} [<options>]
12
12
 
13
13
  -h--help Print this help
14
14
  EOF
15
15
  if options[:help]
16
16
  if defined? scout_usage
17
- scout_usage
17
+ scout_usage
18
18
  else
19
19
  puts SOPT.doc
20
20
  end
@@ -22,7 +22,7 @@ $ #{$0} [<options>] ([<workflow>] [<task>] [<name>] | <filename>)
22
22
  EOF
23
23
  if options[:help]
24
24
  if defined? scout_usage
25
- scout_usage
25
+ scout_usage
26
26
  else
27
27
  puts SOPT.doc
28
28
  end
@@ -69,7 +69,7 @@ begin
69
69
  end
70
70
 
71
71
  jobs = files.collect{|file| Workflow.queue_job(file) }
72
-
72
+
73
73
 
74
74
  begin
75
75
  Workflow.produce(jobs, **options)
@@ -19,7 +19,7 @@ $ #{$0} [<options>] <filename> [<other|->]*
19
19
  EOF
20
20
  if options[:help]
21
21
  if defined? scout_usage
22
- scout_usage
22
+ scout_usage
23
23
  else
24
24
  puts SOPT.doc
25
25
  end
@@ -77,10 +77,10 @@ def adjacency(step)
77
77
  info[:dependencies].each do |task,name,path|
78
78
  dep = get_step path
79
79
  _id, _edges, _node_info = adjacency(dep)
80
- edges << [_id, id]
80
+ edges << [_id, id]
81
81
  edges.concat _edges
82
82
  node_info.merge!(_node_info)
83
- end
83
+ end
84
84
  end
85
85
 
86
86
  [id, edges, node_info]
@@ -89,7 +89,7 @@ job = workflow.job(task_name, jobname, job_inputs)
89
89
  job.recursive_clean if recursive_clean
90
90
  job.clean if clean
91
91
 
92
- if clean_task
92
+ if clean_task
93
93
  ENV["SCOUT_UPDATE"] = 'true'
94
94
  clean_task.split(",").each do |clean_task|
95
95
  if clean_task.include? "#"
@@ -99,12 +99,13 @@ if clean_task
99
99
  job.rec_dependencies.each do |dep|
100
100
  next unless dep.task_name.to_s == clean_task.to_s
101
101
  next unless clean_workflow.nil? || clean_workflow == dep.workflow.to_s
102
- dep.clean
102
+ dep.clean
103
103
  dep.set_info :status, :cleaned
104
104
  end
105
105
 
106
106
  job.clean if (job.task_name.to_s == clean_task.to_s) || ! job.updated?
107
107
  end
108
+
108
109
  end
109
110
 
110
111
  if provenance
@@ -123,6 +124,8 @@ elsif save_inputs
123
124
  else
124
125
  require 'scout/workflow/deployment'
125
126
 
127
+ Workflow::Orchestrator.prepare_for_execution(job)
128
+
126
129
  if deploy_rules.nil?
127
130
  rules = Workflow::Orchestrator.load_rules_for_job(job)
128
131
  else
@@ -138,32 +141,54 @@ else
138
141
  puts save_inputs
139
142
  exit
140
143
  end
141
- when 'dry', 'dryrun', 'debug'
144
+ when 'very_dry', 'vdry'
142
145
  batches = Workflow::Orchestrator.job_batches rules, job
146
+ batches = Workflow::Orchestrator.clean_batches batches
147
+ batches = Workflow::Orchestrator.sort_batches batches
148
+ batches.each do |batch|
149
+ top = batch[:top_level]
150
+ puts top.short_path
151
+ end
152
+ puts
153
+ puts "#{batches.length} batches"
154
+ exit 0
155
+ when 'dry', 'dryrun', 'dry_run', 'debug'
156
+ batches = Workflow::Orchestrator.job_batches rules, job
157
+ batches = Workflow::Orchestrator.sort_batches batches
143
158
  batches.each do |batch|
144
159
  top = batch[:top_level]
145
160
  jobs = batch[:jobs]
146
- puts Log.color :title, Log.fingerprint(top)
147
- puts batch[:rules].to_yaml
148
161
  deps = batch[:deps].collect{|dep| dep[:top_level] }
162
+ other = jobs - [top]
163
+ overriden = top.overriden?
149
164
  provided_inputs = jobs.inject({}){|acc,j| acc = IndiferentHash.add_defaults acc, j.provided_inputs }
165
+
166
+ puts Log.color :title, top.short_path
167
+ puts Log.color :subtitle, 'Other jobs: ' + Log.color(:blue, other.collect{|d| d.short_path}.uniq * ', ' ) if other.any?
168
+ puts Log.color :subtitle, 'Dependencies: ' + Log.color(:blue, deps.collect{|d| d.short_path}.uniq * ', ' ) if deps.any?
169
+ puts Log.color :subtitle, 'Overriden: ' + 'true' if overriden
170
+ batch[:rules].each do |k,v|
171
+ puts Log.color(:cyan, k + ": ") + v.to_json
172
+ end
150
173
  provided_inputs.each do |i,v|
151
174
  puts Log.color :green, "#{i}: " + Log.color(:blue, Log.fingerprint(v))
152
175
  end
153
- other = jobs - [top]
154
- puts Log.color :subtitle, 'Other jobs: ' + Log.color(:blue, other.collect{|d| d.short_path}.uniq * ', ' ) if other.any?
155
- puts Log.color :subtitle, 'Dependencies: ' + Log.color(:blue, deps.collect{|d| d.short_path}.uniq * ', ' ) if deps.any?
156
176
  end
177
+ puts
178
+ puts "#{batches.length} batches"
157
179
  exit 0
158
180
  when "serial"
159
- job.run(true)
160
- when "local"
181
+ job.run(true)
182
+ when "local", "workers"
161
183
  Workflow::LocalExecutor.produce job, rules
162
184
  when 'batch', 'sched', 'cluster', "slurm", 'pbs', 'lsf'
163
185
  Workflow::Scheduler.produce job, rules
164
186
  exit 0
187
+ when 'single_batch', 'single'
188
+ Workflow::Scheduler.produce_single_batch job, rules
189
+ exit 0
165
190
  else
166
- raise 'Use scout-camp instead of scout' unless defined? OffsiteStep
191
+ raise "Deploy '#{deploy}' not standard, assumed to be a server name; use scout-camp instead of scout" unless defined? OffsiteStep
167
192
  if deploy.end_with?('-batch')
168
193
  server = deploy.sub('-batch','')
169
194
  OffsiteStep.setup(job, server: server, batch: true)
@@ -21,7 +21,7 @@ $ #{$0} [<options>] <job-result>
21
21
  EOF
22
22
  if options[:help]
23
23
  if defined? scout_usage
24
- scout_usage
24
+ scout_usage
25
25
  else
26
26
  puts SOPT.doc
27
27
  end
@@ -16,7 +16,7 @@ $ #{$0} <job-result> <key> <value>
16
16
  EOF
17
17
  if options[:help]
18
18
  if defined? scout_usage
19
- scout_usage
19
+ scout_usage
20
20
  else
21
21
  puts SOPT.doc
22
22
  end
@@ -63,7 +63,7 @@ if recursive && step.info[:archived_info]
63
63
  info[key] = value if (force || ! info.include?(key)) && (!check_pid || info[:pid].to_s == pid and info[:pid_hostname] == host)
64
64
  rescue
65
65
  Log.warn "Could no set info #{key} for archived_dep #{info[:path]}: #{$!.message}"
66
- end
66
+ end
67
67
  end
68
68
  step.set_info :archived_info, ad
69
69
  end
@@ -14,7 +14,7 @@ $ #{$0} [<options>] <filename> [<other|->]*
14
14
  EOF
15
15
  if options[:help]
16
16
  if defined? scout_usage
17
- scout_usage
17
+ scout_usage
18
18
  else
19
19
  puts SOPT.doc
20
20
  end
@@ -9,6 +9,11 @@ class TestAssociationItem < Test::Unit::TestCase
9
9
  assert TSV === AssociationItem.incidence(pairs)
10
10
  assert_equal 2, AssociationItem.incidence(pairs).length
11
11
  assert_equal 2, AssociationItem.incidence(pairs).fields.length
12
+
13
+ associations = AssociationItem.setup(pairs)
14
+ associations.extend AnnotatedArray
15
+
16
+ assert_equal 2, associations.incidence.fields.length
12
17
  end
13
18
 
14
19
  def test_brothers
@@ -70,7 +70,7 @@ class TestEntityProperty < Test::Unit::TestCase
70
70
  end
71
71
 
72
72
  property :annotation_list => :single do
73
- self.chars.to_a.collect{|c|
73
+ self.chars.to_a.collect{|c|
74
74
  ReversableString.setup(c)
75
75
  }
76
76
  end
@@ -80,11 +80,11 @@ class TestEntityProperty < Test::Unit::TestCase
80
80
  end
81
81
 
82
82
  $processed_multiple = []
83
- property :multiple_annotation_list => :multiple do
83
+ property :multiple_annotation_list => :multiple do
84
84
  $processed_multiple.concat self
85
85
  res = {}
86
86
  self.collect do |e|
87
- e.chars.to_a.collect{|c|
87
+ e.chars.to_a.collect{|c|
88
88
  ReversableString.setup(c)
89
89
  }
90
90
  end
@@ -46,7 +46,7 @@ Sibling relationships.
46
46
  assert_include kb.description(:brothers), "Sibling relationships."
47
47
  end
48
48
  end
49
-
49
+
50
50
  def test_full_description
51
51
  TmpFile.with_dir do |dir|
52
52
  brothers = datafile_test(:person).brothers
@@ -126,8 +126,8 @@ end
126
126
  #
127
127
  # kb.register :gene_ages, datadir_test.gene_ages, :source => "=>Associated Gene Name"
128
128
  #
129
- # kb.register :CollecTRI, datadir_test.CollecTRI,
130
- # :source => "Transcription Factor=~Associated Gene Name",
129
+ # kb.register :CollecTRI, datadir_test.CollecTRI,
130
+ # :source => "Transcription Factor=~Associated Gene Name",
131
131
  # :target => "Target Gene=~Associated Gene Name",
132
132
  # :fields => ["[ExTRI] Confidence", "[ExTRI] PMID"]
133
133
  #
@@ -14,8 +14,8 @@ class TestClass < Test::Unit::TestCase
14
14
  pi.close
15
15
  pi = PackedIndex.new(tmpfile, false)
16
16
  100.times do |i|
17
- assert_equal i, pi[i][0]
18
- assert_equal i+2, pi[i][1]
17
+ assert_equal i, pi[i][0]
18
+ assert_equal i+2, pi[i][1]
19
19
  end
20
20
  assert_equal nil, pi[100]
21
21
  assert_equal nil, pi[101]
@@ -75,8 +75,8 @@ class TestClass < Test::Unit::TestCase
75
75
  pi = PackedIndex.new(tmpfile, false)
76
76
  Misc.benchmark(1000) do
77
77
  100.times do |i|
78
- assert_equal i, pi[i][0]
79
- assert_equal i+2, pi[i][1]
78
+ assert_equal i, pi[i][0]
79
+ assert_equal i+2, pi[i][1]
80
80
  end
81
81
  end
82
82
 
@@ -87,8 +87,8 @@ class TestClass < Test::Unit::TestCase
87
87
  end
88
88
  Misc.benchmark(1000) do
89
89
  100.times do |i|
90
- assert_equal i, tk[i][0]
91
- assert_equal i+2, tk[i][1]
90
+ assert_equal i, tk[i][0]
91
+ assert_equal i+2, tk[i][1]
92
92
  end
93
93
  end
94
94
  end