Class: Temporalio::Internal::Worker::WorkflowWorker::State
- Inherits:
-
Object
- Object
- Temporalio::Internal::Worker::WorkflowWorker::State
- Defined in:
- lib/temporalio/internal/worker/workflow_worker.rb
Instance Attribute Summary collapse
-
#bridge_worker ⇒ Object
readonly
Returns the value of attribute bridge_worker.
-
#data_converter ⇒ Object
readonly
Returns the value of attribute data_converter.
-
#deadlock_timeout ⇒ Object
readonly
Returns the value of attribute deadlock_timeout.
-
#disable_eager_activity_execution ⇒ Object
readonly
Returns the value of attribute disable_eager_activity_execution.
-
#illegal_calls ⇒ Object
readonly
Returns the value of attribute illegal_calls.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#metric_meter ⇒ Object
readonly
Returns the value of attribute metric_meter.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#task_queue ⇒ Object
readonly
Returns the value of attribute task_queue.
-
#workflow_definitions ⇒ Object
readonly
Returns the value of attribute workflow_definitions.
-
#workflow_failure_exception_types ⇒ Object
readonly
Returns the value of attribute workflow_failure_exception_types.
-
#workflow_interceptors ⇒ Object
readonly
Returns the value of attribute workflow_interceptors.
Instance Method Summary collapse
- #evict_all ⇒ Object
- #evict_running_workflow(run_id) ⇒ Object
-
#get_or_create_running_workflow(run_id) ⇒ Object
This can never be called at the same time for the same run ID on the same state object.
-
#initialize(workflow_definitions:, bridge_worker:, logger:, metric_meter:, data_converter:, deadlock_timeout:, illegal_calls:, namespace:, task_queue:, disable_eager_activity_execution:, workflow_interceptors:, workflow_failure_exception_types:) ⇒ State
constructor
A new instance of State.
Constructor Details
#initialize(workflow_definitions:, bridge_worker:, logger:, metric_meter:, data_converter:, deadlock_timeout:, illegal_calls:, namespace:, task_queue:, disable_eager_activity_execution:, workflow_interceptors:, workflow_failure_exception_types:) ⇒ State
Returns a new instance of State.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 152 def initialize( workflow_definitions:, bridge_worker:, logger:, metric_meter:, data_converter:, deadlock_timeout:, illegal_calls:, namespace:, task_queue:, disable_eager_activity_execution:, workflow_interceptors:, workflow_failure_exception_types: ) @workflow_definitions = workflow_definitions @bridge_worker = bridge_worker @logger = logger @metric_meter = metric_meter @data_converter = data_converter @deadlock_timeout = deadlock_timeout @illegal_calls = illegal_calls @namespace = namespace @task_queue = task_queue @disable_eager_activity_execution = disable_eager_activity_execution @workflow_interceptors = workflow_interceptors @workflow_failure_exception_types = workflow_failure_exception_types @running_workflows = {} @running_workflows_mutex = Mutex.new end |
Instance Attribute Details
#bridge_worker ⇒ Object (readonly)
Returns the value of attribute bridge_worker.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def bridge_worker @bridge_worker end |
#data_converter ⇒ Object (readonly)
Returns the value of attribute data_converter.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def data_converter @data_converter end |
#deadlock_timeout ⇒ Object (readonly)
Returns the value of attribute deadlock_timeout.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def deadlock_timeout @deadlock_timeout end |
#disable_eager_activity_execution ⇒ Object (readonly)
Returns the value of attribute disable_eager_activity_execution.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def disable_eager_activity_execution @disable_eager_activity_execution end |
#illegal_calls ⇒ Object (readonly)
Returns the value of attribute illegal_calls.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def illegal_calls @illegal_calls end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def logger @logger end |
#metric_meter ⇒ Object (readonly)
Returns the value of attribute metric_meter.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def metric_meter @metric_meter end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def namespace @namespace end |
#task_queue ⇒ Object (readonly)
Returns the value of attribute task_queue.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def task_queue @task_queue end |
#workflow_definitions ⇒ Object (readonly)
Returns the value of attribute workflow_definitions.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def workflow_definitions @workflow_definitions end |
#workflow_failure_exception_types ⇒ Object (readonly)
Returns the value of attribute workflow_failure_exception_types.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def workflow_failure_exception_types @workflow_failure_exception_types end |
#workflow_interceptors ⇒ Object (readonly)
Returns the value of attribute workflow_interceptors.
148 149 150 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 148 def workflow_interceptors @workflow_interceptors end |
Instance Method Details
#evict_all ⇒ Object
189 190 191 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 189 def evict_all @running_workflows_mutex.synchronize { @running_workflows.clear } end |
#evict_running_workflow(run_id) ⇒ Object
185 186 187 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 185 def evict_running_workflow(run_id) @running_workflows_mutex.synchronize { @running_workflows.delete(run_id) } end |
#get_or_create_running_workflow(run_id) ⇒ Object
This can never be called at the same time for the same run ID on the same state object
175 176 177 178 179 180 181 182 183 |
# File 'lib/temporalio/internal/worker/workflow_worker.rb', line 175 def get_or_create_running_workflow(run_id, &) instance = @running_workflows_mutex.synchronize { @running_workflows[run_id] } # If instance is not there, we create it out of lock then store it under lock unless instance instance = yield @running_workflows_mutex.synchronize { @running_workflows[run_id] = instance } end instance end |