Class: Bedouin::Runner
- Inherits:
-
Object
- Object
- Bedouin::Runner
- Defined in:
- lib/bedouin/runner.rb
Instance Method Summary collapse
-
#initialize(cfg = { nomad: "nomad" }) ⇒ Runner
constructor
A new instance of Runner.
- #run(job) ⇒ Object
Constructor Details
#initialize(cfg = { nomad: "nomad" }) ⇒ Runner
Returns a new instance of Runner.
4 5 6 |
# File 'lib/bedouin/runner.rb', line 4 def initialize(cfg = { nomad: "nomad" }) @cfg = cfg end |
Instance Method Details
#run(job) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/bedouin/runner.rb', line 8 def run(job) Open3.popen3(@cfg[:nomad], "run", 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 |