scout-gear 9.0.0 → 10.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +3 -3
  3. data/Rakefile +1 -2
  4. data/VERSION +1 -1
  5. data/bin/scout +0 -1
  6. data/lib/rbbt-scout.rb +2 -1
  7. data/lib/scout/offsite/exceptions.rb +9 -0
  8. data/lib/scout/offsite/ssh.rb +1 -0
  9. data/lib/scout/semaphore.rb +2 -0
  10. data/lib/scout/tsv/dumper.rb +1 -0
  11. data/lib/scout/tsv/open.rb +8 -2
  12. data/lib/scout/tsv/parser.rb +1 -1
  13. data/lib/scout/tsv/persist/adapter.rb +2 -2
  14. data/lib/scout/tsv/persist.rb +1 -0
  15. data/lib/scout/tsv/util.rb +1 -1
  16. data/lib/scout/tsv.rb +1 -1
  17. data/lib/scout/work_queue/exceptions.rb +18 -0
  18. data/lib/scout/work_queue.rb +1 -0
  19. data/lib/scout/workflow/definition.rb +1 -1
  20. data/lib/scout/workflow/step/config.rb +1 -1
  21. data/lib/scout/workflow/step/dependencies.rb +3 -2
  22. data/lib/scout/workflow/step/file.rb +5 -1
  23. data/lib/scout/workflow/step/info.rb +8 -2
  24. data/lib/scout/workflow/step/provenance.rb +28 -10
  25. data/lib/scout/workflow/step/status.rb +4 -0
  26. data/lib/scout/workflow/step.rb +18 -6
  27. data/lib/scout/workflow/task/dependencies.rb +1 -0
  28. data/lib/scout/workflow/task/inputs.rb +6 -1
  29. data/lib/scout/workflow/task.rb +22 -3
  30. data/lib/scout/workflow/usage.rb +1 -0
  31. data/lib/scout/workflow.rb +13 -4
  32. data/lib/scout-gear.rb +1 -10
  33. data/scout-gear.gemspec +8 -98
  34. data/scout_commands/workflow/task +2 -3
  35. data/test/scout/workflow/step/test_provenance.rb +24 -1
  36. data/test/scout/workflow/task/test_inputs.rb +0 -4
  37. metadata +7 -110
  38. data/lib/scout/cmd.rb +0 -347
  39. data/lib/scout/concurrent_stream.rb +0 -284
  40. data/lib/scout/config.rb +0 -168
  41. data/lib/scout/exceptions.rb +0 -151
  42. data/lib/scout/indiferent_hash/case_insensitive.rb +0 -30
  43. data/lib/scout/indiferent_hash/options.rb +0 -115
  44. data/lib/scout/indiferent_hash.rb +0 -96
  45. data/lib/scout/log/color.rb +0 -224
  46. data/lib/scout/log/color_class.rb +0 -269
  47. data/lib/scout/log/fingerprint.rb +0 -69
  48. data/lib/scout/log/progress/report.rb +0 -244
  49. data/lib/scout/log/progress/util.rb +0 -173
  50. data/lib/scout/log/progress.rb +0 -106
  51. data/lib/scout/log/trap.rb +0 -107
  52. data/lib/scout/log.rb +0 -441
  53. data/lib/scout/meta_extension.rb +0 -100
  54. data/lib/scout/misc/digest.rb +0 -63
  55. data/lib/scout/misc/filesystem.rb +0 -25
  56. data/lib/scout/misc/format.rb +0 -255
  57. data/lib/scout/misc/helper.rb +0 -31
  58. data/lib/scout/misc/insist.rb +0 -56
  59. data/lib/scout/misc/monitor.rb +0 -66
  60. data/lib/scout/misc/system.rb +0 -73
  61. data/lib/scout/misc.rb +0 -10
  62. data/lib/scout/named_array.rb +0 -138
  63. data/lib/scout/open/lock/lockfile.rb +0 -587
  64. data/lib/scout/open/lock.rb +0 -68
  65. data/lib/scout/open/remote.rb +0 -135
  66. data/lib/scout/open/stream.rb +0 -491
  67. data/lib/scout/open/util.rb +0 -244
  68. data/lib/scout/open.rb +0 -170
  69. data/lib/scout/path/find.rb +0 -204
  70. data/lib/scout/path/tmpfile.rb +0 -8
  71. data/lib/scout/path/util.rb +0 -107
  72. data/lib/scout/path.rb +0 -51
  73. data/lib/scout/persist/open.rb +0 -17
  74. data/lib/scout/persist/path.rb +0 -15
  75. data/lib/scout/persist/serialize.rb +0 -157
  76. data/lib/scout/persist.rb +0 -104
  77. data/lib/scout/resource/open.rb +0 -8
  78. data/lib/scout/resource/path.rb +0 -80
  79. data/lib/scout/resource/produce/rake.rb +0 -69
  80. data/lib/scout/resource/produce.rb +0 -151
  81. data/lib/scout/resource/scout.rb +0 -3
  82. data/lib/scout/resource/software.rb +0 -178
  83. data/lib/scout/resource/util.rb +0 -55
  84. data/lib/scout/resource.rb +0 -41
  85. data/lib/scout/simple_opt/accessor.rb +0 -54
  86. data/lib/scout/simple_opt/doc.rb +0 -126
  87. data/lib/scout/simple_opt/get.rb +0 -57
  88. data/lib/scout/simple_opt/parse.rb +0 -67
  89. data/lib/scout/simple_opt/setup.rb +0 -26
  90. data/lib/scout/simple_opt.rb +0 -5
  91. data/lib/scout/tmpfile.rb +0 -129
  92. data/test/scout/indiferent_hash/test_case_insensitive.rb +0 -16
  93. data/test/scout/indiferent_hash/test_options.rb +0 -46
  94. data/test/scout/log/test_progress.rb +0 -108
  95. data/test/scout/misc/test_digest.rb +0 -30
  96. data/test/scout/misc/test_filesystem.rb +0 -30
  97. data/test/scout/misc/test_insist.rb +0 -13
  98. data/test/scout/misc/test_system.rb +0 -21
  99. data/test/scout/open/test_lock.rb +0 -52
  100. data/test/scout/open/test_remote.rb +0 -25
  101. data/test/scout/open/test_stream.rb +0 -676
  102. data/test/scout/open/test_util.rb +0 -73
  103. data/test/scout/path/test_find.rb +0 -119
  104. data/test/scout/path/test_util.rb +0 -22
  105. data/test/scout/persist/test_open.rb +0 -37
  106. data/test/scout/persist/test_path.rb +0 -37
  107. data/test/scout/persist/test_serialize.rb +0 -114
  108. data/test/scout/resource/test_path.rb +0 -46
  109. data/test/scout/resource/test_produce.rb +0 -77
  110. data/test/scout/resource/test_software.rb +0 -24
  111. data/test/scout/resource/test_util.rb +0 -27
  112. data/test/scout/simple_opt/test_doc.rb +0 -16
  113. data/test/scout/simple_opt/test_get.rb +0 -11
  114. data/test/scout/simple_opt/test_parse.rb +0 -10
  115. data/test/scout/simple_opt/test_setup.rb +0 -77
  116. data/test/scout/test_cmd.rb +0 -85
  117. data/test/scout/test_concurrent_stream.rb +0 -29
  118. data/test/scout/test_config.rb +0 -66
  119. data/test/scout/test_indiferent_hash.rb +0 -26
  120. data/test/scout/test_log.rb +0 -32
  121. data/test/scout/test_meta_extension.rb +0 -80
  122. data/test/scout/test_misc.rb +0 -6
  123. data/test/scout/test_named_array.rb +0 -43
  124. data/test/scout/test_open.rb +0 -146
  125. data/test/scout/test_path.rb +0 -54
  126. data/test/scout/test_persist.rb +0 -186
  127. data/test/scout/test_resource.rb +0 -26
  128. data/test/scout/test_tmpfile.rb +0 -53
  129. /data/test/scout/{log/test_color.rb → test_offsite.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98b3f84350f2f451b717f004bfc97cd7767f7e0fed58e1a2d0cd023bc700185f
4
- data.tar.gz: '00847ad4d92b1cab22305ea867dc12c870b22e192e79536917f82aa90cc82989'
3
+ metadata.gz: 5af158e978a724dacd722c9584cb4fd3b7f46fff8a4619272b1d2c2258418600
4
+ data.tar.gz: 6bd5da8eba38542376f4b5566154fc16105f3742ba0758a37139d0ff9679d06e
5
5
  SHA512:
6
- metadata.gz: 4af5e13873fa13dea33161e9200aa725bb4329899e9242ae6504ffae2ab82e7eb01b82a53edc2a4331ede06d0f12bb07f86f579cb29ecbf0d36e791bf6d53f3e
7
- data.tar.gz: fc773eb933e5c851aa1d642e872df02d282fbcb29ee1b8e1bf150ffebf9bd4ce8c3670d43a284ff2c8197477a8cf6f71dfcd49b265ad938c723292ec57579998
6
+ metadata.gz: e9f6f4d2a5e223d740332b627c9606907d69536696f477401087b4f72bee09d1b374d060275ecb3fad5e38c27010417d36d661d985c58d71e3cec4bf04bbcbf7
7
+ data.tar.gz: a7b8e5d1bfd1057bd93cfbd4a2439bccf0e28848f3e08923c81da8bcc2fe1a489ffb2e220587ecb4533ad0cf7edcf506f3c4557955dfa11356d816b87b379968
data/.vimproject CHANGED
@@ -78,12 +78,12 @@ scout-gear=/$PWD filter="*.rb *.yaml" {
78
78
  open.rb
79
79
  open=open{
80
80
  lock.rb
81
+ remote.rb
82
+ stream.rb
83
+ util.rb
81
84
  lock=lock{
82
85
  lockfile.rb
83
86
  }
84
- stream.rb
85
- remote.rb
86
- util.rb
87
87
  }
88
88
  resource.rb
89
89
  resource=resource{
data/Rakefile CHANGED
@@ -20,10 +20,9 @@ Juwelier::Tasks.new do |gem|
20
20
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
21
21
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
22
22
  # gem.add_development_dependency 'rspec', '> 1.2.3'
23
- gem.add_runtime_dependency 'term-ansicolor'
23
+ gem.add_runtime_dependency 'scout-essentials'
24
24
  gem.add_runtime_dependency 'net-ssh'
25
25
  gem.add_runtime_dependency 'matrix'
26
- gem.add_runtime_dependency 'sys-proctable'
27
26
  gem.add_runtime_dependency 'RubyInline'
28
27
  #gem.add_runtime_dependency 'tokyocabinet'
29
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 9.0.0
1
+ 10.0.1
data/bin/scout CHANGED
@@ -99,7 +99,6 @@ if config_keys = options.delete(:config_keys)
99
99
  end
100
100
  end
101
101
 
102
-
103
102
  $scout_command_dir = Scout.bin.scout
104
103
  $scout_command_dir.path_maps[:scout_commands] = File.join(File.dirname(__dir__), "{PATH/bin\\/scout/scout_commands}")
105
104
 
data/lib/rbbt-scout.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  $LOAD_PATH.unshift File.join(__dir__, '../modules/rbbt-util/lib')
2
- module Rbbt
2
+ module Scout
3
3
  extend Resource
4
4
  self.path_maps = Path.path_maps.merge(:rbbt_lib => File.expand_path(File.join(__dir__, '../modules/rbbt-util/', '{TOPLEVEL}','{SUBPATH}')))
5
5
  end
6
+ Rbbt = Scout
6
7
 
7
8
  Resource.set_software_env Rbbt.software
@@ -0,0 +1,9 @@
1
+ class SSHProcessFailed < StandardError
2
+ attr_accessor :host, :cmd
3
+ def initialize(host, cmd)
4
+ @host = host
5
+ @cmd = cmd
6
+ message = "SSH server #{host} failed cmd '#{cmd}'"
7
+ super(message)
8
+ end
9
+ end
@@ -1,4 +1,5 @@
1
1
  require 'net/ssh'
2
+ require_relative 'exceptions'
2
3
 
3
4
  class SSHLine
4
5
  class << self
@@ -8,6 +8,8 @@ end
8
8
 
9
9
  if continue
10
10
  module ScoutSemaphore
11
+ class SemaphoreInterrupted < TryAgain; end
12
+
11
13
  inline(:C) do |builder|
12
14
  builder.prefix <<-EOF
13
15
  #include <unistd.h>
@@ -19,6 +19,7 @@ module TSV
19
19
  preamble_str = nil
20
20
  end
21
21
 
22
+ preamble_str = preamble_str.strip if preamble_str
22
23
  [preamble_str, fields_str].compact * "\n"
23
24
  end
24
25
 
@@ -1,4 +1,4 @@
1
- require_relative '../open'
1
+ require 'scout/open'
2
2
  require_relative '../work_queue'
3
3
 
4
4
  module MultipleResult
@@ -20,7 +20,7 @@ module Open
20
20
  into.add *res
21
21
  when TSV, Hash
22
22
  key, value = res
23
- if into.type == :double
23
+ if TSV === into && into.type == :double
24
24
  into.zip_new key, value, insitu: false
25
25
  else
26
26
  into[key] = value
@@ -118,6 +118,12 @@ module Open
118
118
  callback.call res if callback
119
119
  nil
120
120
  end
121
+ when Hash
122
+ obj.each do |key,value|
123
+ res = block.call(key,value)
124
+ callback.call res if callback
125
+ nil
126
+ end
121
127
  when Array
122
128
  obj.each do |line|
123
129
  res = block.call(line)
@@ -1,4 +1,4 @@
1
- require_relative '../named_array'
1
+ require 'scout/named_array'
2
2
  module TSV
3
3
  def self.cast_value(value, cast)
4
4
  if Array === value
@@ -1,5 +1,5 @@
1
- require_relative '../../open/lock'
2
- require_relative '../../meta_extension'
1
+ require 'scout/open/lock'
2
+ require 'scout/meta_extension'
3
3
  require_relative 'serialize'
4
4
 
5
5
  module TSVAdapter
@@ -1,3 +1,4 @@
1
+ require 'scout/persist'
1
2
  require_relative 'persist/adapter'
2
3
  require_relative 'persist/tokyocabinet'
3
4
 
@@ -122,7 +122,7 @@ Example:
122
122
  end
123
123
 
124
124
  def digest_str
125
- fingerprint
125
+ "TSV:{"<< Log.fingerprint(self.all_fields|| []) << ";" << Log.fingerprint(self.keys) << ";" << Log.fingerprint(self.values) << "}"
126
126
  end
127
127
 
128
128
  def inspect
data/lib/scout/tsv.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'meta_extension'
1
+ require 'scout/meta_extension'
2
2
  require_relative 'tsv/util'
3
3
  require_relative 'tsv/parser'
4
4
  require_relative 'tsv/dumper'
@@ -0,0 +1,18 @@
1
+ class DoneProcessing < Exception
2
+ attr_accessor :pid
3
+ def initialize(pid = Process.pid)
4
+ @pid = pid
5
+ end
6
+
7
+ def message
8
+ "Done processing pid #{pid}"
9
+ end
10
+ end
11
+
12
+ class WorkerException < ScoutException
13
+ attr_accessor :worker_exception, :pid
14
+ def initialize(worker_exception, pid)
15
+ @worker_exception = worker_exception
16
+ @pid = pid
17
+ end
18
+ end
@@ -1,5 +1,6 @@
1
1
  require_relative 'work_queue/socket'
2
2
  require_relative 'work_queue/worker'
3
+ require_relative 'work_queue/exceptions'
3
4
  require 'timeout'
4
5
 
5
6
  class WorkQueue
@@ -1,4 +1,4 @@
1
- require_relative '../meta_extension'
1
+ require 'scout/meta_extension'
2
2
 
3
3
  module Workflow
4
4
  extend MetaExtension
@@ -1,4 +1,4 @@
1
- require_relative '../../config'
1
+ require 'scout/config'
2
2
 
3
3
  class Step
4
4
  def config(key, *tokens)
@@ -7,11 +7,12 @@ class Step
7
7
  direct_deps << dep
8
8
  end
9
9
  seen.concat direct_deps.collect{|d| d.path }
10
- direct_deps.inject(direct_deps){|acc,d| acc.concat(d.rec_dependencies(connected, [])); acc }
10
+ direct_deps.inject(direct_deps){|acc,d| acc.concat(d.rec_dependencies(connected, seen)); acc }
11
11
  end
12
12
 
13
13
  def recursive_inputs
14
- recursive_inputs = @inputs.to_hash
14
+ recursive_inputs = NamedArray === @inputs ? @inputs.to_hash : {}
15
+ return recursive_inputs if dependencies.nil?
15
16
  dependencies.inject(recursive_inputs) do |acc,dep|
16
17
  acc.merge(dep.recursive_inputs)
17
18
  end
@@ -2,7 +2,11 @@ class Step
2
2
  def files_dir
3
3
  @files_dir ||= begin
4
4
  dir = @path + ".files"
5
- @path.annotate(dir) if Path === @path
5
+ if Path === @path
6
+ @path.annotate(dir)
7
+ else
8
+ Path.setup(dir)
9
+ end
6
10
  dir.pkgdir = self
7
11
  dir
8
12
  end
@@ -9,12 +9,18 @@ class Step
9
9
  end
10
10
  end
11
11
 
12
+ def self.load_info(info_file)
13
+ info = Persist.load(info_file, SERIALIZER) || {}
14
+ IndiferentHash.setup(info)
15
+ end
16
+
12
17
  def load_info
13
- @info = Persist.load(info_file, SERIALIZER) || {}
14
- IndiferentHash.setup(@info)
18
+ @info = Step.load_info(info_file)
15
19
  @info_load_time = Time.now
16
20
  end
17
21
 
22
+
23
+
18
24
  def save_info(info = nil)
19
25
  Persist.save(info, info_file, SERIALIZER)
20
26
  @info_load_time = Time.now
@@ -83,10 +83,25 @@ class Step
83
83
  end
84
84
  end
85
85
 
86
- str << "\n"
86
+ str
87
87
  end
88
88
 
89
- def self.prov_report(step, offset = 0, task = nil, seen = [], expand_repeats = false, input = nil)
89
+ def self.prov_indent(step, offset, input_dependencies)
90
+ return (" " * (offset))
91
+ if step.alias?
92
+ (" " * offset + "🡵")
93
+ elsif step.overriden_task
94
+ (" " * offset + "🡇")
95
+ elsif input_dependencies.include?(step)
96
+ (" " * offset + "┝")
97
+ elsif step.input_dependencies.any?
98
+ (" " * offset + "╰")
99
+ else
100
+ (" " * (offset+1))
101
+ end
102
+ end
103
+
104
+ def self.prov_report(step, offset = 0, task = nil, seen = [], expand_repeats = false, input = nil, input_dependencies = nil)
90
105
  info = step.info || {}
91
106
  info[:task_name] = task
92
107
  path = step.path
@@ -101,7 +116,7 @@ class Step
101
116
 
102
117
  this_step_msg = prov_report_msg(status, name, path, info, input)
103
118
 
104
- input_dependencies = {}
119
+ input_dependencies ||= {}
105
120
  step.dependencies.each do |dep|
106
121
  if dep.input_dependencies.any?
107
122
  dep.input_dependencies.each do |id|
@@ -116,8 +131,10 @@ class Step
116
131
  end
117
132
  end if step.dependencies
118
133
 
119
- str = ""
120
- str = " " * offset + this_step_msg if ENV["SCOUT_ORIGINAL_STACK"] == 'true'
134
+ str = []
135
+
136
+ indent = prov_indent(step, offset, input_dependencies)
137
+ str << indent + this_step_msg if ENV["SCOUT_ORIGINAL_STACK"] == 'true'
121
138
 
122
139
  step.dependencies.dup.tap{|l|
123
140
  l.reverse! if ENV["SCOUT_ORIGINAL_STACK"] == 'true'
@@ -126,10 +143,10 @@ class Step
126
143
  new = ! seen.include?(path)
127
144
  if new
128
145
  seen << path
129
- str << prov_report(dep, offset + 1, task, seen, expand_repeats, input_dependencies[dep])
146
+ str.concat(prov_report(dep, offset + 1, task, seen, expand_repeats, input_dependencies[dep], input_dependencies.dup).split("\n"))
130
147
  else
131
148
  if expand_repeats
132
- str << Log.color(Step.status_color(dep.status), Log.uncolor(prov_report(dep, offset+1, task)))
149
+ str << Log.color(Step.status_color(dep.status), Log.uncolor(prov_report(dep, offset+1, task, input_dependencies[dep], input_dependencies.dup)))
133
150
  else
134
151
  info = dep.info || {}
135
152
  status = info[:status] || :missing
@@ -138,13 +155,14 @@ class Step
138
155
  status = :unsync if status == :done and not Open.exist?(path)
139
156
  status = :notfound if status == :noinfo and not Open.exist?(path)
140
157
 
141
- str << Log.color(Step.status_color(status), " " * (offset + 1) + Log.uncolor(prov_report_msg(status, name, path, info, input_dependencies[dep])))
158
+ dep_indent = prov_indent(dep, offset+1, input_dependencies)
159
+ str << dep_indent + Log.color(Step.status_color(status), Log.uncolor(prov_report_msg(status, name, path, info, input_dependencies[dep])))
142
160
  end
143
161
  end
144
162
  end if step.dependencies
145
163
 
146
- str += (" " * offset) + this_step_msg unless ENV["SCOUT_ORIGINAL_STACK"] == 'true'
164
+ str << indent + this_step_msg unless ENV["SCOUT_ORIGINAL_STACK"] == 'true'
147
165
 
148
- str
166
+ str * "\n"
149
167
  end
150
168
  end
@@ -33,6 +33,10 @@ class Step
33
33
  Open.rm_rf files_dir if Open.exist?(files_dir)
34
34
  end
35
35
 
36
+ def self.clean(file)
37
+ Step.new(file).clean
38
+ end
39
+
36
40
 
37
41
  def recursive_clean
38
42
  dependencies.each do |dep|
@@ -1,5 +1,5 @@
1
- require_relative '../path'
2
- require_relative '../persist'
1
+ require 'scout/path'
2
+ require 'scout/persist'
3
3
  require_relative 'step/info'
4
4
  require_relative 'step/status'
5
5
  require_relative 'step/load'
@@ -33,7 +33,9 @@ class Step
33
33
  def inputs
34
34
  @inputs ||= begin
35
35
  if info_file && Open.exists?(info_file)
36
- info[:inputs]
36
+ inputs = info[:inputs]
37
+ NamedArray.setup(inputs, info[:input_names]) if inputs && info[:input_names]
38
+ inputs
37
39
  else
38
40
  []
39
41
  end
@@ -61,6 +63,10 @@ class Step
61
63
  @name ||= File.basename(@path)
62
64
  end
63
65
 
66
+ def short_path
67
+ [workflow.to_s, task_name, name] * "/"
68
+ end
69
+
64
70
  def clean_name
65
71
  return @id if @id
66
72
  return info[:clean_name] if info.include? :clean_name
@@ -122,9 +128,10 @@ class Step
122
128
  begin
123
129
  Persist.persist(name, type, :path => path, :tee_copies => tee_copies) do
124
130
  clear_info
131
+ input_names = (task.respond_to?(:inputs) && task.inputs) ? task.inputs.collect{|name,_| name} : []
125
132
  merge_info :status => :start, :start => Time.now,
126
133
  :pid => Process.pid, :pid_hostname => Misc.hostname,
127
- :inputs => MetaExtension.purge(inputs), :type => type,
134
+ :inputs => MetaExtension.purge(inputs), :input_names => input_names, :type => type,
128
135
  :dependencies => dependencies.collect{|d| d.path }
129
136
 
130
137
  @result = exec
@@ -278,9 +285,10 @@ class Step
278
285
  end
279
286
 
280
287
  def step(task_name)
288
+ task_name = task_name.to_sym
281
289
  dependencies.each do |dep|
282
- return dep if dep.task_name == task_name
283
- return dep if dep.overriden_task == task_name
290
+ return dep if dep.task_name && dep.task_name.to_sym == task_name
291
+ return dep if dep.overriden_task && dep.overriden_task.to_sym == task_name
284
292
  rec_dep = dep.step(task_name)
285
293
  return rec_dep if rec_dep
286
294
  end
@@ -302,4 +310,8 @@ class Step
302
310
  def task_signature
303
311
  [workflow.to_s, task_name] * "#"
304
312
  end
313
+
314
+ def alias?
315
+ task.alias? if task
316
+ end
305
317
  end
@@ -54,6 +54,7 @@ module Task
54
54
  if provided_inputs.include?(overriden = [workflow.name, task] * "#")
55
55
  dep = provided_inputs[overriden]
56
56
  dep = Step.new dep unless Step === dep
57
+ dep = dep.dup
57
58
  dep.type = workflow.tasks[task].type
58
59
  dep.overriden_task = task
59
60
  dep.overriden_workflow = workflow
@@ -1,4 +1,4 @@
1
- require_relative '../../named_array'
1
+ require 'scout/named_array'
2
2
  module Task
3
3
  def self.format_input(value, type, options = {})
4
4
  return value if IO === value || StringIO === value || Step === value
@@ -87,6 +87,8 @@ module Task
87
87
  if Path.is_filename?(value)
88
88
  relative_file = save_file_input(value, directory)
89
89
  Open.write(input_file + ".as_file", relative_file)
90
+ elsif Step === value
91
+ Open.write(input_file + ".as_step", value.short_path)
90
92
  elsif type == :file
91
93
  relative_file = save_file_input(value, directory)
92
94
  Persist.save(relative_file, input_file, :file)
@@ -115,6 +117,9 @@ module Task
115
117
  value = Open.read(filename).strip
116
118
  value.sub!(/^\./, File.dirname(filename)) if value.start_with?("./")
117
119
  inputs[name] = value
120
+ elsif filename.end_with?('.as_step')
121
+ value = Open.read(filename).strip
122
+ inputs[name] = Step.load value
118
123
  elsif (options && (options[:noload] || options[:stream] || options[:nofile]))
119
124
  inputs[name] = filename
120
125
  else
@@ -1,5 +1,5 @@
1
- require_relative '../meta_extension'
2
- require_relative '../named_array'
1
+ require 'scout/meta_extension'
2
+ require 'scout/named_array'
3
3
  require_relative 'step'
4
4
  require_relative 'task/inputs'
5
5
  require_relative 'task/dependencies'
@@ -45,6 +45,21 @@ module Task
45
45
  IndiferentHash.setup(provided_inputs)
46
46
  id = DEFAULT_NAME if id.nil?
47
47
 
48
+
49
+ missing_inputs = []
50
+ self.inputs.each do |input,type,desc,val,options|
51
+ next unless options && options[:required]
52
+ missing_inputs << input unless provided_inputs.include?(input)
53
+ end if self.inputs
54
+
55
+ if missing_inputs.length == 1
56
+ raise ParameterException, "Input '#{missing_inputs.first}' is required but was not provided or is nil"
57
+ end
58
+
59
+ if missing_inputs.length > 1
60
+ raise ParameterException, "Inputs #{Misc.humanize_list(missing_inputs)} are required but were not provided or are nil"
61
+ end
62
+
48
63
  provided_inputs = load_inputs(provided_inputs[:load_inputs]) if Hash === provided_inputs && provided_inputs[:load_inputs]
49
64
 
50
65
  inputs, non_default_inputs, input_digest_str = process_inputs provided_inputs, id
@@ -52,7 +67,7 @@ module Task
52
67
  compute = {}
53
68
  dependencies = dependencies(id, provided_inputs, non_default_inputs, compute)
54
69
 
55
- non_default_inputs.concat provided_inputs.keys.select{|k| String === k && k.include?("#") } if Hash === provided_inputs
70
+ #non_default_inputs.concat provided_inputs.keys.select{|k| String === k && k.include?("#") } if Hash === provided_inputs
56
71
 
57
72
  non_default_inputs.uniq!
58
73
 
@@ -95,4 +110,8 @@ module Task
95
110
  Step.new path.find, inputs, dependencies, id, non_default_inputs, step_provided_inputs, compute, &self
96
111
  end
97
112
  end
113
+
114
+ def alias?
115
+ @extension == :dep_task
116
+ end
98
117
  end
@@ -136,6 +136,7 @@ module Workflow
136
136
 
137
137
  dep_tree = {}
138
138
  task = self.tasks[task_name]
139
+ raise "TaskNotFound: #{task_name}" if task.nil?
139
140
  task.deps.each do |workflow, task, options|
140
141
  next if seen.include? dep
141
142
  seen << [workflow, task, options.merge(seen_options)]
@@ -6,8 +6,8 @@ require_relative 'workflow/documentation'
6
6
  require_relative 'workflow/usage'
7
7
  require_relative 'workflow/deployment'
8
8
 
9
- require_relative 'resource'
10
- require_relative 'resource/scout'
9
+ require 'scout/resource'
10
+ require 'scout/resource/scout'
11
11
 
12
12
  module Workflow
13
13
  class << self
@@ -27,7 +27,9 @@ module Workflow
27
27
 
28
28
  def self.require_workflow(workflow_name_orig)
29
29
  first = nil
30
- workflow_name_orig.split("+").each do |workflow_name|
30
+ workflow_name_orig.split("+").each do |complete_workflow_name|
31
+ self.main = nil
32
+ workflow_name, *subworkflows = complete_workflow_name.split("::")
31
33
  workflow = workflow_name
32
34
  workflow = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow)
33
35
  workflow = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
@@ -40,7 +42,14 @@ module Workflow
40
42
  else
41
43
  raise "Workflow #{workflow_name} not found"
42
44
  end
43
- first ||= self.main || workflows.last
45
+
46
+ current = begin
47
+ Kernel.const_get(complete_workflow_name)
48
+ rescue
49
+ self.main || workflows.last
50
+ end
51
+
52
+ first ||= current
44
53
  end
45
54
  first
46
55
  end
data/lib/scout-gear.rb CHANGED
@@ -1,12 +1,3 @@
1
- require_relative 'scout/exceptions'
2
- require_relative 'scout/indiferent_hash'
3
- require_relative 'scout/tmpfile'
4
- require_relative 'scout/log'
5
- require_relative 'scout/path'
6
- require_relative 'scout/simple_opt'
7
- require_relative 'scout/resource'
8
- require_relative 'scout/resource/scout'
9
- require_relative 'scout/persist'
1
+ require 'scout-essentials'
10
2
  require_relative 'scout/tsv'
11
- require_relative 'scout/config'
12
3
  require_relative 'scout/offsite'