Changes

Jump to navigation Jump to search
455 bytes added ,  14:18, 20 July 2022
no edit summary
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:eval|$query as xs:anyAtomicType|xs:string}}<br />{{Func|job:eval|$query as xs:anyAtomicType, $bindings as map(*)?|xs:string}}<br />{{Func|job:eval|$query as xs:anyAtomicType, $bindings as map(*)?, $options as map(*)?|xs:string}}<br />
|-valign="top"
| '''Summary'''
|Schedules the evaluation of the supplied {{Code|$query}} ({{Code|xs:string}}, or of type {{Code|xs:anyURI}}, pointing to a resource), and returns a query id. The query will be queued, and the result will optionally be cached. Queries can be updating. Variables and the context value can be declared via {{Code|$bindings}} (see {{Function|XQuery|xquery:eval}} for more details). The following {{Code|$options}} can be supplied:
* {{Code|service}}: additionally registers the job as [[#Services|service]]. Registered services must have no variable bindings.
* {{Code|log}}: writes the specified string to the [[Logging|database logs]]. Two log entries are stored, one at the beginning and another one after the execution of the job.
|-valign="top"
| '''Errors'''
|{{Error|overflow|#Errors}} Query execution is rejected, because too many jobs are queued or being executed. {{Option|CACHETIMEOUT}} can be decreased if the default setting is too restrictive.<br/>{{Error|range|#Errors}} A specified time or duration is out of range.<br/>{{Error|id|#Errors}} The specified id is invalid or has already been assigned.<br/>{{Error|options|#Errors}} The specified options are conflicting.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:result|$id as xs:string|item()*}}
|-valign="top"
| '''Summary'''
|Returns the cached result of a job with the specified job {{Code|$id}}:
* Results can only be retrieved once. After retrieval, the cached result will be dropped.
* If the result has already been retrieved, or if it has not been cached, an empty sequence is returned.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:stop|$id as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Triggers the cancelation of a job with the specified {{Code|$id}}, drops the cached result of a query, or cancels a scheduled job. Unknown ids are ignored. All jobs are gracefully stopped; it is up to the process to decide when it is safe to shut down. The following {{Code|$options}} can be supplied:
* {{Code|service}}: additionally removes the job from the [[#Services|job services]] list.
|-valign="top"
| '''Examples'''
| <code>job:list()[. != job:current()] ! job:stop(.)</code> stops and discards all jobs except for the current one.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:wait|$id as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Waits for the completion of a job with the specified {{Code|$id}}:
* The function will terminate immediately if the job id is unknown. This is the case if a future job has not been queued yet, or if the id has already been discarded after job evaluation.
* If the function is called with the id of a queued job, or repeatedly executed job, it may stall and never terminate.
|-valign="top"
| '''Errors'''
|{{Error|self|#Errors}} The current job is addressed.<br/>
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:current||xs:string}}
|-valign="top"
| '''Summary'''
|Returns the id of the current job.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:list||xs:string*}}
|-valign="top"
| '''Summary'''
|Returns the ids of all jobs that are currently registered. The list includes scheduled, queued, running, stopped, and finished jobs with cached results.
|-valign="top"
| '''Examples'''
| <code>job:list()</code> returns the same job id as {{Function||job:current}} if no other job is registered.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:list-details||element(job)*}}<br/>{{Func|job:list-details|$id as xs:string|element(job)*}}
|-valign="top"
| '''Summary'''
|Returns information on all jobs that are currently registered, or on a job with the specified {{Code|$id}} (or an empty sequence if this job is not found). The list includes scheduled, queued, running jobs, and cached jobs. A string representation of the job, or its URI, will be returned as value. The returned elements have additional attributes:
* <code>start</code>: next start of job (included if a job will be executed repeatedly)
* <code>time</code>: time when job was registered
|-valign="top"
| '''Examples'''
| <code>job:list-details()</code> returns information on the currently running job and possibly others:
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:bindings|$id as xs:string|map(*)}}
|-valign="top"
| '''Summary'''
|Returns the variable bindings of an existing job with the specified {{Code|$id}}. If no variables have been bound to this job, an empty map is returned.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:finished|$id as xs:string|xs:boolean}}
|-valign="top"
| '''Summary'''
|Indicates if the evaluation of an already running job with the specified {{Code|$id}} has finished. As the ids of finished jobs will usually be discarded, unless caching is enabled, the function will also return <code>true</code> for unknown jobs.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|job:services||element(job)*}}
|-valign="top"
| '''Summary'''
|Returns a list of all jobs that have been persistently registered as [[#Services|Services]].
|-valign="top"
| '''Errors'''
|{{Error|services|#Errors}} Registered services cannot be parsed.<br/>
! width="110"|Code
|Description
|-valign="top"
|{{Code|options}}
| The specified options are conflicting.
|-valign="top"
|{{Code|id}}
| The specified id is invalid or has already been assigned.
|-valign="top"
|{{Code|overflow}}
| Too many queries or query results are queued.
|-valign="top"
|{{Code|range}}
| A specified time or duration is out of range.
|-valign="top"
|{{Code|running}}
| A query is still running.
|-valign="top"
|{{Code|self}}
| The current job cannot be addressed.
|-valign="top"
|{{Code|service}}
| Registered services cannot be parsed, added or removed.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu