agent0.utils.async_runner ========================= .. py:module:: agent0.utils.async_runner .. autoapi-nested-parse:: General utility function for running synchronous functions asynchronously. .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: agent0.utils.async_runner.R Functions --------- .. autoapisummary:: agent0.utils.async_runner.async_runner Module Contents --------------- .. py:data:: R .. py:function:: async_runner(funcs: Sequence[Callable[[], R]], return_exceptions: bool = False) -> list[R] :async: Helper function that runs a list of passed in functions asynchronously. NOTE: use `functools.partial()` to pass in arguments to the functions. WARNING: this assumes all functions passed in are thread safe, use at your own risk. :param funcs: List of functions to run asynchronously. :type funcs: list[Callable[[], R]] :param return_exceptions: If True, return exceptions from the functions. Otherwise, will throw exception if a thread fails. :type return_exceptions: bool :returns: List of results. :rtype: list[R] .. !! processed by numpydoc !!