Beispiel #1
0
def _track_function(function):
    if not _is_function(function):
        return

    decorated_function = task(function)

    # We modify all modules since each module has its own pointers to local and imported functions.
    # If a module has already imported the function we need to change the pointer in that module.
    for module in sys.modules.copy().values():
        if not _is_module(module):
            continue

        for k, v in module.__dict__.items():
            if v is function:
                module.__dict__[k] = decorated_function
Beispiel #2
0
def track_python_operator(operator):
    if isinstance(operator.python_callable, DbndFuncProxy):
        # function already has @task
        return

    operator.python_callable = task(operator.python_callable)
Beispiel #3
0
def track_python_operator(operator):
    if isinstance(operator.python_callable, _decorated_user_func):
        # function already has @task
        return

    operator.python_callable = task(operator.python_callable)
Beispiel #4
0
def tasks_within_tasks():
    task(1)
    task(2)