Skip to content

Commit 2cea1a2

Browse files
authored
Add first_execution_run_id to workflow info (#1027)
* Add first_execution_run_id to workflow info * Add test assertion, fill in fake info
1 parent e1016bc commit 2cea1a2

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

temporalio/worker/_workflow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ def _create_workflow_instance(
522522
execution_timeout=init.workflow_execution_timeout.ToTimedelta()
523523
if init.HasField("workflow_execution_timeout")
524524
else None,
525+
first_execution_run_id=init.first_execution_run_id,
525526
headers=dict(init.headers),
526527
namespace=self._namespace,
527528
parent=parent,

temporalio/worker/workflow_sandbox/_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
continued_run_id=None,
3434
cron_schedule=None,
3535
execution_timeout=None,
36+
first_execution_run_id="sandbox-validate-first-run_id",
3637
headers={},
3738
namespace="sandbox-validate-namespace",
3839
parent=None,

temporalio/workflow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ class Info:
493493
continued_run_id: Optional[str]
494494
cron_schedule: Optional[str]
495495
execution_timeout: Optional[timedelta]
496+
first_execution_run_id: str
496497
headers: Mapping[str, temporalio.api.common.v1.Payload]
497498
namespace: str
498499
parent: Optional[ParentInfo]

tests/worker/test_workflow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,7 @@ async def run(self, past_run_ids: List[str]) -> List[str]:
16451645
info = workflow.info()
16461646
if info.continued_run_id:
16471647
past_run_ids.append(info.continued_run_id)
1648+
assert info.first_execution_run_id == past_run_ids[0]
16481649
workflow.continue_as_new(
16491650
past_run_ids,
16501651
# Add memo and retry policy to check

0 commit comments

Comments
 (0)