You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/30 17:40:44 UTC

[GitHub] [airflow] MatrixManAtYrService opened a new issue #19899: Task group entry/exits hide task dependency

MatrixManAtYrService opened a new issue #19899:
URL: https://github.com/apache/airflow/issues/19899


   ### 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:
   ```python3
   from datetime import datetime, timedelta
   from time import sleep
   ​
   from airflow.decorators import task, task_group
   from airflow.models.dag import DAG
   from airflow.operators.dummy import DummyOperator
   from airflow.utils.task_group import TaskGroup
   from airflow.utils.trigger_rule import TriggerRule
   ​
   two_days = datetime.now() - timedelta(days=2)
   ​
   ​
   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="downlow_tooslow",
       schedule_interval=None,
       start_date=two_days,
   ) 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).
   
   <img width="427" alt="Screen Shot 2021-11-29 at 1 47 45 PM" src="https://user-images.githubusercontent.com/5834582/144097666-5d774bea-b97d-4cd9-9081-bccf787535f5.png">
   
   
   ### 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
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org