-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Extend the same keyword arguments callable support in PythonOperator to some other sensors/operators #11922
Conversation
PythonOperator
to ExternalTaskSensor
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
274ac83
to
6910356
Compare
6910356
to
de40a51
Compare
It is a backward compatible change? |
It's backward compatible with all existing usage except this one:
I.e. if
I'll add this to UPDATING.md. |
7902154
to
7b6ac9c
Compare
7b6ac9c
to
72999cf
Compare
The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it! |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
- Use determine_kwargs in python.py - Use make_kwargs_callable in external_task_sensor.py
I'm tempted to merge this anyway -- most tests are passing. |
Fixes failing import problem of the http backport provider with Airflow 1.10.* series. A problem was introduced in apache#11922 which cause the http provider to stop working (local import was not caught at the review time and as local import it has not been caught by the test harness). Since the http provider is defunct and is very popular, we decided to release an out-of-band release of the http provider even if backport providers reached end-of-life. This PR copies implementation of make_kwargs_callable into http backport provider to deal with the incompatibility. Fixes: apache#15198
Fixes failing import problem of the http backport provider with Airflow 1.10.* series. A problem was introduced in #11922 which cause the http provider to stop working (local import was not caught at the review time and as local import it has not been caught by the test harness). Since the http provider is defunct and is very popular, we decided to release an out-of-band release of the http provider even if backport providers reached end-of-life. This PR copies implementation of make_kwargs_callable into http backport provider to deal with the incompatibility. Fixes: #15198
PythonOperator
,PythonSensor
,ExternalTaskSensor
,SimpleHttpOperator
andHttpSensor
.PythonOperator
have been refactored intoairflow.utils.helper.make_kwargs_callable
. And it's used in those other places to make them work the same way.PythonOperator
andPythonSensor
already acceptpython_callable
in this form, i.e. the callable can request any number of named arguments incontext
:However,
ExternalTaskSensor
and some other sensors/operator accepts only callables in this form:A more recent change #8702 added support for this form as well:
Unfortunately, #8702 introduced an unpleasant side-effect. Because it enforces the number of arguments is either 1 or 2, it stops people from using common techniques such as loop variable capturing. E.g. this comment illustrate a problem: https://github.com/apache/airflow/pull/8702/files#r497897460
This PR addresses these problems by making
execution_date_fn
work the same way aspython_callable
.execution_date_fn
is now much more flexible. It can accept any variable number of keyword arguments fromcontext
. The change is backward compatible. Existing usage continues to work.E.g. the following callables are all legitimate execution_date_fn after this PR: