rbbt-util 5.26.162 → 5.26.163

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2c2ede8d746f69d82b953d794c101536c975e7bafbd84d5c8265ea827f71fed
4
- data.tar.gz: 70d9262d64a126c30bb987c251c1000bdc762d7a74180da148c2d550bfb3557a
3
+ metadata.gz: 7b14759cc0559ef2ae62b648dcf539b8ac974300da1c6a74d5cea2954dad71b8
4
+ data.tar.gz: 05acb42e2a10e975c94447d390db33415ae34a686260df43573e112f96134e26
5
5
  SHA512:
6
- metadata.gz: 57ce06e0635fd13a5906e945df884c05e864aec59bd729ac191e80cd1f8628b68a780efe5b8e9e9a4964becc5b18be21ad1044b3f7e0df864d04284dbcd4555f
7
- data.tar.gz: 6af68737fb7b4932f4f2d588806f786e62f49598824479374b4761ea9b27d93ea1b70f0b731bd9552c8f7b3a872b26c2aeb646dafd2afaacfa283b6b119b1d13
6
+ metadata.gz: c915e11233f1b92c5015399fd12b305d20997603b74f46e7031667f7d011686d4fc200fd2df919a2482134bfb6bbd2a610628a7d7e8e3bae7cd266b1883ebe06
7
+ data.tar.gz: cf3b872feeb95b37f25957014f21f6230af3f623bf4c7b59014fda4ff4d43e5a2fa2dcc8ec4d38305003a20013f03986ec53e976f3c6223e48660709f1459765
@@ -107,7 +107,7 @@ module TSV
107
107
  end
108
108
  file
109
109
  when String
110
- if Open.remote?(file) or Open.exist? file
110
+ if Open.remote?(file) || Open.ssh?(file) || Open.exist?(file)
111
111
  Open.open(file, open_options)
112
112
  else
113
113
  StringIO.new file
@@ -52,10 +52,10 @@ module Workflow
52
52
  @dependencies << block
53
53
  else
54
54
  if Module === dependency.first or
55
- (defined? WorkflowRESTClient and WorkflowRESTClient === dependency.first) or
55
+ (defined? RemoteWorkflow and RemoteWorkflow === dependency.first) or
56
56
  Hash === dependency.last
57
57
 
58
- dependency = ([self] + dependency) unless Module === dependency.first or (defined? WorkflowRESTClient and WorkflowRESTClient === dependency.first)
58
+ dependency = ([self] + dependency) unless Module === dependency.first || (defined?(RemoteWorkflow) && RemoteWorkflow === dependency.first)
59
59
  @dependencies << dependency
60
60
  else
61
61
  @dependencies.concat dependency
@@ -23,12 +23,13 @@ class RemoteWorkflow
23
23
  name
24
24
  end
25
25
 
26
- def job(task, name = nil, inputs = {})
26
+ def __job(task, name = nil, inputs = {})
27
27
  task_info = task_info(task)
28
28
  fixed_inputs = {}
29
29
  input_types = IndiferentHash.setup(task_info[:input_types])
30
30
 
31
31
  inputs.each do |k,v|
32
+ v = v.load if Step === v
32
33
  k = k.to_sym
33
34
  if TSV === v
34
35
  fixed_inputs[k] = v.to_s
@@ -44,7 +45,9 @@ class RemoteWorkflow
44
45
  end
45
46
 
46
47
  stream_input = @can_stream ? task_info(task)[:input_options].select{|k,o| o[:stream] }.collect{|k,o| k }.first : nil
47
- RemoteStep.new(url, task, name, fixed_inputs, task_info[:input_types], task_info[:result_type], task_info[:result_description], @exec_exports.include?(task), @stream_exports.include?(task), stream_input)
48
+ step = RemoteStep.new(url, task, name, fixed_inputs, task_info[:input_types], task_info[:result_type], task_info[:result_description], @exec_exports.include?(task), @stream_exports.include?(task), stream_input)
49
+ step.workflow = self
50
+ step
48
51
  end
49
52
 
50
53
  def load_id(id)
@@ -72,8 +72,12 @@ class RemoteWorkflow
72
72
  new_params
73
73
  end
74
74
 
75
+ def exported_tasks
76
+ @asynchronous_exports + @synchronous_exports + @exec_exports
77
+ end
78
+
75
79
  def load_tasks
76
- (@asynchronous_exports + @synchronous_exports + @exec_exports).each{|name| tasks[name]}
80
+ exported_tasks.each{|name| tasks[name]}
77
81
  end
78
82
 
79
83
  end
@@ -126,6 +126,7 @@ class RemoteStep < Step
126
126
  end
127
127
 
128
128
  def info(check_lock=false)
