Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Call scheduler "book-keeping" operations less frequently.#12139

Merged
ashb merged 2 commits intoapache:masterfrom
astronomer:regularly-check-dead-schedulers
Nov 9, 2020
Merged

Call scheduler "book-keeping" operations less frequently.#12139
ashb merged 2 commits intoapache:masterfrom
astronomer:regularly-check-dead-schedulers

Conversation

@ashb
Copy link
Member

@ashb ashb commented Nov 6, 2020

This change makes it so that certain operations in the scheduler are
called on a regular interval, instead of only once at start up, or every
time around the loop:

  • adopt_or_reset_orphaned_tasks (detecting SchedulerJobs that died) was
    previously only called on start up.
  • _clean_tis_without_dagrun was previously called every time around the
    scheduling loop, but this isn't so needed to be done every time as
    this is a relatively rare cleanup operation
  • _emit_pool_metrics doesn't need to be called every time around the
    loop, once every 5 seconds is enough.

This uses the built in "sched" module to handle the "timers".


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@ashb ashb added the full tests needed We need to run full set of tests for this PR to merge label Nov 6, 2020
@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label Nov 6, 2020
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write a guides that describes these configuration options and allows us to familiarize ourselves with these options? The referee documentation is great because it lists all the options, but it's not good documentation for beginners.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #12193 so we do this before 2.0.0

@ashb ashb added this to the Airflow 2.0.0-beta1 milestone Nov 7, 2020
ashb added 2 commits November 8, 2020 23:15
This change makes it so that certain operations in the scheduler are
called on a regular interval, instead of only once at start up, or every
time around the loop:

- adopt_or_reset_orphaned_tasks (detecting SchedulerJobs that died) was
  previously only called on start up.
- _clean_tis_without_dagrun was previously called every time around the
  scheduling loop, but this isn't so needed to be done every time as
  this is a relatively rare cleanup operation
- _emit_pool_metrics doesn't need to be called _every_ time around the
  loop, once every 5 seconds is enough.

This uses the built in ["sched" module][sched] to handle the "timers".

[sched]: https://docs.python.org/3/library/sched.html
@ashb ashb force-pushed the regularly-check-dead-schedulers branch from e63b469 to 3005ca8 Compare November 8, 2020 23:15
@ashb ashb merged commit 92e405e into apache:master Nov 9, 2020
@ashb ashb deleted the regularly-check-dead-schedulers branch November 9, 2020 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants