Prefork webservers like gunicorn are usually configured to limit the
number of requests each worker can serve, for various reasons. My
model is based on similar motivations. It simplifies resource
management and the scheduling logic, among other things.
So to be more precise, most of my processes are in fact set to
autostart. They manage their own scheduling logic, and most of the
cron jobs do `supervisorctl restart suchandsuch` which generally is
expected to produce an error because the process will have exited
normally at the end of the previous run.
Perhaps not intuitive, and definitely not a complete separation of
concerns as you point out, but I also don't see why I should
reimplement in my own codebase what I have for free in cron.
Post by jon bennettIf you're using supervisor and have the logic to allow your processes
to sleep, why not make your processes persistent and leave it to them
to know when to run?
You then have a clear separation of concerns, Supervisor makes sure
the process is running (or stopped!) and the process makes sure it
only does things when it should do.
Post by Aryeh Leib TaurogI have a bunch of cron jobs that run `supervisorctl start suchandsuch`
and for the most part I make the processes themselves responsible for
exiting at the right time (say, after market close).
I also make the processes responsible for handling changes in start
time due to other factors like daylight savings. The cron jobs start
everything before the earliest time and the processes sleep until the
correct start time for the current date.
Post by Steve LorimerIs there a way to schedule a window during which a service should be
running?
Similar to cron, but managed through supervisord?
[program:theprogramname]
command=/bin/cat
starttime=09:00:00
stoptime=17:00:00
dow=1-5
dom=*
month=*
If this isn't available in supervisord directly, what is the recommended
way to achieve this?
TIA
Steve