Querying a Workflow

API Description

You can use this API to query workflows by name.

Method Definition

WorkflowClient.getWorkflow(graphName)

Request Parameters

Parameter

Mandatory or Optional

Type

Description

Constraint

graphName

Mandatory

str

Workflow name

The name should start with a letter or digit, and contain a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Returned Results

Type

Description

GetResult

SDK common result object

GetResult.body Type

Description

Response Result of the Request for Querying Workflows

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 a workflow.
try:
    resp = workflowClient.getWorkflow('graphName')
      
    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()