Clarification on registering a job service
Thursday, 6 May 2021 · 4 messages
ZD
Zimmel, Daniel6 May 2021 11:12 #
Hi,
can someone clarify on the following behaviour?
The docs say:
"Job services can be updated: If a new job is registered, and if there is already a job with the same id, the old entry will be replaced." https://docs.basex.org/wiki/Jobs_Module#Services
So when I try to update an existing job service with the following query, I get an unexpected error "Job id already exists: myquery.":
jobs:eval(
xs:anyURI('myquery.xq'),
(),
map { 'id':'myquery', 'start':'19:00:00', 'interval':'P1D', 'service': true() }
)Am I reading the documentation wrong?
Thanks Daniel
CG
Christian Grün6 May 2021 13:52 #
Hi Daniel,
I have decided to remove the misleading information in the
documentation as it would probably be confusing to explain the full background:
• If a job is currently registered for scheduled execution, a new job with the same name will be rejected.
• If the job has been registered as service, but if it’s not currently scheduled (e.g. because the job will only be run once at startup time), it can be replaced with a new job.
You can stop scheduled jobs as follows (and register new ones after that):
for $job in jobs:list-details()
where $job/@state = 'scheduled'
return jobs:stop($job/@id)Hope this helps
Christian
Quoted text · Daniel · 23 lines
On Thu, May 6, 2021 at 11:12 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > Hi, > > can someone clarify on the following behaviour? > > The docs say: > > "Job services can be updated: If a new job is registered, and if there is already a job with the same id, the old entry will be replaced." > https://docs.basex.org/wiki/Jobs_Module#Services > > So when I try to update an existing job service with the following query, I get an unexpected error "Job id already exists: myquery.": > > jobs:eval( > xs:anyURI('myquery.xq'), > (), > map { 'id':'myquery', 'start':'19:00:00', 'interval':'P1D', 'service': true() } > ) > > Am I reading the documentation wrong? > > Thanks Daniel >
ZD
Zimmel, Daniel6 May 2021 14:24 #
Thank you for the insight on how this works:
so you cannot update a scheduled job, but you can update the jobs-to-be-scheduled.
Helps a lot,
Daniel
Quoted text · Christian Grün · 40 lines
-----Ursprüngliche Nachricht----- Von: Christian Grün <christian.gruen at gmail.com> Gesendet: Donnerstag, 6. Mai 2021 13:52 An: Zimmel, Daniel <D.Zimmel at ESVmedien.de> Cc: basex-talk at mailman.uni-konstanz.de Betreff: Re: [basex-talk] Clarification on registering a job service Hi Daniel, I have decided to remove the misleading information in the documentation as it would probably be confusing to explain the full background: • If a job is currently registered for scheduled execution, a new job with the same name will be rejected. • If the job has been registered as service, but if it’s not currently scheduled (e.g. because the job will only be run once at startup time), it can be replaced with a new job. You can stop scheduled jobs as follows (and register new ones after that): for $job in jobs:list-details() where $job/@state = 'scheduled' return jobs:stop($job/@id) Hope this helps Christian On Thu, May 6, 2021 at 11:12 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > Hi, > > can someone clarify on the following behaviour? > > The docs say: > > "Job services can be updated: If a new job is registered, and if there is already a job with the same id, the old entry will be replaced." > https://docs.basex.org/wiki/Jobs_Module#Services > > So when I try to update an existing job service with the following query, I get an unexpected error "Job id already exists: myquery.": > > jobs:eval( > xs:anyURI('myquery.xq'), > (), > map { 'id':'myquery', 'start':'19:00:00', 'interval':'P1D', 'service': true() } > ) > > Am I reading the documentation wrong? > > Thanks Daniel >
CG
Christian Grün6 May 2021 14:25 #
…nice wording.
Quoted text · Daniel · 65 lines
Zimmel, Daniel <D.Zimmel at esvmedien.de> schrieb am Do., 6. Mai 2021, 14:24: > Thank you for the insight on how this works: > so you cannot update a scheduled job, but you can update the > jobs-to-be-scheduled. > > Helps a lot, > Daniel > > -----Ursprüngliche Nachricht----- > Von: Christian Grün <christian.gruen at gmail.com> > Gesendet: Donnerstag, 6. Mai 2021 13:52 > An: Zimmel, Daniel <D.Zimmel at ESVmedien.de> > Cc: basex-talk at mailman.uni-konstanz.de > Betreff: Re: [basex-talk] Clarification on registering a job service > > Hi Daniel, > > I have decided to remove the misleading information in the documentation > as it would probably be confusing to explain the full > background: > > • If a job is currently registered for scheduled execution, a new job with > the same name will be rejected. > • If the job has been registered as service, but if it’s not currently > scheduled (e.g. because the job will only be run once at startup time), it > can be replaced with a new job. > > You can stop scheduled jobs as follows (and register new ones after that): > > for $job in jobs:list-details() > where $job/@state = 'scheduled' > return jobs:stop($job/@id) > > Hope this helps > Christian > > > On Thu, May 6, 2021 at 11:12 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> > wrote: > > > > Hi, > > > > can someone clarify on the following behaviour? > > > > The docs say: > > > > "Job services can be updated: If a new job is registered, and if > there is already a job with the same id, the old entry will be replaced." > > https://docs.basex.org/wiki/Jobs_Module#Services > > > > So when I try to update an existing job service with the following > query, I get an unexpected error "Job id already exists: myquery.": > > > > jobs:eval( > > xs:anyURI('myquery.xq'), > > (), > > map { 'id':'myquery', 'start':'19:00:00', 'interval':'P1D', > 'service': true() } > > ) > > > > Am I reading the documentation wrong? > > > > Thanks Daniel > > >
Written for BaseX 9.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery