创建工作流模版
更新时间:2026-09-04
描述
创建一个工作流模版(Pipeline)。可指定名称、Pipeline 定义(manifest)、类型、调度表达式、资源池等信息。支持 normal(普通)与 cron(定时)两种类型。
请求结构
Bash
1POST /?action=CreatePipeline
2Host:aihc.bj.baidubce.com
3Authorization:authorization string
4ContentType: application/json; charset=utf-8
5Version: v2
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必须 | 参数位置 | 说明 |
|---|---|---|---|---|
| name | String | 是 | Body参数 | Pipeline 名称,1~255 字符 |
| manifest | String | 是 | Body参数 | Pipeline 定义的 Base64 字符串 |
| description | String | 否 | Body参数 | 描述 |
| pipelineType | String | 否 | Body参数 | Pipeline 类型,支持 normal、cron,默认值:normal |
| cronExpression | String | 否 | Body参数 | 五段式 Cron 表达式,pipelineType=cron 时必选 |
| disabled | String | 否 | Body参数 | 是否禁用,取值 true/false(保持 Console 兼容) |
| resourcePoolId | String | 否 | Body参数 | 资源池 ID |
| concurrencyPolicy | String | 否 | Body参数 | 并发策略,支持 Allow、Forbid、Replace |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 说明 |
|---|---|---|
| requestId | String | 请求 ID |
| pipelineId | String | 创建的 Pipeline ID |
| name | String | Pipeline 名称 |
| pipelineType | String | Pipeline 类型 |
| status | String | 状态,新建初始状态为 init |
| createdAt | String | 创建时间 |
| updatedAt | String | 更新时间 |
请求示例
JSON
1{
2 "name": "syf-test-openapi-pipeline-0824-1",
3 "manifest": "version: v1\nkind: PipelineTemplate\ntaskTemplates:\n - name: custom-task-template\n type: CustomTask\n inputs:\n - name: queue_id\n type: string\n hint: 队列ID\n - name: command\n type: string\n hint: 执行命令\n - name: image_url\n type: string\n hint: 镜像地址\n - name: cpu\n type: int\n hint: CPU申请配额(核)\n defaultValue: 1\n - name: memory\n type: int\n hint: 内存申请配额(GB)\n defaultValue: 2\n spec:\n queue: '{{inputs.parameters.queue_id}}'\n jobType: PyTorchJob\n command: '{{inputs.parameters.command}}'\n jobSpec:\n replicas: 1\n image: '{{inputs.parameters.image_url}}'\n resources:\n - name: cpu\n quantity: '{{inputs.parameters.cpu}}'\n - name: memory\n quantity: '{{inputs.parameters.memory}}'\n datasources: []\ntasks:\n - name: first_workflow_task_demo\n taskTemplateName: custom-task-template\n inputs:\n - name: queue_id\n value: aihcq-a7gfnn99lplg\n - name: command\n value: echo \"This is your first workflow task.\"\n - name: image_url\n value: registry.baidubce.com/aihc-aiak/aiak-megatron:ubuntu20.04-cu11.8-torch1.14.0-py38_v1.2.7.12_release\n - name: cpu\n value: 0.5\n - name: memory\n value: 1",
4 "description": "示例 Pipeline",
5 "pipelineType": "normal",
6 "disabled": "false",
7 "resourcePoolId": "aihc-g9qm0av79z06",
8 "concurrencyPolicy": "Allow"
9}
返回示例
JSON
1{
2 "createdAt": "2026-08-24T15:16:48.852666212+08:00",
3 "name": "syf-test-openapi-pipeline-0824-1",
4 "pipelineId": "pipe-qttxg5",
5 "pipelineType": "normal",
6 "requestId": "0837f065-e365-4a30-8ce5-bd73bf9de7bd",
7 "status": "init",
8 "updatedAt": "2026-08-24T15:16:48.852666259+08:00"
9}
评价此篇文章
