worker: add options to finish work before shutdown; extend or turn off forced shutdown timeout #104272

Closed
viktorasm wants to merge 7 commits from viktorasm/flamenco:brainstorm-autoscaling-features into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

This changes shutdown behavior of workers slightly:

  • when using --finish-work-before-shutdown flag, SIGINT and SIGTERM signals will no longer cancel worker context. Instead, they serve as advice for worker to enter shutdown mode - finish all work and exit; this feature will cooperate with forced shutdown timeout.
  • forced shutdown timeout is now configurable via --forced-shutdown-timeout, and, if set to 0, turns off forcefull shutdown feature. Operating system can still kill the process forcefully.
  • default behavior is backwards compatible, though it would result in simpler code if some things were made into new defaults, e.g. worker should probably ALWAYS finish in-progress work before agreeing to terminate on SIGTERM.
This changes shutdown behavior of workers slightly: * when using `--finish-work-before-shutdown` flag, SIGINT and SIGTERM signals will no longer cancel worker context. Instead, they serve as advice for worker to enter shutdown mode - finish all work and exit; this feature will cooperate with forced shutdown timeout. * forced shutdown timeout is now configurable via `--forced-shutdown-timeout`, and, if set to 0, turns off forcefull shutdown feature. Operating system can still kill the process forcefully. * default behavior is backwards compatible, though it would result in simpler code if some things were made into new defaults, e.g. worker should probably ALWAYS finish in-progress work before agreeing to terminate on SIGTERM.
viktorasm added 7 commits 2023-12-15 15:45:48 +01:00

Please don't send in pull requests, unless they are fixing a bug or adding a feature for which the design has been approved. Writing code before design/approach approval is at your own risk, as the entire approach taken could be rejected.

Please don't send in pull requests, unless they are fixing a bug or adding a feature for which the design has been approved. Writing code before design/approach approval is at your own risk, as the entire approach taken could be rejected.
Author
First-time contributor

Please don't send in pull requests, unless they are fixing a bug or adding a feature for which the design has been approved. Writing code before design/approach approval is at your own risk, as the entire approach taken could be rejected.

Point taken. The code is part of a personal experiment, without building a proof-of-concept would be very hard to propose a final design. No expectations this will be accepted to main repo, just wanted to test the waters now versus doing that later.

> Please don't send in pull requests, unless they are fixing a bug or adding a feature for which the design has been approved. Writing code before design/approach approval is at your own risk, as the entire approach taken could be rejected. Point taken. The code is part of a personal experiment, without building a proof-of-concept would be very hard to propose a final design. No expectations this will be accepted to main repo, just wanted to test the waters now versus doing that later.
viktorasm closed this pull request 2023-12-18 08:55:45 +01:00

You're of course completely free to do whatever you want with your time ;-)

Sending in a PR to an official repository does send a more specific signal, though, so that's what I was responding to.

You're of course completely free to do whatever you want with your time ;-) Sending in a PR to an official repository does send a more specific signal, though, so that's what I was responding to.

Pull request closed

Sign in to join this conversation.
No description provided.