@@ -78,14 +78,21 @@ class SlotPermit:
7878 """A permit to use a slot for a workflow/activity/local activity task.
7979
8080 You can inherit from this class to add your own data to the permit.
81+
82+ .. warning::
83+ Custom slot suppliers are currently experimental.
8184 """
8285
8386 pass
8487
8588
8689# WARNING: This must match Rust worker::SlotReserveCtx
8790class SlotReserveContext (Protocol ):
88- """Context for reserving a slot from a :py:class:`CustomSlotSupplier`."""
91+ """Context for reserving a slot from a :py:class:`CustomSlotSupplier`.
92+
93+ .. warning::
94+ Custom slot suppliers are currently experimental.
95+ """
8996
9097 slot_type : Literal ["workflow" , "activity" , "local-activity" ]
9198 """The type of slot trying to be reserved. Always one of "workflow", "activity", or "local-activity"."""
@@ -99,24 +106,39 @@ class SlotReserveContext(Protocol):
99106 """True iff this is a reservation for a sticky poll for a workflow task."""
100107
101108
109+ # WARNING: This must match Rust worker::WorkflowSlotInfo
102110@runtime_checkable
103111class WorkflowSlotInfo (Protocol ):
104- """Info about a workflow task slot usage."""
112+ """Info about a workflow task slot usage.
113+
114+ .. warning::
115+ Custom slot suppliers are currently experimental.
116+ """
105117
106118 workflow_type : str
107119 is_sticky : bool
108120
109121
122+ # WARNING: This must match Rust worker::ActivitySlotInfo
110123@runtime_checkable
111124class ActivitySlotInfo (Protocol ):
112- """Info about an activity task slot usage."""
125+ """Info about an activity task slot usage.
126+
127+ .. warning::
128+ Custom slot suppliers are currently experimental.
129+ """
113130
114131 activity_type : str
115132
116133
134+ # WARNING: This must match Rust worker::LocalActivitySlotInfo
117135@runtime_checkable
118136class LocalActivitySlotInfo (Protocol ):
119- """Info about a local activity task slot usage."""
137+ """Info about a local activity task slot usage.
138+
139+ .. warning::
140+ Custom slot suppliers are currently experimental.
141+ """
120142
121143 activity_type : str
122144
@@ -125,18 +147,28 @@ class LocalActivitySlotInfo(Protocol):
125147
126148
127149# WARNING: This must match Rust worker::SlotMarkUsedCtx
150+ @dataclass (frozen = True )
128151class SlotMarkUsedContext (Protocol ):
129- """Context for marking a slot used from a :py:class:`CustomSlotSupplier`."""
152+ """Context for marking a slot used from a :py:class:`CustomSlotSupplier`.
153+
154+ .. warning::
155+ Custom slot suppliers are currently experimental.
156+ """
130157
131158 slot_info : SlotInfo
132159 """Info about the task that will be using the slot."""
133160 permit : SlotPermit
134161 """The permit that was issued when the slot was reserved."""
135162
136163
164+ # WARNING: This must match Rust worker::SlotReleaseCtx
137165@dataclass (frozen = True )
138166class SlotReleaseContext :
139- """Context for releasing a slot from a :py:class:`CustomSlotSupplier`."""
167+ """Context for releasing a slot from a :py:class:`CustomSlotSupplier`.
168+
169+ .. warning::
170+ Custom slot suppliers are currently experimental.
171+ """
140172
141173 slot_info : SlotInfo
142174 """Info about the task that will be using the slot."""
@@ -145,7 +177,11 @@ class SlotReleaseContext:
145177
146178
147179class CustomSlotSupplier (ABC ):
148- """This class can be implemented to provide custom slot supplier behavior."""
180+ """This class can be implemented to provide custom slot supplier behavior.
181+
182+ .. warning::
183+ Custom slot suppliers are currently experimental.
184+ """
149185
150186 @abstractmethod
151187 async def reserve_slot (self , ctx : SlotReserveContext ) -> SlotPermit :
0 commit comments