kkzxak47
kkzxak47

Reputation: 463

How to detect APScheduler's running jobs?

I have some recurring jobs run frequently or last for a while. It seems that Scheduler().get_jobs() will only return the list of scheduled jobs that are not currently running, so I cannot determine if a job with certain id do not exists or is actually running.

How may I test if a job is running or not in this situation?

(I set up those jobs not the usual way, (because I need them to run in a random interval, not fixed interval), they are jobs that execute only once, but will add a job with the same id by the end of their execution, and they will stop doing so when reaching a certain threshold.)

Upvotes: 7

Views: 4836

Answers (1)

Alex Grönholm
Alex Grönholm

Reputation: 5901

APScheduler does not filter the list of jobs for get_jobs() in any way. If you need random scheduling, why not implement that in a custom trigger instead of constantly readding the job?

Upvotes: 3

Related Questions