-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
[AIRFLOW-5390] Remove provide context #5990
Conversation
…provide-context-removed
…provide-context-removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea!
I'd like to see expanded tests on this, as I think this might break op_kwargs a bit. For example this would print 1
before, but now I think will print something else.
PythonOperator(
op_kwargs={'dag': 1},
python_callable: lambda dag: print(dag)
)
This needs a note in UPDATING.md too saying how it works.
I think if we leave (but ignore/warn about) provide_context
we could make this mostly a non-breaking change which makes our users' lives easier when upgrading
Another example: what happens if I do: def fn(dag, **context):
print(dag)
PythonOperator(
op_args=[1],
python_callable=fn
) |
Thanks @ashb for thinking along. Appreciate it. I've added the tests to the suite. I think we can fix the one with the op_args by skipping the first
|
Everything is green now Changed the behavior. This following snippet will throw an exception now, since
Otherwise it might become very confusing when you change the |
…provide-context-removed
…provide-context-removed
Codecov Report
@@ Coverage Diff @@
## master #5990 +/- ##
==========================================
- Coverage 80.02% 79.91% -0.11%
==========================================
Files 594 594
Lines 34769 34794 +25
==========================================
- Hits 27824 27807 -17
- Misses 6945 6987 +42
Continue to review full report at Codecov.
|
I am not sure if it has sufficient documentation. Could you check that the documentation in the This is very well described in the |
Awesome work @Fokko |
Make sure you have checked all steps below.
I'm giving Apache Airflow training across Europe, and at every workshop that I provide, I find it a bit awkward to introduce the idea of the provide_context. Instead, I want to remove this thing and make it infer the variables automagically based on the signature of the Python callable. Less is more in terms of the public API :-)
Jira
Description
Tests
Commits
Documentation
Code Quality
flake8