CreateWorkflowInstances

Updated at:

Creates a workflow instance from the specified configuration, for example, a data backfill workflow instance.

Operation description

You must purchase DataWorks Basic Edition or higher to use this operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:CreateWorkflowInstances

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The project ID.

100

EnvType

string

No

The project environment. Valid values:

  • Prod: production

  • Dev: development

Valid values:

  • Prod :

    Production.

  • Dev :

    Development.

Prod

WorkflowId

integer

Yes

The ID of the workflow to which the task belongs. The WorkflowId of all scheduled tasks is 1.

1

Name

string

Yes

The name.

WorkflowInstance1

Periods

object

No

The data backfill period settings.

BizDates

array<object>

Yes

The list of business dates. You can specify multiple business date ranges, up to a maximum of 7 ranges.

object

No

EndBizDate

string

Yes

The end business date. Format: yyyy-mm-dd.

2024-11-24

StartBizDate

string

Yes

The start business date. Format: yyyy-mm-dd.

2024-11-20

EndTime

string

No

The end time of the period. Specify the time in the hh:mm:ss format (24-hour clock). Default value: 23:59:59.

If you specify this field, you must also specify StartTime.

23:59:59

StartTime

string

No

The start time of the period. Specify the time in the hh:mm:ss format (24-hour clock). Default value: 00:00:00.

If you specify this field, you must also specify EndTime.

00:00:00

Type

string

Yes

The type of the workflow instance. Valid values:

  • SupplementData: Indicates data backfill. The methods for specifying RootTaskIds and IncludeTaskIds vary based on the data backfill mode. For more information, see the parameter description of DefaultRunProperties.Mode.

  • ManualWorkflow: Indicates a manual business flow. Set WorkflowId to the ID of the manual business flow. RootTaskIds is optional. If you do not specify RootTaskIds, the default root node list of the manual business flow is used.

  • Manual: Indicates a manual task. You only need to specify RootTaskIds, which is the list of manual tasks to be run.

  • SmokeTest: Indicates a smoke test. You only need to specify RootTaskIds, which is the list of test tasks to be run.

  • TriggerWorkflow: Indicates an event-triggered workflow. Set WorkflowId to the ID of the event-triggered workflow. IncludeTaskIds is optional. If you do not specify IncludeTaskIds, the entire workflow is run.

Valid values:

  • SmokeTest :

    Smoke test. You only need to specify RootTaskIds, which is the list of test tasks to be run.

  • TriggerWorkflow :

    Event-triggered workflow. Set WorkflowId to the ID of the event-triggered workflow. IncludeTaskIds is optional. If you do not specify IncludeTaskIds, the entire workflow is run.

  • Manual :

    Manual task. You only need to specify RootTaskIds, which is the list of manual tasks to be run.

  • SupplementData :

    Data backfill. The methods for specifying RootTaskIds and IncludeTaskIds vary based on the data backfill mode. For more information, see the parameter description of DefaultRunProperties.Mode.

  • ManualWorkflow :

    Manual business flow. Set WorkflowId to the ID of the manual business flow. RootTaskIds is optional. If you do not specify RootTaskIds, the default root node list of the manual business flow is used.

SupplementData

WorkflowParameters

string

No

The workflow parameters. This parameter takes effect only when a specific workflow is specified (WorkflowId != 1). For a periodic workflow or an event-triggered workflow, the format is key=value, and the priority is lower than that of task parameters. For a manual business flow, the format is JSON, and the priority is higher than that of task parameters.

"key=value" format: key1=value1 key2=value2 JSON format: {"key1":"value1", "key2": "value2"}

TaskParameters

string

No

The parameters for specific tasks, in JSON format. Each key is a task ID, and each value follows the format of the task script parameters (Task.Script.Parameter in the response of the GetTask operation).

{ "1001": "key1=val2 key2=val2", "1002": "key1=val2 key2=val2" }

AutoStartEnabled

boolean

No

Specifies whether to run the workflow instance immediately after it is created. Default value: true.

true

DefaultRunProperties

object

No

The runtime configurations.

Alert

object

No

The alert configurations.

NoticeType

string

No

The notification method. Valid values:

  • Sms: Sends SMS messages only.

  • Mail: Sends emails only.

  • SmsMail: Sends both SMS messages and emails.

Valid values:

  • Mail :

    Sends emails only.

  • Sms :

    Sends SMS messages only.

  • SmsMail :

    Sends both SMS messages and emails.

Sms

Type

string

No

The alert policy. Valid values:

  • Success: Alerts on success.

  • Failure: Alerts on failure.

  • SuccessFailure: Alerts on both success and failure.

Valid values:

  • SuccessFailure :

    Alerts on both success and failure.

  • Failure :

    Alerts on failure.

  • Success :

    Alerts on success.

Success

Analysis

object

No

The analysis configurations. This parameter is required when Type is set to SupplementData.

Blocked

boolean

No

Specifies whether to block the run if the analysis fails. This parameter is required when Type is set to SupplementData.

true

Enabled

boolean

No

Specifies whether to enable analysis. This parameter is required when Type is set to SupplementData.

true

DataSourceNameMappings

object

No

The data source name mappings used during data backfill runs. The key in the map is DataSource.Name in the task definition, and the value is DataSource.Name used during the data backfill run. This parameter takes effect only when Type is set to SupplementData. If this parameter is not configured, an empty map is passed, or the key does not match, the task continues to use the original data source. Currently, only EMR Spark SQL, EMR Shell, and EMR Spark tasks are supported.

