35
35
# CancelOperationContext and passes it as the first parameter to the nexusrpc operation
36
36
# handler. In addition, it sets one of the following context vars.
37
37
38
- _temporal_start_operation_context : ContextVar [_TemporalStartOperationContext ] = (
38
+ _temporal_start_operation_context : ContextVar [TemporalStartOperationContext ] = (
39
39
ContextVar ("temporal-start-operation-context" )
40
40
)
41
41
@@ -70,7 +70,7 @@ def client() -> temporalio.client.Client:
70
70
71
71
72
72
def _temporal_context () -> (
73
- Union [_TemporalStartOperationContext , _TemporalCancelOperationContext ]
73
+ Union [TemporalStartOperationContext , _TemporalCancelOperationContext ]
74
74
):
75
75
ctx = _try_temporal_context ()
76
76
if ctx is None :
@@ -79,7 +79,7 @@ def _temporal_context() -> (
79
79
80
80
81
81
def _try_temporal_context () -> (
82
- Optional [Union [_TemporalStartOperationContext , _TemporalCancelOperationContext ]]
82
+ Optional [Union [TemporalStartOperationContext , _TemporalCancelOperationContext ]]
83
83
):
84
84
start_ctx = _temporal_start_operation_context .get (None )
85
85
cancel_ctx = _temporal_cancel_operation_context .get (None )
@@ -89,7 +89,7 @@ def _try_temporal_context() -> (
89
89
90
90
91
91
@dataclass
92
- class _TemporalStartOperationContext :
92
+ class TemporalStartOperationContext :
93
93
"""
94
94
Context for a Nexus start operation being handled by a Temporal Nexus Worker.
95
95
"""
@@ -104,7 +104,7 @@ class _TemporalStartOperationContext:
104
104
"""The Temporal client in use by the worker handling this Nexus operation."""
105
105
106
106
@classmethod
107
- def get (cls ) -> _TemporalStartOperationContext :
107
+ def get (cls ) -> TemporalStartOperationContext :
108
108
ctx = _temporal_start_operation_context .get (None )
109
109
if ctx is None :
110
110
raise RuntimeError ("Not in Nexus operation context." )
@@ -170,15 +170,15 @@ def add_outbound_links(
170
170
171
171
@dataclass
172
172
class WorkflowRunOperationContext :
173
- temporal_context : _TemporalStartOperationContext
173
+ temporal_context : TemporalStartOperationContext
174
174
175
175
@property
176
176
def nexus_context (self ) -> StartOperationContext :
177
177
return self .temporal_context .nexus_context
178
178
179
179
@classmethod
180
180
def get (cls ) -> WorkflowRunOperationContext :
181
- return cls (_TemporalStartOperationContext .get ())
181
+ return cls (TemporalStartOperationContext .get ())
182
182
183
183
# Overload for single-param workflow
184
184
# TODO(nexus-prerelease): bring over other overloads
0 commit comments