class Bedouin::Runner

Public Class Methods

new(cfg = { nomad: "nomad" }) click to toggle source
# File lib/bedouin/runner.rb, line 4
def initialize(cfg = { nomad: "nomad" })
  @cfg = cfg
end

Public Instance Methods

run(job:, opts: []) click to toggle source
# File lib/bedouin/runner.rb, line 8
def run(job:, opts: [])
  Open3.popen3(@cfg[:nomad], "run", *opts, '--', job.file_path) do |stdin, stdout, stderr, wait_thr|
    job.status = wait_thr.value
    job.stdout = stdout.read
    job.stderr = stderr.read
  end

  job
end