You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ntnhaatj (via GitHub)" <gi...@apache.org> on 2023/08/19 11:52:42 UTC

[GitHub] [airflow] ntnhaatj commented on issue #25032: Dynamic Task Mapping - Depth-first execution

ntnhaatj commented on issue #25032:
URL: https://github.com/apache/airflow/issues/25032#issuecomment-1684926654

   Hi, I am not sure if it has been raised elsewhere yet, I would like to express here as it relates to the concept depth-first relationship I believe.
   
   In general, I would like to have control over the upstream / downstream dependency in a depth-first manner when using dynamic mapped task group as the issue owner.
   For instance, if I cleared the task `extract_file_2` along with its downstream, it should only clear its downstream only, which are `transform_file_2` and `load_file_2`. However, currently, it clears all downstream tasks, eg `transform_file_1`, `load_file_1`...
   
   example code:
   
   ```python
   from airflow.decorators import dag, task_group, task
   from airflow.operators.empty import EmptyOperator
   from pendulum import datetime
   
   files = ["a", "b", "c"]
   
   @dag(start_date=datetime(2022, 12, 1), schedule=None, catchup=False)
   def task_group_mapping_example():
       @task_group(group_id="etl")
       def etl_pipeline(file):
           e = EmptyOperator(task_id="e")
           t = EmptyOperator(task_id="t")
           l = EmptyOperator(task_id="l")
   
           e >> t >> l
   
       etl = etl_pipeline.expand(file=files)
       etl
   
   task_group_mapping_example()
   ```
   
   it affects all mapped index downstream tasks if I clear individual mapped task (`etl.e[1]`)
   <img width="877" alt="Screenshot 2023-08-19 at 18 46 42" src="https://github.com/apache/airflow/assets/35696768/dd110d7b-ecdf-4bcc-a466-a7d49b54ac87">
   


-- 
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