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 2022/08/04 04:13:49 UTC

[GitHub] [airflow] josh-fell opened a new issue, #25523: Mapped, classic operator tasks within TaskGroups prepend `group_id` in Graph View

josh-fell opened a new issue, #25523:
URL: https://github.com/apache/airflow/issues/25523

   ### Apache Airflow version
   
   main (development)
   
   ### What happened
   
   When mapped, classic operator tasks exist within TaskGroups, the `group_id` of the TaskGroup is prepended to the displayed `task_id` in the Graph View.
   
   In the below screenshot, all displayed task IDs only contain the direct `task_id` except for the "mapped_classic_task". This particular task is a mapped `BashOperator` task. The prepended `group_id` does not appear for unmapped, classic operator tasks, nor mapped and unmapped TaskFlow tasks.
   
   <img width="1440" alt="image" src="https://user-images.githubusercontent.com/48934154/182760586-975a7886-bcd6-477d-927b-25e82139b5b7.png">
   
   
   ### What you think should happen instead
   
   The pattern of the displayed task names should be consistent for all task types (mapped/unmapped, classic operators/TaskFlow functions). Having the `group_id` prepended to the mapped, classic operator tasks is a little redundant and less readable.
   
   ### How to reproduce
   
   1. Use an example DAG of the following:
   
   ```python
   from pendulum import datetime
   
   from airflow.decorators import dag, task, task_group
   from airflow.operators.bash import BashOperator
   
   
   @dag(start_date=datetime(2022, 1, 1), schedule_interval=None)
   def task_group_task_graph():
       @task_group
       def my_task_group():
           BashOperator(task_id="not_mapped_classic_task", bash_command="echo")
           BashOperator.partial(task_id="mapped_classic_task").expand(
               bash_command=["echo", "echo hello", "echo world"]
           )
   
           @task
           def another_task(input=None):
               ...
   
           another_task.override(task_id="not_mapped_taskflow_task")()
           another_task.override(task_id="mapped_taskflow_task").expand(input=[1, 2, 3])
   
       my_task_group()
   
   
   _ = task_group_task_graph()
   ```
   2. Navigate to the Graph view
   3. Notice that the `task_id` for the "mapped_classic_task" prepends the TaskGroup `group_id` of "my_task_group" while the other tasks in the TaskGroup do not.
   
   ### Operating System
   
   Debian GNU/Linux
   
   ### Versions of Apache Airflow Providers
   
   N/A
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   Breeze
   
   ### Anything else
   
   Setting `prefix_group_id=False` for the TaskGroup does remove the prepended `group_id` from the tasks display name.
   
   ### 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.apache.org

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


[GitHub] [airflow] josh-fell commented on issue #25523: Mapped, classic operator tasks within TaskGroups prepend `group_id` in Graph View

Posted by GitBox <gi...@apache.org>.
josh-fell commented on issue #25523:
URL: https://github.com/apache/airflow/issues/25523#issuecomment-1205465772

   I take it back, I'd be happy to submit a PR. 
   
   However, I did a cursory check trying to find where this is coming from, but it wasn't apparent for me. If someone would provide some pointers, I'd be forever in your debt.


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


[GitHub] [airflow] bbovenzi closed issue #25523: Mapped, classic operator tasks within TaskGroups prepend `group_id` in Graph View

Posted by GitBox <gi...@apache.org>.
bbovenzi closed issue #25523: Mapped, classic operator tasks within TaskGroups prepend `group_id` in Graph View
URL: https://github.com/apache/airflow/issues/25523


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


[GitHub] [airflow] pierrejeambrun commented on issue #25523: Mapped, classic operator tasks within TaskGroups prepend `group_id` in Graph View

Posted by GitBox <gi...@apache.org>.
pierrejeambrun commented on issue #25523:
URL: https://github.com/apache/airflow/issues/25523#issuecomment-1205665723

   Hello @josh-fell,
   
   From the [documentation](https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html), I expect all of them to have the group_id prefix:
   > By default, child tasks/TaskGroups have their IDs prefixed with the group_id of their parent TaskGroup. This helps to ensure uniqueness of group_id and task_id throughout the DAG.
   >
   >To disable the prefixing, pass prefix_group_id=False when creating the TaskGroup, but note that you will now be responsible for ensuring every single task and group has a unique ID of its own.
   
   
   
   I think the graph is drawn with d3 in `airflow/www/static/js/graph.js` targeting the `graph-svg` element.
   
   There might be 2 different issues:
   - When looking at the data passed to the template `graph.html`, especially the `tasks` variable, and the results from successive ajax call (refetch on `/object/task_instances?dag_id=task_group_task_graph&execution_date...`) both show the same data, see the picture below. It looks like all have the `group_id` prefix except the `mapped_taskflow_task`.
   ![image](https://user-images.githubusercontent.com/14861206/182931536-fc5c14e3-6431-4f7f-b5ef-9025babafa6a.png)
   
       **Why are the label displayed for `not_mapped_classic_task` and `not_mapped_taskflow_task` different from what we see in this payload** (the group_id is not here anymore).
   
   - The id for the `mapped_taskflow_task` does not have the group_id prefix, this might be a more specific problem to the taskflow decorators. (I'm not sure here)
   
   _Note: I tried without overriding the task_id, and the same issue appears_
   


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