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

获取Execution列表

功能介绍

查询Workflow下的执行记录列表。

接口约束

调试

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

URI

GET /v2/{project_id}/workflows/{workflow_id}/executions

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

workflow_id

String

工作流的ID。

表2 Query参数

参数

是否必选

参数类型

描述

workspace_id

String

工作空间ID。获取方法请参见查询工作空间列表。未创建工作空间时默认值为“0”,存在创建并使用的工作空间,以实际取值为准。

limit

String

分页参数limit,表示单次查询的条目数上限。假如要查询20~29条记录,offset为20,limit为10。

sort_by

String

排序依据字段,例如sort_by=create_time,则表示以条目的创建时间进行排序。

offset

String

分页参数offset,表示单次查询的条目偏移数量。假如要查询20~29条记录,offset为20,limit为10。

labels

String

执行记录标签。

status

String

执行记录状态。

scene_id

String

场景ID。

order

String

排序的方式。该字段必须与sort_by同时使用。 缺省值: desc 枚举值:

  • asc:表示升序排列,

  • desc:降序排列。

请求参数

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

total

Integer

总数。

count

Integer

返回个数。

items

Array of WorkflowExecution objects

execution数组。

表4 WorkflowExecution

参数

参数类型

描述

created_at

String

创建时间。

name

String

执行记录名称。

execution_id

String

工作流执行ID。

description

String

执行记录描述。

status

String

执行记录状态。

workspace_id

String

工作空间ID。

workflow_id

String

Workflow工作流ID。

workflow_name

String

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

scene_id

String

自定义场景ID。

scene_name

String

自定义场景名称。

steps_execution

Array of StepExecution objects

执行记录的step。

sub_graphs

Array of WorkflowSubgraph objects

子图。

duration

String

执行的时长。

events

Array of strings

执行的事件。

labels

Array of strings

为执行记录设置的标签。

data_requirements

Array of DataRequirement objects

节点steps使用到的数据。

parameters

Array of WorkflowParameter objects

节点steps使用到的参数。

policies

WorkflowDagPolicies object

执行记录使用到的执行策略。

表5 StepExecution

参数

参数类型

描述

step_name

String

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

uuid

String

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

created_at

String

Execution执行的创建时间。

duration

Integer

Execution执行的运行时长。

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

Execution执行的错误信息。

policy

WorkflowStepExecutionPolicy object

节点的执行策略。

conditions_execution

WorkflowConditionExecution object

条件执行。

step_title

String

节点标题。

conditions

Array of StepCondition objects

条件节点执行条件。

表6 JobInput

参数

参数类型

描述

name

String

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

type

String

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

  • dataset:数据集

  • obs:OBS

  • data_selector:数据选择

data

Object

输入项数据。

value

Object

输入项的值。

表7 JobOutput

参数

参数类型

描述

name

String

输出数据的名称。

type

String

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

  • obs:OBS

  • model:AI应用元模型

config

Map<String,Object>

输出配置。

表8 WorkflowErrorInfo

参数

参数类型

描述

error_code

String

错误码。

error_message

String

错误信息。

表9 WorkflowStepExecutionPolicy

参数

参数类型

描述

execution_policy

String

执行策略,可选值如下:

  • retry:重试

  • stop:停止

  • continue:继续运行

use_cache

Boolean

是否使用的是缓存。

表10 WorkflowConditionExecution

参数

参数类型

描述

result

String

执行结果。

metric_list

Array of WorkflowMetricPair objects

工作流度量信息列表。

表11 WorkflowMetricPair

参数

参数类型

描述

key

String

度量信息metric的key。

value

Object

度量信息metric的值。

表12 StepCondition

参数

参数类型

描述

type

String

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

left

Object

节点执行条件为true时的分支。

right

Object

节点执行条件为false时的分支。

表13 WorkflowSubgraph

参数

参数类型

描述

name

String

子图名称。

steps

Array of strings

子图step成员。

表14 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

延时参数标记。

表15 Constraint

参数

参数类型

描述

attribute

String

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

operator

String

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

value

Object

取值。

表16 WorkflowParameter

参数

参数类型

描述

name

String

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

type

String

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

  • str:字符串

  • int:整型

  • bool:布尔类型

  • float:浮点型

description

String

Workflow工作流配置参数的描述。

example

Object

Workflow工作流配置参数的样例。

delay

Boolean

是否为延迟输入的参数,默认为否。

default

Object

配置参数的默认值。

value

Object

参数值。

enum

Array of objects

Workflow工作流配置参数的枚举项。

used_steps

Array of strings

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

format

String

数据格式。

constraint

Map<String,Object>

限制条件。

表17 WorkflowDagPolicies

参数

参数类型

描述

use_cache

Boolean

是否使用缓存。

请求示例

查询工作流执行记录列表

GET https://{endpoint}/v2/{project_id}/workflows/{workflow_id}/executions?limit=10&offset=0&sort_by=create_time&order=desc&status=completed

响应示例

状态码: 200

OK

