OSC / osc-machete

High level interface to submitting and checking the status of batch jobs (currently OSC specific)
MIT License
1 stars 0 forks source link

Allow passing adapter specific arguments in when submitting job #109

Open nickjer opened 8 years ago

nickjer commented 8 years ago

I'd like to be able to pass in headers, resources, and env vars to the qsub function programmatically for each job. This is already a feature with PBS headers in a script file:

#PBS -N jobname
...

but not currently allowed through the machete interface programmatically. This is necessary for osc-vnc to work.

nickjer commented 8 years ago

Probably something along the lines of adding a submit_args attribute to a job:

class OSC::Machete::Job
  attr_reader :submit_args

  ...

  def submit
    ...

    Dir.chdir(path.to_s) do
      @pbsid = @torque.qsub script_name, depends_on: dependency_ids, host: @host, account_string: account_string, submit_args: submit_args
    end
  end
end

and then modify the TorqueHelper as such:

class OSC::Machete::TorqueHelper
  def qsub(script, host: nil, depends_on: {}, account_string: nil, submit_args: {})
    ...

    # Create PBS submission attributes
    headers = headers.merge submit_args.fetch(:headers, {})
    resources = submit_args.fetch(:resources, {})
    envvars = submit_args.fetch(:envvars, {})

    pbs_job.submit(file: script, headers: headers, resources: resources, envvars: envvars, qsub: true).id
  end
end