1. Job批处理任务
共绩科技
  • 共绩算力 Open API
    • 资源
      • 获取设备资源列表
      • 获取对象存储加速资源列表
      • 获取共享存储卷资源列表
    • 弹性部署服务任务
      • 任务列表查询接口
      • 任务详情查询接口
      • 任务创建接口
      • 任务修改接口
      • 任务恢复接口
      • 任务暂停接口
      • 任务删除接口
    • Job批处理任务
      • Job任务列表查询接口
        GET
      • Job任务详情查询接口
        GET
      • Job任务创建接口
        POST
      • Job任务停止接口
        POST
    • 弹性部署服务节点
      • 节点列表查询接口
      • 节点日志查询接口
      • 节点事件查询接口
      • 节点数量修改接口
      • 任务节点删除接口
    • 费用
      • 弹性部署/云主机-时间维度计费查询接口
      • 弹性部署/云主机-任务维度计费查询接口
      • 镜像仓库-计费查询接口
      • 对象存储加速-计费查询接口
      • 共享存储卷-计费查询接口
  1. Job批处理任务

Job任务创建接口

POST
/api/task/job/create
当前版本旧版本是否需要加密是否需要加签
v1.0.0-否是

描述#

创建Job批处理任务。
数据结构中的 resources.item.mark(资源唯一标识) 需要从 获取设备资源列表 接口获取

请求参数

Header 参数

Body 参数application/json必填

