I am unable to get the job list before I start blockingscheduler, I already have a job with id as
background_event_publisher
Now when I try to add -
jobstores = {
'default': SQLAlchemyJobStore(url=os.environ.get("SQLALCHEMY_DATABASE_URI", None))
}
scheduler = BlockingScheduler(
daemon=True, jobstores=jobstores, timezone=pytz.utc)
scheduler.get_jobs()
Gives
[]
Then
scheduler.add_job(fun, 'cron', hour='09', minute='30',
id='background_event_publisher' , misfire_grace_time=3600)
scheduler.start()
Gives Error
apscheduler.jobstores.base.ConflictingIdError: 'Job identifier (background_event_publisher) conflicts with an existing job
Can't understand why are not getting anything in get_jobs() while it still exists.
Before the scheduler has started, it only sees jobs tentatively added to it. It cannot access the job store because the job store is only initialized during scheduler initialization. If you need to just retrieve such information without actually running the scheduled jobs, you should start the scheduler in paused state (scheduler.start(paused=True)
).