Closed fsteggink closed 3 years ago
I think the Runner needs a different approach. Although Paver is called, the Runner is in fact a regular Python program with a main()
started in the module scheduler.py (runner.py
would have been better name). The scheduler
basically uses the PyPi library apscheduler
for per-Resource scheduling.
Regular Python signal
handling could do the trick, though a slight difference when the Runner runs in the webapp.
See e.g.
https://stackoverflow.com/questions/24520969/apscheduler-will-not-stop, the answer at the bottom, something like:
Out of my head:
import signal
.
.
def catch_signal(signum, frame):
LOGGER.info('Stopping Scheduler on signal {}'.format(signum))
stop_schedule()
signal.signal(signal.SIGINT, catch_signal)
signal.signal(signal.SIGTERM, catch_signal)
might do it stop_schedule()
is within scheduler
module.
Ok, thanks @fsteggink !
This PR only prepends
exec
before thegunicorn
command, resulting in the ghc_web Docker container being shut down much faster. No solution for the ghc_runner container though. Puttingexec
before thepaver
command doesn't have any affect, and neither has usingexec
somewhere inside runner_daemon in pavement.sh.