Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

get_current_context was historically used from airflow.operators.python and the backcompat shim for it didnt exist. Adding the shim so that old dags like that can work.

DAG:


def print_hello():
    from airflow.operators.python import get_current_context
    context = get_current_context()
    print(context)

Works fine now.

image


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
@kaxil kaxil merged commit 59260fe into apache:main Apr 23, 2025
2 checks passed
@kaxil kaxil deleted the backcompat-for-get-current-context branch April 23, 2025 14:47
@kaxil kaxil added this to the Airflow 3.0.1 milestone Apr 23, 2025
@potiuk potiuk added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Apr 23, 2025
github-actions bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Apr 23, 2025
* Add backcompat shim for get_current_context

* use sdk!

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>

---------
(cherry picked from commit 59260fe)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
kaxil added a commit that referenced this pull request Apr 23, 2025
* Add backcompat shim for get_current_context

* use sdk!

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
(cherry picked from commit 59260fe)
prabhusneha pushed a commit to astronomer/airflow that referenced this pull request Apr 25, 2025
* Add backcompat shim for get_current_context

* use sdk!

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants