Sha256: a48590e76fb4759a2f695c1309e4a6a3b7123b57f643f3dfe0d602f8ea70f037
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
require_relative '../workflow/step' require_relative 'ssh' require_relative 'sync' module OffsiteStep extend MetaExtension extension_attr :server, :workflow_name, :clean_id, :provided_inputs def inputs_directory @inputs_directory ||= begin if provided_inputs && provided_inputs.any? file = ".scout/tmp/step_inputs/#{workflow}/#{task_name}/#{name}" TmpFile.with_path do |inputs_dir| task.save_inputs(inputs_dir, provided_inputs) SSHLine.rsync(inputs_dir, file, target: server, directory: true) end file end end end def workflow_name @workflow_name || workflow.to_s end def offsite_job_ssh(script) parts = [] parts << <<~EOF.strip wf = Workflow.require_workflow "#{workflow_name}"; EOF if inputs_directory parts << <<~EOF.strip job = wf.job(:#{task_name}, "#{clean_name}", :load_inputs => "#{inputs_directory}"); EOF else parts << <<~EOF.strip job = wf.job(:#{task_name}, "#{clean_name}"); EOF end parts << script SSHLine.scout server, parts * "\n" end def offsite_path @path = offsite_job_ssh <<~EOF job.path.identify EOF end def info info = @info ||= offsite_job_ssh <<~EOF info = Open.exists?(job.info_file) ? job.info : {} info[:running] = true if job.running? info EOF @info = nil unless %w(done aborted error).include?(info[:status].to_s) info end def done? status == :done end def exec bundle_files = offsite_job_ssh <<~EOF job.run job.bundle_files EOF SSHLine.sync(bundle_files, source: server) self.load end def run exec end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scout-gear-8.1.0 | lib/scout/offsite/step.rb |