Setting Airflow context Environment variables for operators#47644
Merged
Conversation
2 tasks
Contributor
|
Can we add a test for this? |
Contributor
|
@prabhusneha can we please add some unit tests and also test with the dag that was originally provided in the bug report? |
ashb
reviewed
Mar 12, 2025
Contributor
Author
|
Added unit tests |
Contributor
Author
|
Fixing the failing CI checks |
Lee-W
reviewed
Mar 14, 2025
amoghrajesh
reviewed
Mar 14, 2025
1d32ff2 to
c30c4d8
Compare
amoghrajesh
reviewed
Mar 20, 2025
Contributor
|
There's a static check failure too: |
amoghrajesh
reviewed
Mar 21, 2025
amoghrajesh
reviewed
Mar 21, 2025
amoghrajesh
left a comment
Contributor
There was a problem hiding this comment.
Some nits about compat. Should fix the CI
Contributor
Author
|
@amoghrajesh Please take a look. CI checks are passing. |
Contributor
|
This will require a rebase, let me take a stab at that |
agupta01
pushed a commit
to agupta01/airflow
that referenced
this pull request
Mar 21, 2025
…7644) Co-authored-by: Sneha Prabhu <snehaprabhu@Snehas-MacBook-Pro.local> Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
shubham-pyc
pushed a commit
to shubham-pyc/airflow
that referenced
this pull request
Mar 22, 2025
…7644) Co-authored-by: Sneha Prabhu <snehaprabhu@Snehas-MacBook-Pro.local> Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Contributor
|
As per the description, now env variables are not printed in the logs explicitly as it was in AF2 but if user wants, they can print it using 'print(os.environ.get('AIRFLOW_CTX_DAG_OWNER'))' |
nailo2c
pushed a commit
to nailo2c/airflow
that referenced
this pull request
Apr 4, 2025
…7644) Co-authored-by: Sneha Prabhu <snehaprabhu@Snehas-MacBook-Pro.local> Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #46418
This change passes down the environment variables through context.
Testing:
DAG used:
We will now need to print/log the environment variables in the dag in Airflow 3. This PR only sets the airflow context environment variables.
Running the same DAG in Airflow 2.10.5, give the log as seen below: