Skip to content

Commit 84c5ac7

Browse files
committed
Add some documentation comments
1 parent f3cf5ee commit 84c5ac7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

temporalio/nexus/_operation_context.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
ContextVar("temporal-cancel-operation-context")
5050
)
5151

52+
# A Nexus start handler might start zero or more workflows as usual using a Temporal client. In
53+
# addition, it may start one "nexus-backing" workflow, using
54+
# WorkflowRunOperationContext.start_workflow. This context is active while the latter is being done.
55+
# It is thus a narrower context than _temporal_start_operation_context.
5256
_temporal_nexus_backing_workflow_start_context: ContextVar[bool] = ContextVar(
5357
"temporal-nexus-backing-workflow-start-context"
5458
)
@@ -418,6 +422,12 @@ async def start_workflow(
418422
# We must pass nexus_completion_callbacks, workflow_event_links, and request_id,
419423
# but these are deliberately not exposed in overloads, hence the type-check
420424
# violation.
425+
426+
# Here we are starting a "nexus-backing" workflow. That means that the StartWorkflow request
427+
# contains nexus-specific data such as a completion callback (used by the handler server
428+
# namespace to deliver the result to the caller namespace when the workflow reaches a
429+
# terminal state) and inbound links to the caller workflow (attached to history events of
430+
# the workflow started in the handler namespace, and displayed in the UI).
421431
with _nexus_backing_workflow_start_context():
422432
wf_handle = await self._temporal_context.client.start_workflow( # type: ignore
423433
workflow=workflow,

0 commit comments

Comments
 (0)