![]() |
something i noticed about the "schedule" module - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: something i noticed about the "schedule" module (/thread-20784.html) |
something i noticed about the "schedule" module - Stan2292 - Aug-30-2019 im new to python. using 3.7 atm. i just finished a SCADA auto fault reporting script (works off of a monitoring website's frontend). i've scheduled the program to run every 30 minutes. schedule.every(30).minutes.run(abcd_1)but i noticed that it the timer for 30 minutes only starts after the program has run its course. so if the first instance starts at 9:00, the second one will start at 9:32, then 10:04, 10:36 etc. is there a way to have the script run at every 30 minute mark accurately without resorting to writhing schedule.every().day.at("9:00").do(abcd_1)48 times? RE: something i noticed about the "schedule" module - buran - Aug-30-2019 I guess you refer to schedule module from PyPI. You can check their answer to your question: Quote:How can I make sure long-running jobs are always executed on time?Another option is to look at APScheduler package which has BackgroundScheduler Yet another approach is to use OS scheduler tool like cron or TaskScheduler. And finally, to be technically correct to schedule each job separately will take 2 or max 3 lines with a loop, no need of 48 lines. :-) |