Skip to content

Commit 7a03e39

Browse files
committed
Documentation
1 parent fe1366a commit 7a03e39

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

temporalio/converter.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,24 @@
6969
class SerializationContext(ABC):
7070
"""Base serialization context.
7171
72-
This provides contextual information during serialization and deserialization
73-
operations. Different contexts (activity, workflow, etc.) can provide
74-
specialized information.
72+
Provides contextual information during serialization and deserialization operations.
73+
74+
Examples:
75+
76+
- In client code, when starting a workflow, or sending a signal/update/query to a workflow, or
77+
receiving the result of an update/query, or handling an exception from a workflow, the context
78+
type is :py:class:`WorkflowSerializationContext` and the workflow ID set of the target
79+
workflow will be set in the context.
80+
81+
- In workflow code, when operating on a payload being sent/received to/from a child workflow, or
82+
handling an exception from a child workflow, the context type is
83+
:py:class:`WorkflowSerializationContext` and the workflow ID is that of the child workflow,
84+
not of the currently executing (i.e. parent) workflow.
85+
86+
- In workflow code, when operating on a payload to be sent/received to/from an activity, the
87+
context type is :py:class:`ActivitySerializationContext` and the workflow ID is that of the
88+
currently-executing workflow. ActivitySerializationContext is also set on operations
89+
7590
"""
7691

7792
pass
@@ -81,13 +96,14 @@ class SerializationContext(ABC):
8196
class WorkflowSerializationContext(SerializationContext):
8297
"""Serialization context for workflows.
8398
84-
Matches .NET SDK's ISerializationContext.Workflow.
99+
See :py:class:`SerializationContext` for more details.
85100
86101
Attributes:
87102
namespace: The namespace the workflow is running in.
88-
workflow_id: The workflow ID. Note, when creating/describing schedules,
89-
this may be the workflow ID prefix as configured, not the final
90-
workflow ID when the workflow is created by the schedule.
103+
workflow_id: The ID of the workflow. Note that this is the ID of the workflow of which the
104+
payload being operated on is an input or output. Note also that when creating/describing
105+
schedules, this may be the workflow ID prefix as configured, not the final workflow ID
106+
when the workflow is created by the schedule.
91107
"""
92108

93109
namespace: str
@@ -98,7 +114,7 @@ class WorkflowSerializationContext(SerializationContext):
98114
class ActivitySerializationContext(SerializationContext):
99115
"""Serialization context for activities.
100116
101-
Matches .NET SDK's ISerializationContext.Activity.
117+
See :py:class:`SerializationContext` for more details.
102118
103119
Attributes:
104120
namespace: Workflow/activity namespace.

0 commit comments

Comments
 (0)