Module: Conflow::Flow::JobHandler
- Included in:
- Conflow::Flow
- Defined in:
- lib/conflow/flow/job_handler.rb
Overview
Handles running and finishing jobs
Instance Method Summary collapse
- #finish(job, result = nil) ⇒ Object
-
#run(job_class, params: {}, after: [], hook: nil) ⇒ Conflow::Job
Enqueued job.
Instance Method Details
#finish(job, result = nil) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/conflow/flow/job_handler.rb', line 25 def finish(job, result = nil) send(job.hook.to_s, result) unless job.hook.nil? call_script(Conflow::Redis::CompleteJobScript, job) queue_available_jobs destroy! if finished? end |
#run(job_class, params: {}, after: [], hook: nil) ⇒ Conflow::Job
Returns enqueued job.
15 16 17 18 19 20 21 22 23 |
# File 'lib/conflow/flow/job_handler.rb', line 15 def run(job_class, params: {}, after: [], hook: nil) build_job(job_class, params, hook).tap do |job| job_classes[job_class] = job after = prepare_dependencies(after) call_script(Conflow::Redis::AddJobScript, job, after: after) queue_available_jobs end end |