Class: SolidFlow::Runner
- Inherits:
-
Object
- Object
- SolidFlow::Runner
- Defined in:
- lib/solid_flow/runner.rb
Instance Method Summary collapse
-
#initialize(store: SolidFlow.store, time_provider: SolidFlow.configuration.time_provider) ⇒ Runner
constructor
A new instance of Runner.
- #run(execution_id) ⇒ Object
Constructor Details
#initialize(store: SolidFlow.store, time_provider: SolidFlow.configuration.time_provider) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 |
# File 'lib/solid_flow/runner.rb', line 9 def initialize(store: SolidFlow.store, time_provider: SolidFlow.configuration.time_provider) @store = store @time_provider = time_provider end |
Instance Method Details
#run(execution_id) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/solid_flow/runner.rb', line 14 def run(execution_id) store.with_execution(execution_id) do |execution_record| workflow_class = SolidFlow.configuration.workflow_registry.fetch(execution_record[:workflow]) events = store.load_history(execution_id) state = Replay.new(workflow_class:, events:, execution_record:).call Determinism.assert_graph!(workflow_class, state.execution_state.graph_signature) return state if state.finished? step_index = state.execution_state.cursor_index step_definition = workflow_class.steps[step_index] unless step_definition complete_execution(execution_id, workflow_class, state, state.ctx) return state end workflow = workflow_class.new( ctx: state.ctx.deep_dup, execution: build_execution_struct(state.execution_state), history: state.history ) consume_pending_signals(execution_id, workflow, state) if step_definition.task? handle_task_step(execution_id, workflow, step_definition, state) else handle_inline_step(execution_id, workflow, step_definition, state) end end end |