-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-4192] Remove obsolete/derived task context variables #5010
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5010 +/- ##
==========================================
- Coverage 75.76% 75.75% -0.01%
==========================================
Files 461 461
Lines 29955 29948 -7
==========================================
- Hits 22694 22688 -6
+ Misses 7261 7260 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #5010 +/- ##
=========================================
- Coverage 76.36% 76.3% -0.06%
=========================================
Files 471 471
Lines 30290 30313 +23
=========================================
Hits 23130 23130
- Misses 7160 7183 +23
Continue to review full report at Codecov.
|
KevinYang21
left a comment
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.
Don't have very strong opinion on whether to change the context like this but I think this worth a note in UPDATING.md.
|
I'd say some variables are debatable, e.g. if the PMCs have a very strong opinion about keeping However the values of Good point about the UPDATING.md, will add info there. |
|
@KevinYang21 I've updated UPDATING.md. Would be nice to have a PMC's opinion on this. |
|
Thanks for working on this @BasPH I believe that @bolkedebruin What was your plan with the |
|
@Fokko |
|
|
|
Indeed @BasPH. I would like to remove the |
|
sorry, I thought you remove the prev_ds and next_ds. For the yesterday_ds and tomrrow_ds, I am fine on removing it. |
|
I resolved @milton0825's question and once again the CI failed on 1 job with unrelated issues. Can somebody restart that job? |
|
@BasPH , I understand that we could compute the removed macro with some expressions. But I assume someone created those for convenience access. I am ok from my side, but could you send an email to the mailing list get some feedbacks from user as macros are used in users' DAG? Once there are no concern from the mailing list, we could commit the change. |
|
We need to note in UPDATING if we remove any variables - and can we change the title of this PR/Jira to reflect that too please? Edit: you've already got a note in UPDATING - not sure how I managed to miss that. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This PR makes several changes to the task context variables. I realise these are multiple changes, if you'd like me to split the PR into individual PRs, let me know.
Sorted the context variables alphabetically, both in the code & in the docs.
I think it's useful to pass a number of variables from which users can compute derived values, however wouldn't pass and the "main" variables and the derived variables. I'd leave deriving values from such "main" variables up to the user. Otherwise, we could start adding ds_nextweek, ds_nextmonth, ds_nextyear, etc. which I consider a task for the user. Hence, I removed such "derived" values:
yesterday_ds,yesterday_ds_nodash,tomorrow_ds,tomorrow_ds_nodash. IMO thenext_*andprevious_*variables are useful since these require complex logic to compute the next execution date, however would leave these variables up to the user since they are simple one-liners and don't relate to the DAG interval.tables. This is a field inparams, and is thus also accessible by the user ({{ params.tables }}). Also, it was undocumented.latest_date. It's the same asdsand was also undocumented.inletsandoutlets. Also undocumented, and have the inlets/outlets ever worked/ever been used by anybody?end_dateandEND_DATE. Both have the same value, so it doesn't make sense to have both variables. Also, the value isdswhich contains the start date of the interval, so the naming didn't make sense to me. However, if anybody argues in favour of adding "start_date" and "end_date" to provide the start and end datetime of task instance intervals, I'd be happy to add them.Grouped together statements computing similar variables (e.g. the statements building the
ds_*variables are now grouped together)Sidenote: in principle the
ds*andts*variables are also derivations from theexecution_date, however these are widely used and I also consider them useful.The remaining context variables are now:
{ 'conf': configuration, 'dag': task.dag, 'dag_run': dag_run, 'ds': ds, 'ds_nodash': ds_nodash, 'execution_date': self.execution_date, 'macros': macros, 'next_ds': next_ds, 'next_ds_nodash': next_ds_nodash, 'next_execution_date': next_execution_date, 'params': params, 'prev_ds': prev_ds, 'prev_ds_nodash': prev_ds_nodash, 'prev_execution_date': prev_execution_date, 'run_id': run_id, 'task': task, 'task_instance': self, 'task_instance_key_str': ti_key_str, 'test_mode': self.test_mode, 'ti': self, 'ts': ts, 'ts_nodash': ts_nodash, 'ts_nodash_with_tz': ts_nodash_with_tz, 'var': { 'json': VariableJsonAccessor(), 'value': VariableAccessor(), }, }Jira
Description
See above.
Tests
Only altered tests, no additions.
Commits
Documentation
Code Quality
flake8