File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ where
177177 Resp : Data + for < ' de > Deserialize < ' de > ,
178178{
179179 async fn generate ( & self , request : SingleIn < Req > ) -> Result < ManyOut < Annotated < Resp > > , Error > {
180- match self . 0 . 0 . generate_in_parts ( request) . await {
180+ match self . 0 . 0 . generate_in_parts ( request) . await {
181181 Ok ( ( mut stream, context) ) => {
182182 let first_item = match futures:: StreamExt :: next ( & mut stream) . await {
183183 Some ( item) => item,
Original file line number Diff line number Diff line change @@ -377,6 +377,12 @@ impl DistributedRuntime {
377377 self . inner . runtime ( ) . shutdown ( ) ;
378378 }
379379
380+ fn child_token ( & self ) -> CancellationToken {
381+ CancellationToken {
382+ inner : self . inner . runtime ( ) . child_token ( ) ,
383+ }
384+ }
385+
380386 fn event_loop ( & self ) -> PyObject {
381387 self . event_loop . clone ( )
382388 }
Original file line number Diff line number Diff line change @@ -52,6 +52,30 @@ class DistributedRuntime:
5252 Shutdown the runtime by triggering the cancellation token
5353 """
5454 ...
55+
56+ def child_token (self ) -> CancellationToken :
57+ """
58+ Get a child cancellation token from the runtime
59+ """
60+ ...
61+
62+ class CancellationToken :
63+ """
64+ A cancellation token for coordinating shutdown across components
65+ """
66+
67+ def cancel (self ) -> None :
68+ """
69+ Cancel the token
70+ """
71+ ...
72+
73+ async def cancelled (self ) -> None :
74+ """
75+ Wait for the token to be cancelled
76+ """
77+ ...
78+
5579class EtcdClient :
5680 """
5781 Etcd is used for discovery in the DistributedRuntime
You can’t perform that action at this time.
0 commit comments