airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Task group entry/exits hide task dependency

Open MatrixManAtYrService opened this issue 4 years ago • 2 comments

Apache Airflow version

2.2.2 (latest released)

Operating System

debian buster (docker)

Versions of Apache Airflow Providers

n/a

Deployment

Astronomer

Deployment details

This dag:

def waiter(secs):
    @task(task_id=str(secs))
    def wait():
        sleep(secs)
    return wait()
​
@task_group
def two():
    t1 = waiter(60)
    t2 = waiter(65)
    bookend = DummyOperator(task_id="bookend")
    [t1, t2] >> bookend
    return bookend
​
with DAG(
    dag_id="hidden_dep",
    schedule_interval=None,
) as dag:
​
    # based on the dag image, you'd expect this task group finish last,
    # since it has a 100 second task
    with TaskGroup(group_id="group1") as tg1:
        t1 = waiter(5)
        t50 = waiter(100)
​
    # but actually, the blue dot at the end of the group means nothing
    # the dummy below runs after just five seconds
    tg2 = two()

    [tg1, tg2] >> DummyOperator(task_id="done", trigger_rule=TriggerRule.ONE_SUCCESS)

Which looks like this after running for 10 seconds (the numbers refer to seconds that the task will sleep).

Screen Shot 2021-11-29 at 1 47 45 PM

What happened

The "done" task ran after 5 seconds.

What you expected to happen

The graph view leads me to believe that the two things that are upstream of "done" are:

  • group1
  • two

Based on that image, I would expect "done" to run after 65 seconds, which is when the "two" task group is complete.

How to reproduce

No response

Anything else

I know that it will make several dags out there uglier, but unless we want to make task-group entry/exit points into tasks (complete with their own trigger rules) I think the fix is to remove the blue dots entirely so that we avoid misleading the user about task dependency.

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

MatrixManAtYrService avatar Nov 30 '21 17:11 MatrixManAtYrService

Screenshot 2023-03-14 at 4 20 20 PM

@MatrixManAtYrService Does this updated graph view, with a smaller join node, make more sense to you?

bbovenzi avatar Mar 14 '23 20:03 bbovenzi

This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.

github-actions[bot] avatar Dec 19 '24 09:12 github-actions[bot]

This issue has been closed because it has not received response from the issue author.

github-actions[bot] avatar Jan 20 '25 07:01 github-actions[bot]