-
Notifications
You must be signed in to change notification settings - Fork 13.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
[AIRFLOW-6704] Copy common TaskInstance attributes from Task #7324
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cb355ca
[AIRFLOW-6704] Copy common TaskInstance attributes from Task
yuqian90 3ebbc17
Move refresh_from_task() into TaskInstance
yuqian90 3becae9
flake8
yuqian90 fd601d5
Add unit test for refresh_from_task
yuqian90 8a5fa08
isort
yuqian90 278638d
doc build fix
yuqian90 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
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.
Is it needed here if we call
self.refresh_from_db
immediately?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.
This is mostly trying to preserve the existing behavior and also move some duplicated code into
refresh_from_task()
. However, you are right that this part is not perfect:Ideally we should first call
refresh_from_db()
and then callrefresh_from_task()
. The call torefresh_from_db()
is to load those cumulative values such asself.try_number
andself.max_tries
from db so that individual runs of the task can increment these numbers. The call torefresh_from_task()
is to get those configurable values from the latest DAG definition. However at the momentrefresh_from_db()
is loading both cumulative values and configurable attributes. So it also sets configurable values such asself.queue
andself.operator
which are most likely more useful to be read from DAG definition viarefresh_task()
.This PR is not trying to fix everything. It only consolidate some duplicated code and make attributes such as
self.queue
andself.pool
update-able when tasks are cleared inclear_task_instances()
. It's probably worth a separate and bigger PR to make surerefresh_from_db()
is only reading those attributes that really should come from db and leave other attributes torefresh_from_task()
.