[AIRFLOW-777] Fix expression to check if a DagRun is in running state
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/2d2d6270 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/2d2d6270 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/2d2d6270 Branch: refs/heads/v1-8-test Commit: 2d2d6270ad6bf6052c3efe90100740d3470c0cd1 Parents: 1a801cc Author: George Sakkis <[email protected]> Authored: Sat Jan 21 15:06:43 2017 +0200 Committer: George Sakkis <[email protected]> Committed: Sun Jan 22 14:55:48 2017 +0200 ---------------------------------------------------------------------- airflow/jobs.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/2d2d6270/airflow/jobs.py ---------------------------------------------------------------------- diff --git a/airflow/jobs.py b/airflow/jobs.py index f1de333..8bb93bb 100644 --- a/airflow/jobs.py +++ b/airflow/jobs.py @@ -919,13 +919,7 @@ class SchedulerJob(BaseJob): task_instance.execution_date, dag_runs)) - dag_is_running = True - for dag_run in dag_runs: - if dag_run.state == State.RUNNING: - dag_is_running = True - break - - if not dag_is_running: + if not any(dag_run.state == State.RUNNING for dag_run in dag_runs): self.logger.warn("Setting {} to state={} as it does not have " "a DagRun in the {} state" .format(task_instance,