{"emr_cluster":"emr_cluster"}

string

No

The data source name configured in the task definition, namely DataSource.Name.

emr_cluster

ExcludeProjectIds

array

No

The list of project IDs to exclude from the run.

integer

No

The project ID.

200

ExcludeTaskIds

array

No

The list of task IDs to exclude from the run.

integer

No

The task ID.

4321

IncludeProjectIds

array

No

The list of project IDs to include in the run.

integer

No

The project ID.

100

IncludeTaskIds

array

No

The list of task IDs to include in the run.

integer

No

The task ID.

1234

Mode

string

No

The data backfill mode. Default value: ManualSelection. This parameter is required when Type is set to SupplementData. Valid values:

  • General: Indicates the general mode. You can specify only one value for RootTaskIds. IncludeTaskIds is optional. If you do not specify IncludeTaskIds, the value of RootTaskIds is included by default.

  • ManualSelection: Indicates the manual selection mode. You can specify multiple values for RootTaskIds. IncludeTaskIds is optional. If you do not specify IncludeTaskIds, the values of RootTaskIds are included by default.

  • Chain: Indicates the chain mode. RootTaskIds must be left empty. You must specify two IDs for IncludeTaskIds, which are the start and end tasks.

  • AllDownstream: Indicates the all downstream mode. You can specify only one value for RootTaskIds.

Valid values:

  • Chain :

    Chain mode.

  • ManualSelection :

    Manual selection.

  • General :

    General mode.

  • Huge :

    Massive mode.

  • AllDownstream :

    All downstream.

ManualSelection

Order

string

No

The run order. Default value: Asc. Valid values:

  • Asc: Ascending order by business date.

  • Desc: Descending order by business date.

Valid values:

  • Asc :

    Ascending order by business date.

  • Desc :

    Descending order by business date.

Asc

Parallelism

integer

No

The number of tasks to run in parallel. Use a value from 2 to 10 for parallel execution, or 1 for sequential execution. This parameter is required when Type is set to SupplementData.

2

Priority

integer

No

The run priority. Valid values: 1 to 11. A larger value indicates a higher priority. These parameter settings are supported only for manual business flows and event-triggered workflows.

1

PriorityWeightStrategy

string

No

The priority weight policy. These parameter settings are supported only for manual business flows and event-triggered workflows. Valid values:

  • Disable: Disables the priority weight policy. This is the default value.

  • Upstream: Calculates the sum of the weights of the upstream nodes of the current node. A deeper hierarchy indicates a higher weight.

Valid values:

  • Upstream :

    Calculates the sum of the weights of the upstream nodes of the current node. A deeper hierarchy indicates a higher weight.

  • Disable :

    Disables the priority weight strategy. This is the default value.

Upstream

RootTaskIds

array

No

The list of root task IDs.

  • When Type is set to SupplementData, RootTaskIds is required except when Mode is set to Chain.

  • When Type is set to ManualWorkflow, RootTaskIds is optional. If you do not specify RootTaskIds, the default root node list of the manual business flow is used.

  • When Type is set to Manual, RootTaskIds is required and specifies the list of manual tasks to be run.

  • When Type is set to SmokeTest, RootTaskIds is required and specifies the list of test tasks to be run.

integer

No

The task ID.

1234

RunPolicy

object

No

The run policy. If this field is left empty, the task configuration is used.

EndTime

string

No

The end run time. Specify the time in the hh:mm:ss format (24-hour clock). This field is required if a run policy is configured.

23:59:59

Immediately

boolean

No

Specifies whether the run can be started immediately if the run time is in the future. Default value: false.

false

StartTime

string

No

The start run time. Specify the time in the hh:mm:ss format (24-hour clock). This field is required if a run policy is configured.

00:00:00

Type

string

No

The time period type. This field is required if a run policy is configured. Valid values:

  • Daily: Runs every day.

  • Weekend: Runs on weekends only.

Valid values:

  • Daily :

    Runs every day.

  • Weekend :

    Runs on weekends only.

Daily

RuntimeResource

string

No

The identifier of the custom scheduling resource group. If this field is left empty, the task configuration is used.

S_res_group_524258031846018_1684XXXXXXXXX

Comment

string

No

The reason for the creation.

create for test

Tags

array<object>

No

The list of tags for the task.

object

No

Key

string

No

The tag key.

tagKey

Value

string

No

The tag value.

tagValue

TagCreationPolicy

string

No

The tag creation policy.

  • Append: Append mode. Inherits existing tags from the manual workflow and appends new tags.

  • Overwrite: Overwrite mode. Does not inherit existing tags from the manual workflow and directly creates tags.

Valid values:

  • Overwrite :

    Overwrite mode. Does not inherit existing tags from the manual workflow and directly creates tags.

  • Append :

    Append mode. Inherits existing tags from the manual workflow and appends new tags.

Append

Response elements

Element

Type

Description

Example

object

OperationId

string

The operation ID. You can use this field to query the result of the creation operation by calling the GetCreateWorkflowInstancesResult operation.

e15ad21c-b0e9-4792-8f55-b037xxxxxxxx

RequestId

string

The request ID. You can use this ID to locate logs and troubleshoot issues.

22C97E95-F023-56B5-8852-B1A77A17XXXX

Examples

Success response

JSON format

{
  "OperationId": "e15ad21c-b0e9-4792-8f55-b037xxxxxxxx",
  "RequestId": "22C97E95-F023-56B5-8852-B1A77A17XXXX"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.