schedule
schedule copied to clipboard
Problem after each schedule, gets delayed even with Parallel execution
Hello guys, I already searched and see many people are with problems because the schedule doesn't control the execution time, and the workaround for this is the Parallel execution: here Even after trying this, I still have the problem and even missed one call on date: 2023-02-15 21:03:11
Current Time = 2023-02-15 21:03:09.996591 <Thread(Thread-196 (test), started 123145329221632)> Current Time = 2023-02-15 21:03:10.999913 <Thread(Thread-197 (test), started 123145329221632)> Current Time = 2023-02-15 21:03:12.000702 <Thread(Thread-198 (test), started 123145329221632)> Current Time = 2023-02-15 21:03:13.002731 <Thread(Thread-199 (test), started 123145329221632)>
Can someone help me with this? I would appreciate it so much. my code:
import time
from datetime import datetime, timedelta
import threading
def test():
current_time = datetime.now()
print("Current Time =", current_time, threading.current_thread())
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
schedule.every(1).seconds.do(run_threaded, test)
if __name__ == "__main__":
while True:
schedule.run_pending()
time.sleep(1)
feel that it's working as expected:
- from this library's doc it mentions it's not supporting sub-second precision: https://schedule.readthedocs.io/en/stable/index.html
- I think your missed
2023-02-15 21:03:11
execution is actually2023-02-15 21:03:10.999913
feel that it's working as expected:
- from this library's doc it mentions it's not supporting sub-second precision: https://schedule.readthedocs.io/en/stable/index.html
- I think your missed
2023-02-15 21:03:11
execution is actually2023-02-15 21:03:10.999913
Yep that would be the problem 😜