def get_root_execution(execution_db):
    """Recursively ascends until the root action execution is found

    Useful for finding an original parent workflow. Pass in any ActionExecutionDB instance,
    and this function will eventually return the top-most action execution, even if the two
    are one and the same.

    :param execution_db: The ActionExecutionDB instance for which to find the root parent.
    :rtype: ActionExecutionDB
    """

    parent_execution_db = get_parent_execution(execution_db)

    return (
        get_root_execution(parent_execution_db) if parent_execution_db else execution_db
    )
Recursively ascends until the root action execution is found

    Useful for finding an original parent workflow. Pass in any ActionExecutionDB instance,
    and this function will eventually return the top-most action execution, even if the two
    are one and the same.

    :param execution_db: The ActionExecutionDB instance for which to find the root parent.
    :rtype: ActionExecutionDB
    
st2common/st2common/services/action.py