全部产品
Search
文档中心

大数据开发治理平台 DataWorks:ImportWorkflowDefinition - 导入数据开发工作流

更新时间:Dec 05, 2024

调用此接口,可以将通过FlowSpec定义的工作流节点和其内部的子节点都导入到数据开发中。

接口说明

注意 该接口不支持导入多个工作流,若 FlowSpec 中定义了不止一个工作流,则除第一个以外的后续工作流将被忽略。
注意 这是一个异步接口,调用该接口将返回一个异步任务的对象。任务具体的执行状态需要调用 GetJobStatus 查询。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
ProjectIdstring

DataWorks 工作空间的 ID。您可以登录 DataWorks 控制台,进入工作空间管理页面获取 ID。

该参数用来确定本次 API 调用操作使用的 DataWorks 工作空间。

123456
Specstring

描述这个工作流的 FlowSpec 信息,具体规范详见 FlowSpec

{ "version": "1.1.0", "kind": "CycleWorkflow", "spec": { "name": "异步创建工作流测试", "id": "632647691239009XXXX", "type": "CycleWorkflow", "owner": "110755000425XXXX", "workflows": [ { "script": { "path": "XX/OpenAPI测试/工作流测试/异步创建工作流测试", "runtime": { "command": "WORKFLOW" }, "id": "571736535339375XXXX" }, "id": "632647691239009XXXX", "trigger": { "type": "Scheduler", "id": "704867956014174XXXX", "cron": "00 03 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "strategy": { "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "failureStrategy": "Break" }, "name": "异步创建工作流测试", "owner": "110755000425XXXX", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "632647691239009XXXX", "artifactType": "NodeOutput", "refTableName": "异步创建工作流测试", "isDefault": true } ] }, "nodes": [ { "recurrence": "Normal", "id": "742981001612325XXXX", "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "script": { "path": "XX/OpenAPI测试/工作流测试/异步创建工作流测试/111", "runtime": { "command": "ODPS_SQL", "commandTypeId": 10, "cu": "0.25" }, "content": "select now();\n", "id": "553495118941391XXXX" }, "trigger": { "type": "Scheduler", "id": "553164589407812XXXX", "cron": "00 24 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "name": "111", "owner": "110755000425XXXX", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "742981001612325XXXX", "artifactType": "NodeOutput", "refTableName": "111", "isDefault": true } ] } }, { "recurrence": "Normal", "id": "595182137303408XXXX", "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "script": { "path": "XX/OpenAPI测试/工作流测试/异步创建工作流测试/222", "runtime": { "command": "ODPS_SQL", "commandTypeId": 10, "cu": "0.25" }, "content": "select now();\n select 1;", "id": "793399140553304XXXX" }, "trigger": { "type": "Scheduler", "id": "613552850338387XXXX", "cron": "00 00 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "name": "222", "owner": "110755000425XXXX", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "595182137303408XXXX", "artifactType": "NodeOutput", "refTableName": "222", "isDefault": true } ] } } ], "dependencies": [ { "nodeId": "595182137303408XXXX", "depends": [ { "type": "Normal", "output": "742981001612325XXXX", "refTableName": "111" } ] } ] } ] } }

返回参数

名称类型描述示例值
object

Schema of Response

RequestIdstring

请求 ID。用于出现错误后排查问题。

7C352CB7-CD88-50CF-9D0D-E81BDF020E7F
AsyncJobobject

异步任务状态信息。

Completedboolean

异步任务是否完成。

false
CreateTimelong

异步任务创建时间戳。

1706581425000
Errorstring

当异步任务失败时的错误信息。

target folder already exists: XXXX
Idstring

异步任务的 ID。

1234567691239009XXXX
Progressinteger

异步任务完成进度,范围区间为 0-100

0
Responsestring

该异步任务希望返回的内容。

说明 该字段目前存放在异步任务中被创建的工作流的 ID。
632647691239009XXXX
Statusstring

异步任务的状态。

可选值

  • Running 正在运行
  • Success 执行成功
  • Fail 执行失败
  • Cancel 任务被取消
Running
Typestring

异步任务操作类型

可选值

  • Create 创建,创建一个资源的 Job。
  • Cancel 取消,取消某一个创建 Job。
Create

示例

正常返回示例

JSON格式

{
  "RequestId": "7C352CB7-CD88-50CF-9D0D-E81BDF020E7F",
  "AsyncJob": {
    "Completed": false,
    "CreateTime": 1706581425000,
    "Error": "target folder already exists: XXXX",
    "Id": "1234567691239009XXXX",
    "Progress": 0,
    "Response": "632647691239009XXXX",
    "Status": "Running",
    "Type": "Create"
  }
}

错误码

访问错误中心查看更多错误码。