-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-6863] Make airflow/task and airflow/ti_deps pylint compatible #7482
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
Merged
kaxil
merged 1 commit into
apache:master
from
PolideaInternal:AIRFLOW-6863-pylint-ti-deps
Feb 21, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| from airflow.ti_deps.deps.dag_ti_slots_available_dep import DagTISlotsAvailableDep | ||
| from airflow.ti_deps.deps.dag_unpaused_dep import DagUnpausedDep | ||
| from airflow.ti_deps.deps.dagrun_exists_dep import DagrunRunningDep | ||
| from airflow.ti_deps.deps.dagrun_id_dep import DagrunIdDep | ||
| from airflow.ti_deps.deps.exec_date_after_start_date_dep import ExecDateAfterStartDateDep | ||
| from airflow.ti_deps.deps.pool_slots_available_dep import PoolSlotsAvailableDep | ||
| from airflow.ti_deps.deps.runnable_exec_date_dep import RunnableExecDateDep | ||
| from airflow.ti_deps.deps.task_concurrency_dep import TaskConcurrencyDep | ||
| from airflow.ti_deps.deps.task_not_running_dep import TaskNotRunningDep | ||
| from airflow.ti_deps.deps.valid_state_dep import ValidStateDep | ||
| from airflow.utils.state import State | ||
|
|
||
| # In order to be able to get queued a task must have one of these states | ||
| SCHEDULEABLE_STATES = { | ||
| State.NONE, | ||
| State.UP_FOR_RETRY, | ||
| State.UP_FOR_RESCHEDULE, | ||
| } | ||
|
|
||
| RUNNABLE_STATES = { | ||
| # For cases like unit tests and run manually | ||
| State.NONE, | ||
| State.UP_FOR_RETRY, | ||
| State.UP_FOR_RESCHEDULE, | ||
| # For normal scheduler/backfill cases | ||
| State.QUEUED, | ||
| } | ||
|
|
||
| QUEUEABLE_STATES = { | ||
| State.SCHEDULED, | ||
| } | ||
|
|
||
| BACKFILL_QUEUEABLE_STATES = { | ||
| # For cases like unit tests and run manually | ||
| State.NONE, | ||
| State.UP_FOR_RESCHEDULE, | ||
| State.UP_FOR_RETRY, | ||
| # For normal backfill cases | ||
| State.SCHEDULED, | ||
| } | ||
|
|
||
| # Context to get the dependencies that need to be met in order for a task instance to be | ||
| # set to 'scheduled' state. | ||
| SCHEDULED_DEPS = { | ||
| RunnableExecDateDep(), | ||
| ValidStateDep(SCHEDULEABLE_STATES), | ||
| TaskNotRunningDep(), | ||
| } | ||
|
|
||
| # Dependencies that if met, task instance should be re-queued. | ||
| REQUEUEABLE_DEPS = { | ||
| DagTISlotsAvailableDep(), | ||
| TaskConcurrencyDep(), | ||
| PoolSlotsAvailableDep(), | ||
| } | ||
|
|
||
| # Dependencies that need to be met for a given task instance to be set to 'RUNNING' state. | ||
| RUNNING_DEPS = { | ||
| RunnableExecDateDep(), | ||
| ValidStateDep(RUNNABLE_STATES), | ||
| DagTISlotsAvailableDep(), | ||
| TaskConcurrencyDep(), | ||
| PoolSlotsAvailableDep(), | ||
| TaskNotRunningDep(), | ||
| } | ||
|
|
||
| BACKFILL_QUEUED_DEPS = { | ||
| RunnableExecDateDep(), | ||
| ValidStateDep(BACKFILL_QUEUEABLE_STATES), | ||
| DagrunRunningDep(), | ||
| TaskNotRunningDep(), | ||
| } | ||
|
|
||
| # TODO(aoen): SCHEDULER_QUEUED_DEPS is not coupled to actual scheduling/execution | ||
| # in any way and could easily be modified or removed from the scheduler causing | ||
| # this dependency to become outdated and incorrect. This coupling should be created | ||
| # (e.g. via a dag_deps analog of ti_deps that will be used in the scheduler code, | ||
| # or allow batch deps checks) to ensure that the logic here is equivalent to the logic | ||
| # in the scheduler. | ||
| # Right now there's one discrepancy between this context and how scheduler schedule tasks: | ||
| # Scheduler will check if the executor has the task instance--it is not possible | ||
| # to check the executor outside scheduler main process. | ||
|
|
||
| # Dependencies that need to be met for a given task instance to be set to 'queued' state | ||
| # by the scheduler. | ||
| # This context has more DEPs than RUNNING_DEPS, as we can have task triggered by | ||
| # components other than scheduler, e.g. webserver. | ||
| SCHEDULER_QUEUED_DEPS = { | ||
| RunnableExecDateDep(), | ||
| ValidStateDep(QUEUEABLE_STATES), | ||
| DagTISlotsAvailableDep(), | ||
| TaskConcurrencyDep(), | ||
| PoolSlotsAvailableDep(), | ||
| DagrunRunningDep(), | ||
| DagrunIdDep(), | ||
| DagUnpausedDep(), | ||
| ExecDateAfterStartDateDep(), | ||
| TaskNotRunningDep(), | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Yes, we had cyclic import...
Cyclic import (airflow.ti_deps.dep_context -> airflow.ti_deps.deps.dag_unpaused_dep -> airflow.ti_deps.deps.base_ti_dep) (cyclic-import)