You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/21 21:33:28 UTC
[GitHub] [airflow] ashb opened a new pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
ashb opened a new pull request #11732:
URL: https://github.com/apache/airflow/pull/11732
It was possible to "block" the scheduler such that it would not schedule or queue tasks for a dag if you triggered a DAG run when the DAG was already at the max active runs.
This approach works around the problem for now, but a better longer term fix for this would be to introduce a "queued" state for DagRuns, and then when manually creating dag runs (or clearing) set it to queued, and only have the scheduler set DagRuns to running, nothing else -- this would mean we wouldn't need to examine active runs in the TI part of the scheduler loop, only in DagRun creation part.
Fixes #11582.
(Depends on/will conflict with #11730, so already based on that commit. Please ignore first commit when reviewing)
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#issuecomment-714651884
[The Workflow run](https://github.com/apache/airflow/actions/runs/322557952) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on a change in pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#discussion_r510068292
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1640,11 +1652,13 @@ def _schedule_dag_run(self, dag_run: DagRun, currently_active_runs: int, session
return 0
if dag.max_active_runs:
- if currently_active_runs >= dag.max_active_runs:
+ if len(currently_active_runs) >= dag.max_active_runs and \
+ dag_run.execution_date not in currently_active_runs:
self.log.info(
Review comment:
With this change it should happen a lot lot less anyway, but yes, or we fix it properly:
> This approach works around the problem for now, but a better longer term fix for this would be to introduce a "queued" state for DagRuns, and then when manually creating dag runs (or clearing) set it to queued, and only have the scheduler set DagRuns to running, nothing else -- this would mean we wouldn't need to examine active runs in the TI part of the scheduler loop, only in DagRun creation part.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#issuecomment-715199748
One error code 137, one mysql deadlock issue. Other matrix jobs passed so I'm merging this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#issuecomment-713899295
[The Workflow run](https://github.com/apache/airflow/actions/runs/320797006) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] kaxil commented on a change in pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#discussion_r510066955
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1640,11 +1652,13 @@ def _schedule_dag_run(self, dag_run: DagRun, currently_active_runs: int, session
return 0
if dag.max_active_runs:
- if currently_active_runs >= dag.max_active_runs:
+ if len(currently_active_runs) >= dag.max_active_runs and \
+ dag_run.execution_date not in currently_active_runs:
self.log.info(
Review comment:
not needed for this PR but should we change this to DEBUG as I remember it was a bit spammy
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb merged pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
ashb merged pull request #11732:
URL: https://github.com/apache/airflow/pull/11732
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #11732: Ensure that manually creating a DAG run doesn't "block" the scheduler
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11732:
URL: https://github.com/apache/airflow/pull/11732#issuecomment-714652377
[The Workflow run](https://github.com/apache/airflow/actions/runs/322558253) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org