Creating a Workflow
API Description
You can use this API to create a workflow based on a template.
Method Definition
WorkflowClient.createWorkflow(templateName, graphName, agency, description=None, parameters=None)
Request Parameters
|
Parameter |
Mandatory or Optional |
Type |
Description |
Constraint |
|---|---|---|---|---|
|
graphName |
Mandatory |
str |
Workflow name |
The name must be unique, starts with a letter or digit, and contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
|
templateName |
Mandatory |
str |
Workflow template name |
The name must be unique, starts with a letter or digit, and contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
|
description |
Optional |
str |
Workflow description |
The description contains 0 to 256 characters. Only letters, digits, commas (,), periods (.), colons (:), hyphens (-), underscores (_), and spaces are allowed. |
|
agency |
Mandatory |
str |
Agency name. OBS Data+ requires an agency to access FunctionGraph. |
The agency grants OBS Data+ the permissions to access FunctionGraph. |
|
parameters |
Optional |
Array Input JSON structure |
Parameters that can be modified in a workflow |
- |
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
|
GetResult.body Type |
Description |
|---|---|
|
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'
)
# Create a workflow.
try:
resp = workflowClient.createWorkflow('templateName', 'graphName', 'agency', description='description', parameters='parameters')
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()
Last Article: Managing Workflows
Next Article: Querying a Workflow
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.