[Python] APScheduler Set misfire_grace_time globally

Discussão em 'Python' iniciado por Stack, Novembro 5, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to apply misfire_grace_time globally for all of my jobs. According to the Doc Page it says:


    The scheduler will then check each missed execution time against the job’s misfire_grace_time option (which can be set on per-job basis or globally in the scheduler) to see if the execution should still be triggered.
    ​

    but how do I set it globally?

    I tried:

    sched = BackgroundScheduler(misfire_grace_time=30)
    # a few sched.add_job()
    for job in sched.get_jobs():
    print(job.misfire_grace_time) # Throws exception


    but doing sched.add_job(...., misfire_grace_time=30) or job.misfire_grace_time = 30 in the for loop works.

    What is the correct way of setting misfire_grace_time globally without adding it to each individual job?

    Continue reading...

Compartilhe esta Página