Skip to content

radical.asyncflow.utils

get_next_uid

get_next_uid()

Return the next unique component ID.

Source code in doc_env/lib/python3.14/site-packages/radical/asyncflow/utils.py
 9
10
11
def get_next_uid():
    """Return the next unique component ID."""
    return f"{next(_uid_counter):06d}"

get_event_loop_or_raise

get_event_loop_or_raise(context_name: str = 'AsyncWorkflowEngine') -> AbstractEventLoop

Get the current running event loop or raise a helpful error.

Parameters:

Name Type Description Default
context_name str

Name of the class/context for error messages

'AsyncWorkflowEngine'

Returns:

Type Description
AbstractEventLoop

asyncio.AbstractEventLoop: The current running event loop

Raises:

Type Description
RuntimeError

If no event loop is running with helpful guidance

Source code in doc_env/lib/python3.14/site-packages/radical/asyncflow/utils.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def get_event_loop_or_raise(
    context_name: str = "AsyncWorkflowEngine",
) -> asyncio.AbstractEventLoop:
    """Get the current running event loop or raise a helpful error.

    Args:
        context_name: Name of the class/context for error messages

    Returns:
        asyncio.AbstractEventLoop: The current running event loop

    Raises:
        RuntimeError: If no event loop is running with helpful guidance
    """
    try:
        return asyncio.get_running_loop()
    except RuntimeError as e:
        raise RuntimeError(
            f"{context_name} must be created within an async context. "
            f"Use 'await {context_name}.create(...)' from within an async function, "
            "or run within asyncio.run()."
        ) from e