Replacing a Volcano Job
Function
This API is used to replace a specified Volcano job.
The following fields can be updated:
- metadata.labels
- metadata.generateName
- metadata.annotations
- spec.template
- spec.replicas
URI
PUT /apis/batch.volcano.sh/v1alpha1/namespaces/{namespace}/jobs/{name}
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
name |
Yes |
Name of the Volcano job. |
|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
pretty |
No |
If 'true', then the output is pretty printed. |
Request
For the description about request parameters, see Table 145.
Example request
The following example changes the number of replicas from 1 to 2 for a Volcano job task:
{
"apiVersion": "batch.volcano.sh/v1alpha1",
"kind": "Job",
"metadata": {
"name": "openmpi-hello-2-com",
"namespace": "cci-gpu",
"resourceVersion": "125597961"
},
"spec": {
"minAvailable": 2,
"plugins": {
"env": [],
"ssh": [],
"svc": []
},
"queue": "default",
"schedulerName": "volcano",
"tasks": [
{
"name": "mpimaster",
"policies": [
{
"action": "CompleteJob",
"event": "TaskCompleted"
}
],
"replicas": 1,
"template": {
"spec": {
"containers": [
{
"command": [
"/bin/sh",
"-c",
"MPI_HOST=`cat /etc/volcano/mpiworker.host | tr \"\\n\" \",\"`;\nmkdir -p /var/run/sshd; /usr/sbin/sshd;\nmpiexec --allow-run-as-root --host ${MPI_HOST} -np 2 mpi_hello_world 003e /home/re\n"
],
"image": "*.*.*.*:20202/swr/openmpi-hello:3.28",
"name": "mpimaster",
"ports": [
{
"containerPort": 22,
"name": "mpijob-port"
}
],
"resources": {
"limits": {
"cpu": "250m",
"memory": "1Gi"
},
"requests": {
"cpu": "250m",
"memory": "1Gi"
}
},
"workingDir": "/home"
}
],
"imagePullSecrets": [
{
"name": "default-secret"
}
],
"restartPolicy": "OnFailure"
}
}
},
{
"name": "mpiworker",
"replicas": 2,
"template": {
"spec": {
"containers": [
{
"command": [
"/bin/sh",
"-c",
"mkdir -p /var/run/sshd; /usr/sbin/sshd -D;\n"
],
"image": "*.*.*.*:20202/swr/openmpi-hello:3.28",
"name": "mpiworker",
"ports": [
{
"containerPort": 22,
"name": "mpijob-port"
}
],
"resources": {
"limits": {
"cpu": "250m",
"memory": "1Gi"
},
"requests": {
"cpu": "250m",
"memory": "1Gi"
}
},
"workingDir": "/home"
}
],
"imagePullSecrets": [
{
"name": "default-secret"
}
],
"restartPolicy": "OnFailure"
}
}
}
]
},
"status": {
"minAvailable": 1,
"pending": 3,
"state": {
"lastTransitionTime": "2019-07-11T08:09:45Z",
"phase": "Succeed"
}
}
}
Response
Response parameters
For the description about response parameters, see Table 145.
Example response
{
"apiVersion": "batch.volcano.sh/v1alpha1",
"kind": "Job",
"metadata": {
"creationTimestamp": "2019-07-11T08:09:41Z",
"generation": 2,
"name": "openmpi-hello-2-com",
"namespace": "zjh-gpu",
"resourceVersion": "125620754",
"selfLink": "/apis/batch.volcano.sh/v1alpha1/namespaces/zjh-gpu/jobs/openmpi-hello-2-com",
"uid": "3bdba739-a3b3-11e9-8865-501d93440997"
},
"spec": {
"minAvailable": 2,
"plugins": {
"env": [],
"ssh": [],
"svc": []
},
"queue": "default",
"schedulerName": "volcano",
"tasks": [
{
"name": "mpimaster",
"policies": [
{
"action": "CompleteJob",
"event": "TaskCompleted"
}
],
"replicas": 1,
"template": {
"spec": {
"containers": [
{
"command": [
"/bin/sh",
"-c",
"MPI_HOST=`cat /etc/volcano/mpiworker.host | tr \"\\n\" \",\"`;\nmkdir -p /var/run/sshd; /usr/sbin/sshd;\nmpiexec --allow-run-as-root --host ${MPI_HOST} -np 2 mpi_hello_world 003e /home/re\n"
],
"image": "*.*.*.*:20202/swr/openmpi-hello:3.28",
"name": "mpimaster",
"ports": [
{
"containerPort": 22,
"name": "mpijob-port"
}
],
"resources": {
"limits": {
"cpu": "250m",
"memory": "1Gi"
},
"requests": {
"cpu": "250m",
"memory": "1Gi"
}
},
"workingDir": "/home"
}
],
"imagePullSecrets": [
{
"name": "default-secret"
}
],
"restartPolicy": "OnFailure"
}
}
},
{
"name": "mpiworker",
"replicas": 2,
"template": {
"spec": {
"containers": [
{
"command": [
"/bin/sh",
"-c",
"mkdir -p /var/run/sshd; /usr/sbin/sshd -D;\n"
],
"image": "*.*.*.*:20202/swr/openmpi-hello:3.28",
"name": "mpiworker",
"ports": [
{
"containerPort": 22,
"name": "mpijob-port"
}
],
"resources": {
"limits": {
"cpu": "250m",
"memory": "1Gi"
},
"requests": {
"cpu": "250m",
"memory": "1Gi"
}
},
"workingDir": "/home"
}
],
"imagePullSecrets": [
{
"name": "default-secret"
}
],
"restartPolicy": "OnFailure"
}
}
}
]
},
"status": {
"controlledResources": {
"plugin-env": "env",
"plugin-ssh": "ssh",
"plugin-svc": "svc"
},
"minAvailable": 1,
"pending": 3,
"state": {
"lastTransitionTime": "2019-07-11T08:09:45Z",
"phase": "Inqueue"
}
}
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
201 |
Created |
|
401 |
Unauthorized |
|
400 |
BadRequest |
|
500 |
Internal Error |
|
403 |
Forbidden |
Last Article: Reading the Details of a Volcano Job
Next Article: Deleting a Volcano Job
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.