Skip to content

Use proper workflow start time in workflow info #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion temporalio/.tool-versions

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def initialize(details)
end,
run_id: details.initial_activation.run_id,
run_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_run_timeout),
start_time: ProtoUtils.timestamp_to_time(details.initial_activation.timestamp) || raise,
start_time: ProtoUtils.timestamp_to_time(@init_job.start_time) || raise,
task_queue: details.task_queue,
task_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_task_timeout) || raise,
workflow_id: @init_job.workflow_id,
Expand Down
2 changes: 1 addition & 1 deletion temporalio/lib/temporalio/workflow/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module Workflow
# @!attribute run_timeout
# @return [Float, nil] Run timeout for the workflow.
# @!attribute start_time
# @return [Time] Time when the workflow started.
# @return [Time] Time when the workflow started on the server.
# @!attribute task_queue
# @return [String] Task queue for the workflow.
# @!attribute task_timeout
Expand Down
4 changes: 3 additions & 1 deletion temporalio/test/worker_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def execute
Temporalio::Workflow.info.to_h.tap do |h|
h['parent'] = Temporalio::Workflow.info.parent.to_h if Temporalio::Workflow.info.parent
h['root'] = Temporalio::Workflow.info.root.to_h if Temporalio::Workflow.info.root
h['start_time'] = Temporalio::Workflow.info.start_time.to_s
end
end
end
Expand All @@ -158,6 +159,7 @@ def test_info
# Normal info
execute_workflow(InfoWorkflow) do |handle, worker|
info = handle.result #: Hash[String, untyped]
desc = handle.describe
assert_equal 1, info['attempt']
assert_nil info.fetch('continued_run_id')
assert_nil info.fetch('cron_schedule')
Expand All @@ -170,7 +172,7 @@ def test_info
assert_nil info.fetch('root')
assert_equal handle.result_run_id, info['run_id']
assert_nil info.fetch('run_timeout')
refute_nil info['start_time']
assert_equal desc.start_time.to_s, info['start_time']
assert_equal worker.task_queue, info['task_queue']
assert_equal 10.0, info['task_timeout']
assert_equal handle.id, info['workflow_id']
Expand Down
Loading