Class: Kiqchestra::Workflow
- Inherits:
-
Object
- Object
- Kiqchestra::Workflow
- Defined in:
- lib/kiqchestra/workflow.rb
Overview
The Workflow class provides functionality for orchestrating Sidekiq-based job workflows. It manages task dependencies and tracks their completion status.
Instance Method Summary collapse
-
#execute ⇒ Object
Starts the workflow execution.
-
#handle_completed_job(job) ⇒ Object
Handles the completion of a job and triggers the next jobs if dependencies are met.
-
#initialize(workflow_id, metadata) ⇒ Workflow
constructor
Initializes the workflow with workflow id and data.
Constructor Details
#initialize(workflow_id, metadata) ⇒ Workflow
Initializes the workflow with workflow id and data.
}
21 22 23 24 25 26 27 28 |
# File 'lib/kiqchestra/workflow.rb', line 21 def initialize(workflow_id, ) @workflow_id = workflow_id = @logger = Logger.new($stdout) end |
Instance Method Details
#execute ⇒ Object
Starts the workflow execution.
31 32 33 34 35 36 37 38 |
# File 'lib/kiqchestra/workflow.rb', line 31 def execute read_progress .each do |job, job_data| process_job job, job_data end conclude_workflow if workflow_complete? end |
#handle_completed_job(job) ⇒ Object
Handles the completion of a job and triggers the next jobs if dependencies are met.
43 44 45 46 47 48 |
# File 'lib/kiqchestra/workflow.rb', line 43 def handle_completed_job(job) update_progress job, "complete" log_info "#{job} completed for workflow #{@workflow_id}" execute end |