Class: ConflowSpec::Runner
- Inherits:
-
Object
- Object
- ConflowSpec::Runner
- Includes:
- Conflow::Worker
- Defined in:
- lib/conflow_spec/runner.rb
Overview
Runs the flow and collects informations about it
Instance Attribute Summary collapse
-
#flow ⇒ Object
readonly
Returns the value of attribute flow.
-
#performed_jobs ⇒ Object
readonly
Returns the value of attribute performed_jobs.
Instance Method Summary collapse
-
#initialize(flow) ⇒ Runner
constructor
A new instance of Runner.
-
#run ⇒ Object
Performs all jobs in the flow, saving results in #performed_jobs.
Constructor Details
#initialize(flow) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 |
# File 'lib/conflow_spec/runner.rb', line 11 def initialize(flow) @flow = flow @queue = queue @performed_jobs = [] end |
Instance Attribute Details
#flow ⇒ Object (readonly)
Returns the value of attribute flow.
8 9 10 |
# File 'lib/conflow_spec/runner.rb', line 8 def flow @flow end |
#performed_jobs ⇒ Object (readonly)
Returns the value of attribute performed_jobs.
8 9 10 |
# File 'lib/conflow_spec/runner.rb', line 8 def performed_jobs @performed_jobs end |
Instance Method Details
#run ⇒ Object
Performs all jobs in the flow, saving results in #performed_jobs
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/conflow_spec/runner.rb', line 18 def run until queue.empty? job = queue.pop perform(flow.id, job.id) do |worker_type, params| performed_jobs << [worker_type, params.to_h] fetch_result(job) end end end |