Module: RemoteStep::SSH
- Defined in:
- lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb
Instance Attribute Summary collapse
-
#override_dependencies ⇒ Object
Returns the value of attribute override_dependencies.
Instance Method Summary collapse
- #clean ⇒ Object
- #init_job(cache_type = nil, other_params = {}) ⇒ Object
- #load ⇒ Object
- #path ⇒ Object
- #produce(*args) ⇒ Object
- #run(*args) ⇒ Object
Instance Attribute Details
#override_dependencies ⇒ Object
Returns the value of attribute override_dependencies.
3 4 5 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 3 def override_dependencies @override_dependencies end |
Instance Method Details
#clean ⇒ Object
71 72 73 74 75 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 71 def clean init_job RemoteWorkflow::SSH.clean(@url, @input_id, @base_name) _restart end |
#init_job(cache_type = nil, other_params = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 5 def init_job(cache_type = nil, other_params = {}) return self if @url cache_type = :asynchronous if cache_type.nil? and not @is_exec cache_type = :exec if cache_type.nil? @last_info_time = nil @done = false @server, @server_path = RemoteWorkflow::SSH.parse_url base_url @input_id ||= "inputs-" << rand(100000).to_s if override_dependencies && override_dependencies.any? override_dependencies.each do |od| name, _sep, value = od.partition("=") inputs[name] = value end end inputs.select{|i| Step === i }.each{|i| i.produce } RemoteWorkflow::SSH.upload_inputs(@server, inputs, @input_types, @input_id) @name ||= Persist.memory("RemoteSteps", :workflow => self, :task => task, :jobname => @name, :inputs => inputs, :cache_type => cache_type) do Misc.insist do input_types = {} RemoteWorkflow::SSH.post_job(File.join(base_url, task.to_s), @input_id, @base_name) end end if Open.remote?(@name) @url = @name @name = File.basename(@name) else @url = File.join(base_url, task.to_s, @name) end self end |
#load ⇒ Object
62 63 64 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 62 def load load_res Open.open(path) end |
#path ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 42 def path @server, @server_path = RemoteWorkflow::SSH.parse_url @base_url init_job unless @name if info[:path] "ssh://" + @server + ":" + info[:path] else "ssh://" + @server + ":" + ["var/jobs", self.workflow.to_s, task_name.to_s, @name] * "/" end end |
#produce(*args) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 52 def produce(*args) input_types = {} init_job @remote_path = RemoteWorkflow::SSH.run_job(File.join(base_url, task.to_s), @input_id, @base_name) @started = true while ! done? sleep 1 end end |
#run(*args) ⇒ Object
66 67 68 69 |
# File 'lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb', line 66 def run(*args) produce(*args) self.load unless args.first end |