7

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.)

kkzxak47
  • 462
  • 7
  • 16

1 Answers1

3

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?

Alex Grönholm
  • 5,563
  • 29
  • 32
  • Yes, later in the day I found out that job is removed from the list once it starts running. I'm planning on implementing a randomTrigger. Thanks for the tip! – kkzxak47 Mar 13 '15 at 13:07
  • 3
    @kkzxak47 Have you found out how to list running jobs? – Hieu Mar 14 '18 at 09:42