apscheduler icon indicating copy to clipboard operation
apscheduler copied to clipboard

Until start apcheduler allows add multiple jobs with the same id

Open senseysensor opened this issue 5 years ago • 4 comments

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

senseysensor avatar Apr 24 '19 11:04 senseysensor

The scheduler cannot know which IDs exist until the job stores have been started.

agronholm avatar Apr 24 '19 12:04 agronholm

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.

senseysensor avatar Apr 26 '19 07:04 senseysensor

It could possibly check for conflicts among the tentatively added jobs, yes.

agronholm avatar Jun 25 '19 10:06 agronholm

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.

agronholm avatar Jun 25 '19 10:06 agronholm

The concept of "tentatively" adding jobs has been eliminated in v4.0.0a1, so I'm closing this.

agronholm avatar Aug 17 '22 21:08 agronholm