129
+ return {:status => :waiting } unless started?
129
130
  @done = @info && @info[:status] && (@info[:status].to_sym == :done || @info[:status].to_sym == :error)
130
131
 
131
132
  if !@done && (@last_info_time.nil? || (Time.now - @last_info_time) > 0.5)
@@ -142,6 +143,7 @@ class RemoteStep < Step
142
143
  info[:status] = info[:status].to_sym if String === info[:status]
143
144
  info
144
145
  end
146
+
145
147
  @info
146
148
  end
147
149
 
@@ -302,6 +304,11 @@ class RemoteStep < Step
302
304
  end
303
305
  end
304
306
 
307
+
308
+ def input_checks
309
+ []
310
+ end
311
+
305
312
  def _restart
306
313
  @done = nil
307
314
  @name = nil
@@ -318,11 +325,6 @@ class RemoteStep < Step
318
325
  @inputs = new_inputs
319
326
  @info = nil
320
327
  end
321
-
322
- def input_checks
323
- []
324
- end
325
-
326
328
  end
327
329
 
328
330
  require 'rbbt/workflow/remote_workflow/remote_step/rest'
@@ -89,7 +89,7 @@ class RemoteStep
89
89
 
90
90
  def stream_job(task_url, task_params, stream_input, cache_type = :exec)
91
91
  require 'rbbt/util/misc/multipart_payload'
92
- WorkflowRESTClient.capture_exception do
92
+ RemoteWorkflow.capture_exception do
93
93
  @streaming = true
94
94
 
95
95
  Log.debug{ "RestClient stream #{Process.pid}: #{ task_url } #{stream_input} #{cache_type} - #{Misc.fingerprint task_params}" }
@@ -101,7 +101,7 @@ class RemoteStep
101
101
  @url = res.gets
102
102
  @url.sub!(/\?.*/,'')
103
103
  join
104
- WorkflowRESTClient.get_raw(@url)
104
+ RemoteWorkflow.get_raw(@url)
105
105
  @done = true
106
106
  @streaming = false
107
107
  when /STREAM: (.*)/
@@ -30,24 +30,32 @@ class RemoteStep
30
30
  RemoteWorkflow::SSH.post_job(File.join(base_url, task.to_s), @input_id, @base_name)
31
31
  end
32
32
  end
33
- if Open.remote? @name
33
+
34
+ if Open.remote?(@name)
34
35
  @url = @name
35
36
  @name = File.basename(@name)
36
37
  else
37
38
  @url = File.join(base_url, task.to_s, @name)
38
39
  end
40
+
39
41
  self
40
42
  end
41
43
 
42
44
  def path
43
45
  @server, @server_path = RemoteWorkflow::SSH.parse_url @base_url
44
- "ssh://" + @server + ":" + @remote_path
46
+ init_job unless @name
47
+ if info[:path]
48
+ "ssh://" + @server + ":" + info[:path]
49
+ else
50
+ "ssh://" + @server + ":" + ["var/jobs", self.workflow.to_s, task_name.to_s, @name] * "/"
51
+ end
45
52
  end
46
53
 
47
54
  def produce(*args)
48
55
  input_types = {}
49
56
  init_job
50
57
  @remote_path = RemoteWorkflow::SSH.run_job(File.join(base_url, task.to_s), @input_id, @base_name)
58
+ @started = true
51
59
  while ! done?
52
60
  sleep 1
53
61
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rbbt-util'
4
4
  require 'rbbt/util/simpleopt'
5
- require 'rbbt/workflow/remote/ssh/driver'
5
+ require 'rbbt/workflow/remote_workflow'
6
6
 
7
7
  $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
8
8
 
@@ -43,7 +43,7 @@ search_path = 'user' if search_path.nil?
43
43
  resource = Rbbt
44
44
 
45
45
  path, real_paths, lpath = if options[:source]
46
- lpath, *paths = SSHDriver.run(options[:source], <<-EOF).split("\n")
46
+ lpath, *paths = Misc.ssh_run(options[:source], <<-EOF).split("\n")
47
47
  require 'rbbt-util'
48
48
  path = "#{path}"
49
49
  if Open.exists?(path)
@@ -66,13 +66,13 @@ puts path.glob_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
66
66
  end
67
67
 
68
68
  target = if options[:target]
69
- target = SSHDriver.run(options[:target], <<-EOF).split("\n").first
69
+ target = Misc.ssh_run(options[:target], <<-EOF).split("\n").first
70
70
  require 'rbbt-util'
71
71
  path = "#{path}"
72
72
  resource = #{resource.to_s}
73
73
  search_path = "#{search_path}"
74
74
  puts resource[path].find(search_path)
75
- EOF
75
+ EOF
76
76
  else
77
77
  resource[lpath].find(search_path)
78
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.162
4
+ version: 5.26.163
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez