This topic describes succeed steps and related examples.

Overview

A succeed step ends a series of serial steps in advance, similar to return in programming languages. Flow Definition Language (FDL) steps are serial steps. In general, a next step is executed after a previous step is completed. However, after a succeed step is executed, subsequent steps are not executed. Succeed steps are usually used together with choice steps. When the conditions of a choice step are met, the flow goes to a succeed step, and no other steps are executed.

A succeed step contains the following attributes:

  • type: Required. The step type. The value succeed indicates that the step is a succeed step.
  • name: Required. The step name.
  • inputMappings: Optional. The input mappings.
  • outputMappings: Optional. The output mappings.

Examples

The following sample flow ends in advance by using a succeed step.

  • If the value of status in the input is ready, the pass1 and final steps of the first choice are executed in sequence. The final step is a succeed step. Therefore, after it is executed, the handle_failure step will not be executed.
  • If the value of status in the input is failed, the goto instructions of the second choice are executed, the choice step ends, and the handle_failure step is executed.
  • If the input does not contain status or the value of status is neither ready nor failed, the default choice is executed, that is, the pass2 and handle_failure steps are executed.
version: v1
type: flow
steps:
  - type: choice
    name: mychoice
    choices:
      - condition: $.status == "ready"
        # choice with steps
        steps:
          - type: pass
            name: pass1
      - condition: $.status == "failed"
        # choice with goto
        goto: handle_failure
    default:
      # choice with both steps and goto
      steps:
        - type: pass
          name: pass2
      goto: handle_failure
  - type: succeed
    name: final
  - type: pass
    name: handle_failure