示例
{
    "task_name": "job-202604210858",
    "sub_type": null,
    "schedule_status": null,
    "resources": [
        {
            "resource": {
                "device_name": "4090",
                "region": "chengde-p1",
                "gpu_name": "4090",
                "gpu_count": 1,
                "gpu_memory": 24560,
                "memory": 64512,
                "cpu_cores": 16
            },
            "region_name": "河北六区",
            "mark": "ha8GDGEAORN3a9Hhu7X+W/lveP9CW2eBkI+oB/QJLRcfvPTUMuUpxqfch7PdWik27Qx0BQX2cmaGoUHnIQ6pUPcLqpoLUCh5MaAR9kIet8llTG2oulHTzTRxAofshQoSFvtGpGD4Rh7V2V7xAj/0ysk+OmC4WeIxe+zHVBoYCehyTVGCyFygp1QeqGCp",
            "weight": null
        }
    ],
    "status": "Running",
    "points": 1,
    "services": [
        {
            "service_id": 1963001,
            "service_name": "container-01",
            "service_image": "harbor.suanleme.cn/trsnls6j/ubuntu:22.04",
            "remote_ports": [
                {
                    "url": "https://job-11391-olueehus-80.550w.link",
                    "service_port": 80
                }
            ],
            "health_checks": {
                "liveness_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/live",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                },
                "startup_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/health",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                },
                "readiness_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/ready",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                }
            },
            "storage_config": [
                {
                    "storage_id": 2038,
                    "target_dir": "/root/s3"
                }
            ],
            "share_storage_config": [
                {
                    "storage_id": 2037,
                    "target_dir": "/root/share"
                }
            ],
            "share_mem_config": [
                {
                    "target_dir": "/dev/shm",
                    "volume_name": "mem-default"
                }
            ],
            "share_disk_config": [
                {
                    "target_dir": "/dev/shd",
                    "volume_name": "share-disk"
                }
            ],
            "env": [
                {
                    "name": "key1",
                    "value": "value1",
                    "value_from": null
                }
            ],
            "start_script": {
                "command": [
                    "sleep"
                ],
                "args": [
                    "300"
                ]
            },
            "repository_account": null,
            "is_update_repository": null,
            "resource_weight": {
                "cpu_weight": 1,
                "mem_weight": 1,
                "gpu_weight": 1
            },
            "registered_ports": null
        }
    ],
    "task_tags": null,
    "share_disk_volumes": [
        {
            "name": "share-disk"
        }
    ],
    "share_mem_volumes": [
        {
            "name": "mem-default",
            "size_limit": 32768
        }
    ],
    "job_support": {
        "estimated_exec_sec": null,
        "timeout_sec": 1200,
        "parallelism": 1,
        "mod_param": {
            "default": {
                "backoff_limit": 3,
                "restart_policy": "OnFailure"
            },
            "index": null
        }
    }
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'https://openapi.suanli.cn/api/task/job/create' \
--header 'token;' \
--header 'timestamp: {{$date.millisecondsTimestamp}}' \
--header 'version: 1.0.0' \
--header 'sign_str;' \
--header 'Content-Type: application/json' \
--data '{
    "task_name": "job-202604210858",
    "sub_type": null,
    "schedule_status": null,
    "resources": [
        {
            "resource": {
                "device_name": "4090",
                "region": "chengde-p1",
                "gpu_name": "4090",
                "gpu_count": 1,
                "gpu_memory": 24560,
                "memory": 64512,
                "cpu_cores": 16
            },
            "region_name": "河北六区",
            "mark": "ha8GDGEAORN3a9Hhu7X+W/lveP9CW2eBkI+oB/QJLRcfvPTUMuUpxqfch7PdWik27Qx0BQX2cmaGoUHnIQ6pUPcLqpoLUCh5MaAR9kIet8llTG2oulHTzTRxAofshQoSFvtGpGD4Rh7V2V7xAj/0ysk+OmC4WeIxe+zHVBoYCehyTVGCyFygp1QeqGCp",
            "weight": null
        }
    ],
    "status": "Running",
    "points": 1,
    "services": [
        {
            "service_id": 1963001,
            "service_name": "container-01",
            "service_image": "harbor.suanleme.cn/trsnls6j/ubuntu:22.04",
            "remote_ports": [
                {
                    "url": "https://job-11391-olueehus-80.550w.link",
                    "service_port": 80
                }
            ],
            "health_checks": {
                "liveness_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/live",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                },
                "startup_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/health",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                },
                "readiness_probe": {
                    "switch": false,
                    "probe_type": "httpGet",
                    "path": "/ready",
                    "port": 80,
                    "initial_delay_seconds": 0,
                    "period_seconds": 10,
                    "timeout_seconds": 1,
                    "failure_threshold": 3
                }
            },
            "storage_config": [
                {
                    "storage_id": 2038,
                    "target_dir": "/root/s3"
                }
            ],
            "share_storage_config": [
                {
                    "storage_id": 2037,
                    "target_dir": "/root/share"
                }
            ],
            "share_mem_config": [
                {
                    "target_dir": "/dev/shm",
                    "volume_name": "mem-default"
                }
            ],
            "share_disk_config": [
                {
                    "target_dir": "/dev/shd",
                    "volume_name": "share-disk"
                }
            ],
            "env": [
                {
                    "name": "key1",
                    "value": "value1",
                    "value_from": null
                }
            ],
            "start_script": {
                "command": [
                    "sleep"
                ],
                "args": [
                    "300"
                ]
            },
            "repository_account": null,
            "is_update_repository": null,
            "resource_weight": {
                "cpu_weight": 1,
                "mem_weight": 1,
                "gpu_weight": 1
            },
            "registered_ports": null
        }
    ],
    "task_tags": null,
    "share_disk_volumes": [
        {
            "name": "share-disk"
        }
    ],
    "share_mem_volumes": [
        {
            "name": "mem-default",
            "size_limit": 32768
        }
    ],
    "job_support": {
        "estimated_exec_sec": null,
        "timeout_sec": 1200,
        "parallelism": 1,
        "mod_param": {
            "default": {
                "backoff_limit": 3,
                "restart_policy": "OnFailure"
            },
            "index": null
        }
    }
}'

返回响应

🟢200成功
application/json
Bodyapplication/json

示例
{
    "code": "0000",
    "message": "success",
    "data": {
        "task_id": 6799
    }
}
上一页
Job任务详情查询接口
下一页
Job任务停止接口
Built with