Cluster API Jobs
Cluster API documentation for the jobs
Jobs
- GET /jobs
Get the list of jobs in the cluster
- Request Headers:
waitIndex – The wait index is used to monitor the jobs with a long pull.
- Response JSON Object:
[] (object) –
[].name (string) – The job name.
[].status (string) – The job status.
[].autostart (boolean) – If the job start when starting all jobs.
[].byCluster (boolean) – If the job must start for each cluster.
[].taskGroups[] (object) – An array of task group.
[].taskGroups[].name (string) – The task group name.
[].taskGroups[].count (integer) – The required number of task group to run.
[].taskGroups[].summary.queued (integer) –
[].taskGroups[].summary.complete (integer) –
[].taskGroups[].summary.failed (integer) –
[].taskGroups[].summary.running (integer) –
[].taskGroups[].summary.starting (integer) –
[].taskGroups[].summary.lost (integer) –
[].hclv1 (boolean) – If the job template is using HCLv1.
- Response Headers:
waitIndex – undefined
Example response:
[ { "name": "jobName", "status": "running", "autostart": true, "byCluster": true, "taskGroups": [ { "name": "takGroupName", "count": 0, "summary": { "queued": 0, "complete": 0, "failed": 0, "running": 0, "starting": 0, "lost": 0 } } ], "hclv1": false } ]
- GET /job/{jobName}/summary
Get the job summary
- Parameters:
jobName – The job name
- Response JSON Object:
name (string) – The job name.
status (string) – The job status.
autostart (boolean) – If the job start when starting all jobs.
byCluster (boolean) – If the job must start for each cluster.
taskGroups[] (object) – An array of task group.
taskGroups[].name (string) – The task group name.
taskGroups[].count (integer) – The required number of task group to run.
taskGroups[].summary.queued (integer) –
taskGroups[].summary.complete (integer) –
taskGroups[].summary.failed (integer) –
taskGroups[].summary.running (integer) –
taskGroups[].summary.starting (integer) –
taskGroups[].summary.lost (integer) –
hclv1 (boolean) – If the job template is using HCLv1.
Example response:
{ "name": "jobName", "status": "running", "autostart": true, "byCluster": true, "taskGroups": [ { "name": "takGroupName", "count": 0, "summary": { "queued": 0, "complete": 0, "failed": 0, "running": 0, "starting": 0, "lost": 0 } } ], "hclv1": false }
- POST /jobs/start/{jobName}
Schedule the job to start, or refresh the job if already started.
Changed in version 1.45.0: Added the capacity to refresh the job and the
force
parameter.- Parameters:
jobName – The job name
- Query Parameters:
force – If the job is already running, force it to update their task counters too with the job definition.
- POST /jobs/stop/{jobName}
Schedule the job to stop
- Parameters:
jobName – The job name
- Query Parameters:
purge – Force the purge the job in Nomad.
- POST /jobs/startall
Schedule or refresh all autostart jobs.
- ..versionchanged:: 1.45.0
Added the ability to refresh the job and the
force
parameter.
- Query Parameters:
force – If the job is already running, force it to update their task counters too with the job definition.
- POST /jobs/stopall
Schedule all jobs to stop
- Query Parameters:
purge – Force the purge the job in Nomad.
- POST /jobs/updatecounts
Increment or decrement a task group count. If count is 0, set it to 0.
- Request JSON Object:
jobID (string) – The name of the job.
taskGroup (string) – The task group.
count (integer) – The count delta. 0 will stop the job.
Example query:
{ "jobID": "jobName", "taskGroup": "taskGrouName", "count": 0 }
- POST /jobs/settaskgroupcount
Set a task group count.
New in version 1.23.0.
- Request JSON Object:
jobID (string) – The name of the job.
taskGroup (string) – The task group.
count (integer) – The value to set the task group count.
Example query:
{ "jobID": "jobName", "taskGroup": "taskGrouName", "count": 0 }