user3545251
user3545251

Reputation: 495

why misfire warning not generated in apscheduler

I have a simple code supposed to give misfire as the previous job not completed when next fire is triggered.

in this program I intended to print hello world after 3 sec, so to create misfire i made the job to sleep more than 3 sec so the previous one is not completed. However I am not getting the misfire error. I am confused.

#!/usr/bin/env python

import sys
from time import sleep
from apscheduler.scheduler import Scheduler
sched = Scheduler()
sched.start()        # start the scheduler

# define the function that is to be executed
# it will be executed in a thread by the scheduler
def my_job():

    print "hello world"
    sleep(10)
    print "nest"

def main():
    # job = sched.add_date_job(my_job, datetime(2013, 8, 5, 23, 47, 5), ['text'])
    job = sched.add_interval_job(my_job,seconds=3)
    while True:
        sleep(1)
        sys.stdout.write('.'); sys.stdout.flush()

##############################################################

if __name__ == "__main__":
    main() 

Further Is there a way to generate Run time of job "xxxxx (trigger: cron[day='*', hour='0', minute='0', second='0'], next run at: 2015-05-14 00:00:00)" was missed by 0:00:02.493426 so that I can test the coalesce in the program?

Upvotes: 1

Views: 320

Answers (1)

Alex Grönholm
Alex Grönholm

Reputation: 5911

Try decreasing the size of your thread pool to 1 and increasing the number of concurrent executions of your job. That should get you the warning you're looking for.

Upvotes: 0

Related Questions