@@ -1522,31 +1522,35 @@ def init(self) -> None:
15221522 """Override this method to add initialization logic."""
15231523 pass
15241524
1525- def run (self , body : Any , path : str ) -> Any :
1525+ def run (self , body : Any , path : str , origin_name : Optional [ str ] = None ) -> Any :
15261526 """
15271527 Override this method with the code this runnable should run. If execution_mechanism is "asyncio", override
15281528 run_async() instead.
15291529
15301530 :param body: Event body
15311531 :param path: Event path
1532+ :param origin_name: Name of the runnable that initiated this run, if applicable.
1533+ Use especially when this runnable is shared between multiple parallel executions.
15321534 """
15331535 return body
15341536
1535- async def run_async (self , body : Any , path : str ) -> Any :
1537+ async def run_async (self , body : Any , path : str , origin_name : Optional [ str ] = None ) -> Any :
15361538 """
15371539 If execution_mechanism is "asyncio", override this method with the code this runnable should run. Otherwise,
15381540 override run() instead.
15391541
15401542 :param body: Event body
15411543 :param path: Event path
1544+ :param origin_name: Name of the runnable that initiated this run, if applicable.
1545+ Use especially when this runnable is shared between multiple parallel executions.
15421546 """
15431547 return body
15441548
15451549 def _run (self , body : Any , path : str , origin_name : Optional [str ] = None ) -> Any :
15461550 timestamp = datetime .datetime .now (tz = datetime .timezone .utc )
15471551 start = time .monotonic ()
15481552 try :
1549- body = self .run (body , path )
1553+ body = self .run (body , path , origin_name )
15501554 except Exception as e :
15511555 if self ._raise_exception :
15521556 raise e
@@ -1559,7 +1563,7 @@ async def _async_run(self, body: Any, path: str, origin_name: Optional[str] = No
15591563 timestamp = datetime .datetime .now (tz = datetime .timezone .utc )
15601564 start = time .monotonic ()
15611565 try :
1562- body = await self .run_async (body , path )
1566+ body = await self .run_async (body , path , origin_name )
15631567 except Exception as e :
15641568 if self ._raise_exception :
15651569 raise e
0 commit comments