更新时间:2024-06-20 GMT+08:00
分享

操作StepExecution

功能介绍

操作STEP。

接口约束

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v2/{project_id}/workflows/{workflow_id}/executions/{execution_id}/step-executions/{step_execution_id}/actions

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

用户项目ID。获取方法请参见获取项目ID和名称

workflow_id

String

工作流的ID。

execution_id

String

工作流执行ID。

step_execution_id

String

工作流的一次执行中一个节点的执行ID。

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

action_name

String

操作名称,枚举如下:

  • retry 重试

  • stop 停止

  • continue 继续

data_requirements

Array of DataRequirement objects

工作流需要的数据。

parameters

Array of WorkflowParameter objects

参数。

表3 DataRequirement

参数

是否必选

参数类型

描述

name

String

数据的名称。填写1-64位,仅包含英文、数字、下划线(_)和中划线(-),并且以英文开头的名称。

type

String

类型。枚举值如下:

  • dataset:数据集

  • obs:OBS

  • swr:SWR

  • model_list:AI应用列表

  • label_task:标注任务

  • service:在线服务

conditions

Array of Constraint objects

数据约束条件。

value

Map<String,Object>

数据的值。

used_steps

Array of strings

使用了这条数据的工作流节点。

delay

Boolean

延时参数标记。

表4 Constraint

参数

是否必选

参数类型

描述

attribute

String

属性,参数的某个字段值。

operator

String

操作,当前只支持equal操作。

value

Object

取值。

表5 WorkflowParameter

参数

是否必选

参数类型

描述

name

String

配置参数的名称。填写1-64位,仅包含英文、数字、下划线(_)和中划线(-),并且以英文开头的名称。

type

String

参数的类型,枚举值如下:

  • str:字符串

  • int:整型

  • bool:布尔类型

  • float:浮点型

description

String

描述。

example

Object

样例。

delay

Boolean

是否为延迟输入的参数。

default

Object

默认值。

value

Object

Parameter的值。

enum

Array of objects

枚举项。

used_steps

Array of strings

使用这个参数的工作流节点。

format

String

数据格式。

constraint

Map<String,Object>

限制条件。

响应参数

状态码: 201

表6 响应Body参数

参数

参数类型

描述

step_name

String

节点的名称,在一个DAG中唯一,1到64位只包含中英文,数字,空格,下划线(_)和中划线(-),并且以中英文开头。

uuid

String

唯一标识uuid。创建节点执行时,后台自动生成。

created_at

String

创建时间。

duration

Integer

运行时长。

type

String

节点的类型。

instance_id

String

实例ID。

status

String

节点的状态。枚举值如下:

  • init:初始化

  • wait_inputs:等待输入

  • pending:等待

  • creating:创建中

  • created:创建成功

  • create_failed:创建失败

  • running:运行中

  • stopping:停止中

  • stopped:停止

  • timeout:超时

  • completed:完成

  • failed:失败

  • hold:持有

  • skipped:跳过

inputs

Array of JobInput objects

节点的输入项。

outputs

Array of JobOutput objects

节点的输出项。

step_uuid

String

节点的UUID,唯一性标识。

properties

Map<String,Object>

节点的属性。

events

Array of strings

节点发生的事件。

error_info

WorkflowErrorInfo object

错误信息。

policy

WorkflowStepExecutionPolicy object

节点的执行策略。

conditions_execution

WorkflowConditionExecution object

条件执行。

step_title

String

节点标题。

conditions

Array of StepCondition objects

条件节点执行条件。

表7 JobInput

参数

参数类型

描述

name

String

输入项名称,支持1到64位只包含英文、数字、下划线(_)和中划线(-)的字符。

type

String

输入项类型。枚举值如下:

  • dataset:数据集

  • obs:OBS

  • data_selector:数据选择

data

Object

输入项数据。

value

Object

输入项的值。

表8 JobOutput

参数

参数类型

描述

name

String

输出项名称。

type

String

输出项类型。枚举值如下:

  • obs:OBS

  • model:AI应用元模型

config

Map<String,Object>

输出配置。

表9 WorkflowErrorInfo

参数

参数类型

描述

error_code

String

错误码。

error_message

String

错误信息。

表10 WorkflowStepExecutionPolicy

参数

参数类型

描述

execution_policy

String

执行策略,可选值如下:

  • retry:重试

  • stop,:停止

  • continue:继续运行

use_cache

Boolean

使用的缓存。

表11 WorkflowConditionExecution

参数

参数类型

描述

result

String

执行结果。

metric_list

Array of WorkflowMetricPair objects

工作流度量信息列表。

表12 WorkflowMetricPair

参数

参数类型

描述

key

String

度量信息metric的key。

value

Object

度量信息metric的值。

表13 StepCondition

参数

参数类型

描述

type

String

判断类型,例如==(等于)、!=(不等于)、>(大于)、>=(大于等于)、<(小于)、<=(小于等于)、in(包含)、or(或)。

left

Object

取true时的分支。

right

Object

取false时的分支。

请求示例

停止step

POST https://{endpoint}/v2/{project_id}/workflows/{workflow_id}/executions/4dd2a2f5-bde2-45dd-af6b-5e5d570118d1/step_executions/255a1079-b00a-4c3a-8218-3458f7546b8d/actions

{
  "action_name" : "stop"
}

响应示例

状态码: 201

OK

{
  "created_at" : "2022-11-01T21:36:04.310635+08:00",
  "uuid" : "2f7ad04a-60cb-4f1c-96fd-dfc9cf96363b",
  "instance_id" : "{\"model_id\":\"6fe56a95-e7f1-4388-b207-c80684af0cb8\"}",
  "step_name" : "model_step",
  "step_title" : "model release",
  "status" : "completed",
  "duration" : 15,
  "inputs" : [ {
    "name" : "model_input",
    "type" : "obs",
    "data" : "$ref/data_requirements/model_input",
    "value" : {
      "object_type" : [ "DIRECTORY" ],
      "obs_url" : "/test-crq/train_output/"
    }
  } ],
  "outputs" : [ {
    "name" : "model_output",
    "type" : "model",
    "config" : {
      "model_id" : "6fe56a95-e7f1-4388-b207-c80684af0cb8"
    }
  } ],
  "properties" : {
    "model_name" : "lh-xh",
    "model_type" : "TensorFlow"
  },
  "events" : [ "2022-11-01 21:36:05 change status from init to creating", "2022-11-01 21:36:09 change status from creating to created", "2022-11-01 21:36:09 change status from created to running", "2022-11-01 21:36:19 change status from running to completed" ],
  "policy" : { }
}

状态码

状态码

描述

201

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品