Skip to content

Commit a083d2f

Browse files
committed
Add NexusSlotInfo
1 parent 2772cca commit a083d2f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

temporalio/worker/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
CustomSlotSupplier,
3434
FixedSizeSlotSupplier,
3535
LocalActivitySlotInfo,
36+
NexusSlotInfo,
3637
ResourceBasedSlotConfig,
3738
ResourceBasedSlotSupplier,
3839
ResourceBasedTunerConfig,
@@ -117,4 +118,5 @@
117118
"SlotReleaseContext",
118119
"SlotReserveContext",
119120
"WorkflowSlotInfo",
121+
"NexusSlotInfo",
120122
]

temporalio/worker/_tuning.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,22 @@ class LocalActivitySlotInfo(Protocol):
152152
activity_type: str
153153

154154

155-
SlotInfo: TypeAlias = Union[WorkflowSlotInfo, ActivitySlotInfo, LocalActivitySlotInfo]
155+
# WARNING: This must match Rust worker::NexusSlotInfo
156+
@runtime_checkable
157+
class NexusSlotInfo(Protocol):
158+
"""Info about a nexus task slot usage.
159+
160+
.. warning::
161+
Custom slot suppliers are currently experimental.
162+
"""
163+
164+
service: str
165+
operation: str
166+
167+
168+
SlotInfo: TypeAlias = Union[
169+
WorkflowSlotInfo, ActivitySlotInfo, LocalActivitySlotInfo, NexusSlotInfo
170+
]
156171

157172

158173
# WARNING: This must match Rust worker::SlotMarkUsedCtx

0 commit comments

Comments
 (0)