class Temporalio::Worker::WorkflowReplayer
Replayer to replay workflows from existing history.
def initialize(
- Yield: - If a block is present, this is the equivalent of calling {with_replay_worker} with the block and
Parameters:
-
runtime
(Runtime
) -- Runtime for this replayer. -
debug_mode
(Boolean
) -- If true, deadlock detection is disabled. Deadlock detection will fail workflow tasks -
workflow_payload_codec_thread_pool
(ThreadPool, nil
) -- Thread pool to run payload codec encode/decode -
workflow_failure_exception_types
(Array
) -- Workflow failure exception types. This is the> -
illegal_workflow_calls
(Hash
) -- Set of illegal workflow calls that are]> -
logger
(Logger
) -- Logger to use. Defaults to stdout with warn level. Callers setting this logger are -
identity
(String, nil
) -- Override the identity for this replater. -
build_id
(String
) -- Unique identifier for the current runtime. This is best set as a unique value -
interceptors
(Array
) -- Workflow interceptors. -
workflow_executor
(WorkflowExecutor
) -- Workflow executor that workflow tasks run within. This must be a -
data_converter
(Converters::DataConverter
) -- Data converter to use for all data conversions to/from -
task_queue
(String
) -- Task queue as set in the workflow info. -
namespace
(String
) -- Namespace as set in the workflow info. -
workflows
(Array
) -- Workflows for this replayer.>
def initialize( workflows:, namespace: 'ReplayNamespace', task_queue: 'ReplayTaskQueue', data_converter: Converters::DataConverter.default, workflow_executor: WorkflowExecutor::ThreadPool.default, interceptors: [], build_id: Worker.default_build_id, identity: nil, logger: Logger.new($stdout, level: Logger::WARN), illegal_workflow_calls: Worker.default_illegal_workflow_calls, workflow_failure_exception_types: [], workflow_payload_codec_thread_pool: nil, debug_mode: %w[true 1].include?(ENV['TEMPORAL_DEBUG'].to_s.downcase), runtime: Runtime.default, & ) @options = Options.new( workflows:, namespace:, task_queue:, data_converter:, workflow_executor:, interceptors:, build_id:, identity:, logger:, illegal_workflow_calls:, workflow_failure_exception_types:, workflow_payload_codec_thread_pool:, debug_mode:, runtime: ).freeze # Preload definitions and other settings @workflow_definitions = Internal::Worker::WorkflowWorker.workflow_definitions(workflows) @nondeterminism_as_workflow_fail, @nondeterminism_as_workflow_fail_for_types = Internal::Worker::WorkflowWorker.bridge_workflow_failure_exception_type_options( workflow_failure_exception_types:, workflow_definitions: @workflow_definitions ) # If there is a block, we'll go ahead and assume it's for with_replay_worker with_replay_worker(&) if block_given? # steep:ignore end
def replay_workflow(history, raise_on_replay_failure: true)
-
(ReplayResult)
- Result of the replay.
Parameters:
-
raise_on_replay_failure
(Boolean
) -- If true, the default, this will raise an exception on any replay -
history
(WorkflowHistory
) -- History to replay.
def replay_workflow(history, raise_on_replay_failure: true) with_replay_worker { |worker| worker.replay_workflow(history, raise_on_replay_failure:) } end
def replay_workflows(histories, raise_on_replay_failure: false)
-
(Array
- Results of the replay.)
Parameters:
-
raise_on_replay_failure
(Boolean
) -- If true, this will raise an exception on any replay failure. If false, -
histories
(Enumerable
) -- Histories to replay.
def replay_workflows(histories, raise_on_replay_failure: false) with_replay_worker do |worker| histories.map { |h| worker.replay_workflow(h, raise_on_replay_failure:) } end end
def with_replay_worker(&)
- Yieldreturn: - Result of the block.
Other tags:
- Yieldparam: Worker - to run replays on. Note, only one workflow can replay at a time.
Other tags:
- Yield: - Block of code to run with a replay worker.
def with_replay_worker(&) worker = ReplayWorker.new( options:, workflow_definitions: @workflow_definitions, nondeterminism_as_workflow_fail: @nondeterminism_as_workflow_fail, nondeterminism_as_workflow_fail_for_types: @nondeterminism_as_workflow_fail_for_types ) begin yield worker ensure worker._shutdown end end