Updated on 2024-04-30 GMT+08:00

Parameter Overview

You can use ConditionStep to create a condition phase. The following is an example of defining a ConditionStep.

Table 1 ConditionStep

Parameter

Description

Mandatory

Data Type

name

Name of a condition phase. The name contains a maximum of 64 characters, including only letters, digits, underscores (_), and hyphens (-). It must start with a letter and must be unique in a workflow.

Yes

str

conditions

List of conditions. The AND operation is used for multiple conditions.

Yes

Condition or condition list

if_then_steps

Steps to be executed if the calculation result of the condition expression is True

No

str or str list

else_then_steps

Steps to be executed if the calculation result of the condition expression is False

No

str or str list

title

Title for frontend-phase display

No

str

description

Description of a condition phase

No

str

depend_steps

Dependency phases

No

Step or step list

Table 2 Condition

Parameter

Description

Mandatory

Data Type

condition_type

Condition type. The "==", ">", ">=", "in", "<", "<=", "!=", and "or" operators are supported.

Yes

ConditionTypeEnum

left

Left value of a condition expression

Yes

int, float, str, bool, Placeholder, Sequence, Condition, MetricInfo

right

Right value of a condition expression

Yes

int, float, str, bool, Placeholder, Sequence, Condition, MetricInfo

Table 3 MetricInfo

Parameter

Description

Mandatory

Data Type

input_data

Metric input. Currently, only the output of JobStep is supported.

Yes

JobStep output

json_key

Key value corresponding to the metric information to be obtained

Yes

str

Description of the structure:

  • Condition object, which consists of the condition type, left value, and right value
    • The condition type is obtained from ConditionTypeEnum. The "==", ">", ">=", "in", "<", "<=", "!=", and "or" operators are supported. The following table describes the mapping.

      Enumerated Type

      Operator

      ConditionTypeEnum.EQ

      ==

      ConditionTypeEnum.GT

      >

      ConditionTypeEnum.GTE

      >=

      ConditionTypeEnum.IN

      in

      ConditionTypeEnum.LT

      <

      ConditionTypeEnum.LTE

      <=

      ConditionTypeEnum.NOT

      !=

      ConditionTypeEnum.OR

      or

    • The left and right values support the following types: integer, float, string, bool, placeholder, sequence, condition, and MetricInfo.
    • A condition phase supports a list of condition objects. The && operation is performed between multiple conditions.
  • if_then_steps and else_then_steps
    • if_then_steps indicates a list of phases that are ready for execution if conditions evaluate to true. In this case, steps in else_then_steps are skipped.
    • else_then_steps indicates a list of phases that are ready for execution if conditions evaluate to false. In this case, steps in if_then_steps are skipped.