Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dag_id and map_index to the default template variables #40958

Open
1 of 2 tasks
pedro-cf opened this issue Jul 23, 2024 · 6 comments
Open
1 of 2 tasks

Add dag_id and map_index to the default template variables #40958

pedro-cf opened this issue Jul 23, 2024 · 6 comments
Labels
airflow3.0:candidate Potential candidates for Airflow 3.0 area:core area:core-operators Operators, Sensors and hooks within Core Airflow kind:feature Feature Requests
Milestone

Comments

@pedro-cf
Copy link

pedro-cf commented Jul 23, 2024

Description

Add dag_id and map_index as default variables to the template variables (accessible via task parameters).

Use case/motivation

Generally useful and specifically easier access to these variables within operators that have serialization issues with the dag_run and ti objects, such as the PythonVirtualEnvOperator.

Related issues

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@pedro-cf pedro-cf added kind:feature Feature Requests needs-triage label for new issues that we didn't triage yet labels Jul 23, 2024
@shahar1
Copy link
Contributor

shahar1 commented Jul 26, 2024

  1. Is it a feature suggestion, or a suggestion for improving the documentation?
    Please clarify the description - it would also be useful to provide some code examples that will explain the motivation.
  2. Is this PR a recreation of Add 'dag_id' and 'dag_run_id' to the default template variables #40859? Why was the latter closed?

@pedro-cf
Copy link
Author

  1. Is it a feature suggestion, or a suggestion for improving the documentation?

Please clarify the description - it would also be useful to provide some code examples that will explain the motivation.

  1. Is this PR a recreation of Add 'dag_id' and 'dag_run_id' to the default template variables #40859? Why was the latter closed?
  1. Feature Request/Suggestion. I believe I give a solid reason:

Generally useful and specifically easier access to these variables within operators that have serialization issues with the dag_run and ti objects, such as the PythonVirtualEnvOperator.

  1. Different variables in this issue.

@shahar1 shahar1 changed the title Add dag_id and map_index as default variables to https://airflow.apache.org/docs/apache-airflow/stable/templates-ref.html Add dag_id and map_index to the default template variables Jul 26, 2024
@shahar1
Copy link
Contributor

shahar1 commented Jul 26, 2024

  1. Is it a feature suggestion, or a suggestion for improving the documentation?

Please clarify the description - it would also be useful to provide some code examples that will explain the motivation.

  1. Is this PR a recreation of Add 'dag_id' and 'dag_run_id' to the default template variables #40859? Why was the latter closed?
  1. Feature Request/Suggestion. I believe I give a solid reason:

Generally useful and specifically easier access to these variables within operators that have serialization issues with the dag_run and ti objects, such as the PythonVirtualEnvOperator.

  1. Different variables in this issue.

There's currently an open PR (#41039) for solving #34158. When this PR is merged, will there still be a justification for the suggested feature?

@shahar1 shahar1 added area:core area:core-operators Operators, Sensors and hooks within Core Airflow labels Jul 26, 2024
@pedro-cf
Copy link
Author

There's currently an open PR (#41039) for solving #34158. When this PR is merged, will there still be a justification for the suggested feature?

I believe so, these are key variables, more important than some of the variables already available.
It's also a much cleaner way to access these directly.

@shahar1 shahar1 removed pending-response needs-triage label for new issues that we didn't triage yet labels Jul 26, 2024
@uranusjr
Copy link
Member

I wonder if we should try to add some more, and remove ti and dag_run altogether. Exposing those objects directly to the user is kind of problematic.

Or, maybe we should make those a proxy instead of the actual object, and remove things like task_id and run_id.

@uranusjr uranusjr added this to the Airflow 3.0.0 milestone Jul 31, 2024
@uranusjr
Copy link
Member

Adding this to 3.0 since I think we need something to track the discussion. I’m not particularly in favour or disfavour to the exact solution proposed here.

@kaxil kaxil added the airflow3.0:candidate Potential candidates for Airflow 3.0 label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
airflow3.0:candidate Potential candidates for Airflow 3.0 area:core area:core-operators Operators, Sensors and hooks within Core Airflow kind:feature Feature Requests
Projects
None yet
Development

No branches or pull requests

4 participants