云容器实例 CCI-创建PyTorchJob:请求消息

时间:2024-11-06 15:35:38

请求消息

请求参数

请求参数的详细描述请参见表165

请求示例:

{   
    "apiVersion": "kubeflow.org/v1",
    "kind": "PyTorchJob",
    "metadata": {
        "name": "pytorch-test"
    },
    "spec": {
        "pytorchReplicaSpecs": {
            "Master": {
                "replicas": 1,
                "restartPolicy": "Never",
                "template": {
                    "spec": {
                        "containers": [
                            {
                                "name": "pytorch",
                                "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1",
                                "command": [
                                    "python",
                                    "/var/mnist.py"
                                ],
                                "args": [
                                    "--backend",
                                    "gloo"
                                ],
                                "resources": {
                                    "limits": {
                                        "cpu": 2,
                                        "memory": "4Gi"
                                    },
                                    "requests": {
                                        "cpu": 2,
                                        "memory": "4Gi"
                                    }
                                }
                            }
                        ],
                        "imagePullSecrets": [
                            {
                                "name": "imagepull-secret"
                            }
                        ]
                    }
                }
            },
            "Worker": {
                "replicas": 1,
                "restartPolicy": "OnFailure",
                "template": {
                    "spec": {
                        "containers": [
                            {
                                "name": "pytorch",
                                "image": "*.*.*.215:20202/gcs/pytorch-cpu:v1",
                                "command": [
                                    "python",
                                    "/var/mnist.py"
                                ],
                                "args": [
                                    "--backend",
                                    "gloo"
                                ],
                                "resources": {
                                    "limits": {
                                        "cpu": 2,
                                        "memory": "4Gi"
                                    },
                                    "requests": {
                                        "cpu": 2,
                                        "memory": "4Gi"
                                    }
                                }
                            }
                        ],
                        "imagePullSecrets": [
                            {
                                "name": "imagepull-secret"
                            }
                        ]
                    }
                }
            }
        }
    }
}
support.huaweicloud.com/api-cci/cci_02_3161.html