@@ -64,6 +64,18 @@ pub struct TunerHolder {
6464 local_activity_slot_supplier : SlotSupplier ,
6565}
6666
67+ // pub fn set_task_locals_on_tuner<'a>(py: Python<'a>, tuner: &TunerHolder) -> PyResult<()> {
68+ // // TODO: All suppliers
69+ // if let SlotSupplier::Custom(ref cs) = tuner.workflow_slot_supplier {
70+ // Python::with_gil(|py| {
71+ // let py_obj = cs.inner.as_ref(py);
72+ // py_obj.call_method0("set_task_locals")?;
73+ // Ok(())
74+ // })?;
75+ // };
76+ // Ok(())
77+ // }
78+
6779#[ derive( FromPyObject ) ]
6880pub enum SlotSupplier {
6981 FixedSize ( FixedSizeSlotSupplier ) ,
@@ -217,6 +229,7 @@ impl<SK: SlotKind + Send + Sync> SlotSupplierTrait for CustomSlotSupplierOfType<
217229 . await ;
218230 match pypermit {
219231 Ok ( p) => {
232+ dbg ! ( "reserve done" , SK :: kind( ) ) ;
220233 return SlotSupplierPermit :: with_user_data ( p) ;
221234 }
222235 Err ( _) => {
@@ -274,6 +287,7 @@ impl<SK: SlotKind + Send + Sync> SlotSupplierTrait for CustomSlotSupplierOfType<
274287 }
275288
276289 fn release_slot ( & self , ctx : & dyn SlotReleaseContext < SlotKind = Self :: SlotKind > ) {
290+ dbg ! ( "release" , SK :: kind( ) ) ;
277291 if let Err ( e) = Python :: with_gil ( |py| {
278292 let permit = ctx
279293 . permit ( )
@@ -362,6 +376,8 @@ pub fn new_replay_worker<'a>(
362376impl WorkerRef {
363377 fn validate < ' p > ( & self , py : Python < ' p > ) -> PyResult < & ' p PyAny > {
364378 let worker = self . worker . as_ref ( ) . unwrap ( ) . clone ( ) ;
379+ // Set custom slot supplier task locals so they can run futures
380+ // match worker.get_config().tuner {}
365381 self . runtime . future_into_py ( py, async move {
366382 worker
367383 . validate ( )
0 commit comments