共绩科技
  1. 任务
共绩科技
  • 共绩算力 Open API
    • 任务
      • 显卡资源查询接口
        GET
      • 任务创建接口
        POST
      • 任务列表查询接口
        GET
      • 任务详情查询接口
        GET
      • 任务暂停接口
        POST
      • 任务删除接口
        POST
      • 任务恢复接口
        POST
      • 任务修改接口
        POST
      • 任务自定义YAML校验接口
        POST
    • 节点
      • 任务节点列表查询接口
      • 任务节点数量修改接口
      • 任务节点删除接口
      • 任务节点关机接口
      • 获取任务节点日志
      • 获取任务Pod事件
    • 计费管理
      • 获取计费记录
    • 存储
      • 存储配置列表
  1. 任务

任务修改接口

POST
/api/deployment/task/update
此接口为任务修改接口,支持更新部署任务的运行时配置参数,包括资源配置、副本数量、环境变量等。
可直接使用detail接口数据增加“task_id”和“service_id”即可使用,此接口传入参数必须为全量,每一个参数都必须有数据
API 加验签说明
根据 API 密钥模式,支持两种调用方式:
快速模式:仅需在 Header 中传递 token 参数
RSA 模式:需要 RSA 签名验证,需额外传递 token、timestamp、version、sign_str 参数。
签名生成步骤
1.
构建待签名字符串:
path: 接口地址(如:/api/deployment/task/update)
version: 请求头中的接口版本(如:1.0.0)
timestamp: 请求头中的时间戳(毫秒)
token: 请求头中的 token
data: 接口请求体 JSON 字符串
2.
使用 RSA-SHA256 算法对待签名字符串进行签名
3.
将签名结果转换为 Base64 字符串
4.
将 Base64 签名字符串设置到请求头的 sign_str 字段。
注意事项: - 签名字符串中各参数用换行符 \n 连接 - 同时需要加密和加签时,必须先进行加密步骤,再进行加签步骤 - 此接口要求二级密钥加签 - 更新操作将触发部署系统实时热重载 - 修改后的配置会立即生效,无需重启任务
自定义 YAML 配置说明
此接口支持通过自定义 YAML 配置来创建和修改任务,支持多种 Kubernetes 资源类型:
YAML 配置示例
简单 Pod 配置示例: ```yaml apiVersion: v1 kind: Pod metadata:
name: nginx-pod
labels:
app: nginx
spec:
containers:
name: nginx
image: nginx:latest
ports:
containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
GPU 训练配置示例: ```yaml apiVersion: v1 kind: Pod metadata:
  name: gpu-training-pod
  labels:
    app: gpu-training
spec:
  containers:
  - name: cuda-training
    image: nvidia/cuda:11.8-base-ubuntu20.04
    command: ["/bin/bash"]
    args: ["-c", "nvidia-smi && sleep 3600"]
    resources:
      requests:
        nvidia.com/gpu: 1
        memory: "4Gi"
        cpu: "2"
      limits:
        nvidia.com/gpu: 1
        memory: "8Gi"
        cpu: "4"
    env:
    - name: NVIDIA_VISIBLE_DEVICES
      value: "all"
    - name: NVIDIA_DRIVER_CAPABILITIES
      value: "compute,utility"
健康检查配置方式
健康检查配置只能通过任务修改接口 /api/deployment/task/update 进行:
需要传递完整的任务配置信息(包括 resources、services 等)
在 services 数组中的 health_checks 字段配置健康检查
需要先调用任务详情查询接口获取完整配置
可以同时修改其他任务配置(如资源、环境变量等)
使用任务修改接口的完整示例:
{
  "task_id": 9011,
  "service_id": 9017,
  "task_name": "d09160956-comfyui-sdv35-1",
  "resources": [
    {
      "mark": "your_resource_mark",
      "points": 1
    }
  ],
  "services": [
    {
      "service_name": "d1757987812165-21241",
      "service_image": "harbor.suanleme.cn/huang5876/last1/comfyui-sd:invisiblekk-fb0ce5e9-1a0d-4ad4-a146-8a2c572a0f15",
      "remote_ports": [
        {
          "service_port": 8188
        },
        {
          "service_port": 3000
        }
      ],
      "health_checks": {
        "liveness_probe": {
          "switch": true,
          "probe_type": "httpGet",
          "path": "/live",
          "port": 8188,
          "initial_delay_seconds": 30,
          "period_seconds": 10,
          "timeout_seconds": 5,
          "failure_threshold": 3
        },
        "readiness_probe": {
          "switch": true,
          "probe_type": "httpGet",
          "path": "/ready",
          "port": 8188,
          "initial_delay_seconds": 5,
          "period_seconds": 10,
          "timeout_seconds": 5,
          "failure_threshold": 3
        },
        "startup_probe": {
          "switch": true,
          "probe_type": "httpGet",
          "path": "/health",
          "port": 8188,
          "initial_delay_seconds": 0,
          "period_seconds": 10,
          "timeout_seconds": 5,
          "failure_threshold": 30
        }
      }
    }
  ],
  "env_vars": {
    "APP_ENV": "production",
    "LOG_LEVEL": "INFO"
  }
}

请求参数

Header 参数

Body 参数application/json

示例
{
    "tesk_name": "义土我马米",
    "task_id": "18",
    "resources": {
        "mark": "cillum veniam Ut deserunt ut"
    },
    "points": 35,
    "services": {
        "service_name": "列油史主备统",
        "shared_mem_size": 21,
        "service_image": "http://dummyimage.com/400x400",
        "service_id": 51,
        "remote_ports": {
            "service_port": "nostrud"
        },
        "env": "proident elit velit in",
        "storage_config": {
            "storage_id": 30,
            "target_dir": "dolore culpa ad et"
        },
        "custom_yaml": "ex eu aute Excepteur"
    }
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://openapi.suanli.cn/api/deployment/task/update' \
--header 'token: your_api_token_here' \
--header 'version: 1.0.0' \
--header 'timestamp: 1747379023000' \
--header 'sign_str: base64_encoded_signature_here' \
--header 'Content-Type: application/json' \
--data-raw '{
    "tesk_name": "义土我马米",
    "task_id": "18",
    "resources": {
        "mark": "cillum veniam Ut deserunt ut"
    },
    "points": 35,
    "services": {
        "service_name": "列油史主备统",
        "shared_mem_size": 21,
        "service_image": "http://dummyimage.com/400x400",
        "service_id": 51,
        "remote_ports": {
            "service_port": "nostrud"
        },
        "env": "proident elit velit in",
        "storage_config": {
            "storage_id": 30,
            "target_dir": "dolore culpa ad et"
        },
        "custom_yaml": "ex eu aute Excepteur"
    }
}'

返回响应

🟢200成功
application/json
请求成功
Headers

Body

示例
{
    "code": "0000",
    "reload_duration": 1.24,
    "next_validation": "2025-06-20T03:05:00Z"
}
🟠401没有权限
🟠409409
修改于 2025-09-17 07:45:37
上一页
任务恢复接口
下一页
任务自定义YAML校验接口
Built with