{
  "total" : 1,
  "count" : 1,
  "items" : [ {
    "created_at" : "2022-06-17T17:08:16.91019+08:00",
    "name" : "execution-064",
    "execution_id" : "918cd9bd-62dd-4179-b5f0-773dd7184a56",
    "description" : "",
    "status" : "completed",
    "workspace_id" : "0",
    "workflow_id" : "f1642618-43eb-4ab1-a0b1-9cc584182c60",
    "workflow_name" : "workflow_model_service_no_modify_xiahou_copy",
    "steps_execution" : [ {
      "created_at" : "2022-06-17T17:08:16.920281+08:00",
      "uuid" : "d6148a4a-4a5e-47a3-bc90-3183905b4941",
      "instance_id" : "{\"model_id\":\"253aba02-4bd6-4f64-8d37-66022ae7af4d\"}",
      "step_name" : "model_step",
      "step_title" : "model release",
      "status" : "completed",
      "duration" : 16,
      "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" : "253aba02-4bd6-4f64-8d37-66022ae7af4d"
        }
      } ],
      "properties" : {
        "model_name" : "lh-xh",
        "model_type" : "TensorFlow"
      },
      "events" : [ "2022-06-17 17:08:17 change status from init to creating", "2022-06-17 17:08:19 change status from creating to created", "2022-06-17 17:08:20 change status from created to running", "2022-06-17 17:08:33 change status from running to completed" ],
      "policy" : { }
    }, {
      "created_at" : "2022-06-17T17:08:33.038184+08:00",
      "uuid" : "b34b2b54-eb70-4c7f-a92d-05f849d8c39a",
      "instance_id" : {
        "type" : "deploy",
        "service_id" : "81f22d60-5488-4e3d-bba9-08c812ae84b0",
        "status" : "",
        "update_time" : 0
      },
      "step_name" : "service_step",
      "step_title" : "service install",
      "status" : "completed",
      "duration" : 83430,
      "inputs" : [ {
        "name" : "service_input",
        "type" : "model_list",
        "data" : "$ref/data_requirements/service_model",
        "value" : {
          "model_list" : [ {
            "envs" : { },
            "instance_count" : 1,
            "model_id" : "253aba02-4bd6-4f64-8d37-66022ae7af4d",
            "model_name" : "lh-xh",
            "model_version" : "0.0.62",
            "specification" : "modelarts.vm.ai1",
            "weight" : 100
          } ]
        }
      } ],
      "outputs" : [ {
        "name" : "service_output",
        "type" : "service",
        "config" : {
          "service_id" : "81f22d60-5488-4e3d-bba9-08c812ae84b0"
        }
      } ],
      "properties" : {
        "infer_type" : "real-time",
        "schedule" : -1
      },
      "events" : [ "2022-06-17 17:08:34 change status from init to wait_inputs", "2022-06-18 16:16:58 change status from wait_inputs to creating", "2022-06-18 16:17:01 change status from creating to created", "2022-06-18 16:17:02 change status from created to running", "2022-06-18 16:19:03 change status from running to completed" ],
      "policy" : { }
    } ],
    "duration" : 11852428,
    "events" : [ "2022-06-17 17:08:17 step model_step change status from init to creating", "2022-06-17 17:08:19 step model_step change status from creating to created", "2022-06-17 17:08:20 step model_step change status from created to running", "2022-06-17 17:08:33 step model_step change status from running to completed", "2022-06-17 17:08:34 step service_step change status from init to wait_inputs", "2022-06-18 16:16:58 step service_step change status from wait_inputs to creating", "2022-06-18 16:17:01 step service_step change status from creating to created", "2022-06-18 16:17:02 step service_step change status from created to running", "2022-06-18 16:19:03 step service_step change status from running to completed" ],
    "data_requirements" : [ {
      "name" : "model_input",
      "type" : "obs",
      "conditions" : [ {
        "attribute" : "object_type",
        "operator" : "equal",
        "value" : "directory"
      } ],
      "value" : {
        "object_type" : [ "DIRECTORY" ],
        "obs_url" : "/test-crq/train_output/"
      },
      "used_steps" : [ "model_step" ]
    }, {
      "name" : "service_model",
      "type" : "model_list",
      "delay" : true,
      "conditions" : [ {
        "attribute" : "model_name",
        "operator" : "equal",
        "value" : "lh-xh"
      } ],
      "value" : {
        "model_list" : [ {
          "envs" : { },
          "instance_count" : 1,
          "model_id" : "253aba02-4bd6-4f64-8d37-66022ae7af4d",
          "model_name" : "lh-xh",
          "model_version" : "0.0.62",
          "specification" : "modelarts.vm.ai1",
          "weight" : 100
        } ]
      },
      "used_steps" : [ "service_step" ]
    } ],
    "parameters" : [ {
      "name" : "schedule_d5sm",
      "type" : "int",
      "format" : "schedule",
      "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run",
      "delay" : true,
      "value" : -1,
      "used_steps" : [ "service_step" ]
    } ],
    "policies" : { }
  } ]
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档