Replacing a PyTorchJob
Function
This API is used to replace a specified PyTorchJob. The following fields can be replaced:
- metadata.labels
- metadata.annotations
- spec.activeDeadlineSeconds
- spec.ttlSecondsAfterFinished
- spec.cleanPodPolicy
URI
PUT /apis/kubeflow.org/v1/namespaces/{namespace}/pytorchjobs/{name}
Parameter |
Mandatory |
Description |
---|---|---|
name |
Yes |
Name of the PyTorchJob. |
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
Request parameters
For the description about request parameters, see Table 165.
Example request
Change the ttlSecondsAfterFinished value of PyTorchJob.
{ "apiVersion": "kubeflow.org/v1", "kind": "PyTorchJob", "metadata": { "creationTimestamp": "2019-07-24T10:35:38Z", "generation": 2, "labels": { "app": "test" }, "name": "pytorch-test", "namespace": "kube-test", "resourceVersion": "72519846", "selfLink": "/apis/kubeflow.org/v1/namespaces/kube-test/pytorchjobs/pytorch-test", "uid": "c6e548f1-adfe-11e9-ba3a-b44326d0c915" }, "spec": { "pytorchReplicaSpecs": { "Master": { "replicas": 1, "restartPolicy": "Never", "template": { "spec": { "containers": [ { "args": [ "--backend", "gloo" ], "command": [ "python", "/var/mnist.py" ], "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1", "name": "pytorch", "resources": { "limits": { "cpu": 2, "memory": "4Gi" }, "requests": { "cpu": 2, "memory": "4Gi" } } } ], "imagePullSecrets": [ { "name": "imagepull-secret" } ] } } }, "Worker": { "replicas": 1, "restartPolicy": "OnFailure", "template": { "spec": { "containers": [ { "args": [ "--backend", "gloo" ], "command": [ "python", "/var/mnist.py" ], "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1", "name": "pytorch", "resources": { "limits": { "cpu": 2, "memory": "4Gi" }, "requests": { "cpu": 2, "memory": "4Gi" } } } ], "imagePullSecrets": [ { "name": "imagepull-secret" } ] } } } }, "ttlSecondsAfterFinished": 3000 }, "status": { "conditions": [ { "lastTransitionTime": "2019-07-24T10:36:26Z", "lastUpdateTime": "2019-07-24T10:36:26Z", "message": "PyTorchJob pytorch-test is created.", "reason": "PyTorchJobCreated", "status": "True", "type": "Created" } ], "replicaStatuses": { "Master": {} }, "startTime": "2019-07-24T10:36:26Z" } }
Response
Response parameters
For the description about response parameters, see Table 165.
Example response
{ "apiVersion": "kubeflow.org/v1", "kind": "PyTorchJob", "metadata": { "creationTimestamp": "2019-07-24T10:35:38Z", "generation": 2, "labels": { "app": "test" }, "name": "pytorch-test", "namespace": "kube-test", "resourceVersion": "72519846", "selfLink": "/apis/kubeflow.org/v1/namespaces/kube-test/pytorchjobs/pytorch-test", "uid": "c6e548f1-adfe-11e9-ba3a-b44326d0c915" }, "spec": { "pytorchReplicaSpecs": { "Master": { "replicas": 1, "restartPolicy": "Never", "template": { "spec": { "containers": [ { "args": [ "--backend", "gloo" ], "command": [ "python", "/var/mnist.py" ], "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1", "name": "pytorch", "resources": { "limits": { "cpu": 2, "memory": "4Gi" }, "requests": { "cpu": 2, "memory": "4Gi" } } } ], "imagePullSecrets": [ { "name": "imagepull-secret" } ] } } }, "Worker": { "replicas": 1, "restartPolicy": "OnFailure", "template": { "spec": { "containers": [ { "args": [ "--backend", "gloo" ], "command": [ "python", "/var/mnist.py" ], "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1", "name": "pytorch", "resources": { "limits": { "cpu": 2, "memory": "4Gi" }, "requests": { "cpu": 2, "memory": "4Gi" } } } ], "imagePullSecrets": [ { "name": "imagepull-secret" } ] } } } }, "ttlSecondsAfterFinished": 3000 }, "status": { "conditions": [ { "lastTransitionTime": "2019-07-24T10:36:26Z", "lastUpdateTime": "2019-07-24T10:36:26Z", "message": "PyTorchJob pytorch-test is created.", "reason": "PyTorchJobCreated", "status": "True", "type": "Created" } ], "replicaStatuses": { "Master": {} }, "startTime": "2019-07-24T10:36:26Z" } }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
201 |
Created |
401 |
Unauthorized |
400 |
BadRequest |
500 |
Internal Error |
403 |
Forbidden |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot