lib/paraduct/runner.rb in paraduct-0.0.1.beta10 vs lib/paraduct/runner.rb in paraduct-0.0.1.beta11

- old
+ new

@@ -11,10 +11,11 @@ # @option args :base_job_dir [String] def initialize(args={}) @script = args[:script] @params = args[:params] @base_job_dir = args[:base_job_dir] + @job_id = args[:job_id] @logger = Paraduct::ThreadLogger.new end def setup_dir FileUtils.mkdir_p(job_dir) unless job_dir.exist? @@ -24,10 +25,11 @@ # run script with params # @return [String] stdout # @raise [Paraduct::Errors::ProcessError] command exited error status def perform - variable_string = key_capitalized_params.map{ |key, value| %(export #{key}="#{value}";) }.join(" ") + export_variables = key_capitalized_params.merge("JOB_ID" => @job_id, "JOB_NAME" => job_name) + variable_string = export_variables.map{ |key, value| %(export #{key}="#{value}";) }.join(" ") Array.wrap(@script).inject("") do |stdout, command| stdout << run_command("#{variable_string} #{command}") stdout end