Method: OodCore::Job::Adapters::Slurm::Batch#submit_string

Defined in:
lib/ood_core/job/adapters/slurm.rb

#submit_string(str, args: [], env: {}) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Submit a script expanded as a string to the batch server

Parameters:

  • str (#to_s)

    script as a string

  • args (Array<#to_s>) (defaults to: [])

    arguments passed to ‘sbatch` command

  • env (Hash{#to_s => #to_s}) (defaults to: {})

    environment variables set

Returns:

  • (String)

    the id of the job that was created

Raises:

  • (Error)

    if ‘sbatch` command exited unsuccessfully



284
285
286
287
288
# File 'lib/ood_core/job/adapters/slurm.rb', line 284

def submit_string(str, args: [], env: {})
  args = args.map(&:to_s) + ["--parsable"]
  env = env.to_h.each_with_object({}) { |(k, v), h| h[k.to_s] = v.to_s }
  call("sbatch", *args, env: env, stdin: str.to_s).strip.split(";").first
end