Class: Hatchet::WorkflowRunRef
- Inherits:
-
Object
- Object
- Hatchet::WorkflowRunRef
- Defined in:
- lib/hatchet/workflow_run.rb
Overview
Reference to a running workflow, returned by ‘Workflow#run_no_wait`
The result is the full workflow-level output keyed by task readable_id, e.g. ‘=> {…, “step2” => …}`.
Instance Attribute Summary collapse
-
#workflow_run_id ⇒ String
readonly
The workflow run ID.
Instance Method Summary collapse
-
#initialize(workflow_run_id:, client: nil, listener: nil) ⇒ WorkflowRunRef
constructor
A new instance of WorkflowRunRef.
-
#result ⇒ Hash
Block until the workflow run completes and return the result.
Constructor Details
#initialize(workflow_run_id:, client: nil, listener: nil) ⇒ WorkflowRunRef
Returns a new instance of WorkflowRunRef.
21 22 23 24 25 26 27 |
# File 'lib/hatchet/workflow_run.rb', line 21 def initialize(workflow_run_id:, client: nil, listener: nil) @workflow_run_id = workflow_run_id @client = client @listener = listener @result = nil @resolved = false end |
Instance Attribute Details
#workflow_run_id ⇒ String (readonly)
Returns The workflow run ID.
16 17 18 |
# File 'lib/hatchet/workflow_run.rb', line 16 def workflow_run_id @workflow_run_id end |
Instance Method Details
#result ⇒ Hash
Block until the workflow run completes and return the result.
Uses the pooled gRPC ‘SubscribeToWorkflowRuns` listener when available. Falls back to gRPC `GetRunDetails` polling otherwise.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hatchet/workflow_run.rb', line 37 def result return @result if @resolved @result = if @listener @listener.result(@workflow_run_id) else poll_result_via_grpc end @resolved = true @result end |