apscheduler
apscheduler copied to clipboard
Until start apcheduler allows add multiple jobs with the same id
from apscheduler.triggers.interval import IntervalTrigger
scheduler = BackgroundScheduler()
scheduler.add_job(print, IntervalTrigger(minutes=1), id='example_job')
scheduler.add_job(dir, IntervalTrigger(minutes=2), id='example_job')
scheduler.start()
# apscheduler.jobstores.base.ConflictingIdError: 'Job identifier (abc) conflicts with an existing job'
Expected Behavior
I would have immediately ConflictingIdError on job adding, regardless of was scheduler started or not.
Current Behavior
I am allowed to add many then one job with the same ID.
Context (Environment)
python 3.7.3 apscheduler 3.6.0
The scheduler cannot know which IDs exist until the job stores have been started.
ok but it still is allowed add tasks to [not started] job stores until scheduler start. I understand there may be implementation obstacles to change current situation (due to numerous reasons) but still from user point of view I believe such behaviour is unexpected.
It could possibly check for conflicts among the tentatively added jobs, yes.
Users are having considerable difficulties with issues around unstarted job stores so I may rearchitect the whole thing in a way that eliminates the problem entirely.
The concept of "tentatively" adding jobs has been eliminated in v4.0.0a1, so I'm closing this.