Querying the Workflow Instance List

API Description

You can use this API to query the workflow instance list.

Method Definition

WorkflowClient.listWorkflowExecution(graphName, executionType=None, nextMarker=None, limit=None, executionState=None)

Request Parameters

Parameter

Mandatory or Optional

Type

Description

Constraint

executionType

Optional

str

Execution type of a workflow instance

It can be set to one of the following enumerated values:

  • APICALL: Queries the list of workflow instances that are triggered by APIs.
  • TRIGGERCAL: Queries the list of workflow instances that are triggered by events.

nextMarker

Optional

str

Specifies an identifier when listing workflow instances. The returned workflow instance list contains all workflow instances after the specified identifier in alphabetical order.

The identifier consists of two parts:

Trigger type + Workflow instance name. For details about the enumerated values of the trigger type, see the constraints of the executionType field.

limit

Optional

int

Maximum number of returned records

The value ranges from 1 to 1000. If this parameter is not specified, the default value 10 is used.

graphName

Mandatory

str

Workflow name

The workflow must be an existing one.

executionState

Optional

str

Current status of a workflow instance

RUNNING, SUCCESS, FAILED

Returned Results

Type

Description

GetResult

SDK common result object

GetResult.body Type

Description

Response Result of the Request for Querying the Workflow Instance List

Response result

Sample Code

# Import the module.
from obs import WorkflowClient

# Create a WorkflowClient instance.
workflowClient = WorkflowClient(
    access_key_id='*** Provide your Access Key ***',
    secret_access_key='*** Provide your Secret Key ***',
    server='https://your-endpoint'
)

# Query the workflow instance list.
try:
    resp = workflowClient.listWorkflowExecution('graphName', executionType='executionType', nextMarker='nextMarker', limit='limit', executionState='executionState')
      
    if resp.status < 300: 
        print('requestId:', resp.requestId) 
    else: 
        print('errorCode:', resp.errorCode) 
        print('errorMessage:', resp.errorMessage)
except:
    import traceback
    print(traceback.format_exc())

# Close workflowClient.
workflowClient.close()