-
Notifications
You must be signed in to change notification settings - Fork 3
Job Queue
Usman Shahid edited this page Feb 12, 2019
·
1 revision
The shhttp server also features a Job Queue in which the jobs can be queued. Normally, each job is performed independent of other but the queued jobs are executed serially (in the FIFO order). To queue a job simply set the queue=true
query parameter in the job submission URLs. For example, submitting two or three of the following job:
POST http://localhost:2112/v1/jobs?queue=true
{
"Executions": [
{
"Executable": {
"Command": "sleep",
"Args": ["5"]
}
},
{
"Executable": {
"Command": "date"
}
}
]
}
Would return the Id
of the queued jobs, taking the Id
of the last one:
{
"id": "1549620684621883000-ddf85eb0-e2f8-4ff9-9012-c314dec75cf2"
}
Getting the job will return:
{
"Id": "1549620684621883000-ddf85eb0-e2f8-4ff9-9012-c314dec75cf2",
"Executions": [
{
"Executable": {
"Command": "sleep",
"Args": [
"5"
],
"BaseDir": "",
"Stdin": "",
"Shell": false,
"Env": null
},
"Stdout": "",
"Stderr": "",
"ExitCode": 0,
"Start": 0,
"End": 0
},
{
"Executable": {
"Command": "date",
"Args": null,
"BaseDir": "",
"Stdin": "",
"Shell": false,
"Env": null
},
"Stdout": "",
"Stderr": "",
"ExitCode": 0,
"Start": 0,
"End": 0
}
],
"Status": "QUEUED",
"Created": 1549979599,
"LastModified": 0,
"IgnoreErrors": false
}
Notice the QUEUED
status, this means that the job is in queue, and when its turn comes, it will execute.
The queue also works for saved jobs. To submit a saved job to queue, simply set the queue=true
query parameter on the /v1/saved
endpoint when POST
ing to it.
Basic Usage -> Jobs -> Saved Jobs -> Job Queue