GetTask

Updated at:

Retrieves the details of a specified task.

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:*

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Id

integer

Yes

The ID of the scheduled task. You can obtain the ID from PagingInfo.Tasks[].Id returned by ListTasks.

1234

ProjectEnv

string

No

The project environment. Valid values:

  • Prod: production

  • Dev: development

Valid values:

  • Prod :

    Production.

  • Dev :

    Development.

Prod

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID, which is used to locate logs and troubleshoot issues.

22C97E95-F023-56B5-8852-B1A77A17XXXX

Task

object

The detailed information about the task.

Name

string

The name.

SQL node

Description

string

The description.

test

WorkflowId

integer

The workflow ID.

1234

InstanceMode

string

The instance generation mode. Valid values:

  • T+1: Generated on the next day.

  • Immediately: Generated immediately.

T+1

Type

string

The task type.

ODPS_SQL

BaselineId

integer

The baseline ID.

1234

Priority

integer

The task priority. Valid values: 1 to 8. A larger value indicates a higher priority. Default value: 1.

1

Timeout

integer

The task execution timeout period, in seconds.

3600

RerunMode

string

The configuration that specifies whether the task can be rerun. Valid values:

  • AllDenied: The task cannot be rerun regardless of whether it succeeds or fails.

  • FailureAllowed: The task can be rerun only when it fails.

  • AllAllowed: The task can be rerun regardless of whether it succeeds or fails.

AllAllowed

RerunTimes

integer

The number of retries. This parameter takes effect only when the task is configured to allow reruns.

3

RerunInterval

integer

The retry time interval, in seconds.

60

Script

object

The script information.

Content

string

The script content.

echo "helloWorld"

Parameters

string

The list of script parameters.

para1=$bizdate

Trigger

object

The task trigger method.

Type

string

The trigger type. Valid values:

  • Scheduler: Triggered by a scheduling cycle.

  • Manual: Triggered manually.

Scheduler

Recurrence

string

The running mode when triggered. This parameter takes effect only when Type is set to Scheduler. Valid values:

  • Pause: Paused.

  • Skip: Dry run.

  • Normal: Normal execution.

Normal

Cron

string

The cron expression. This parameter takes effect only when Type is set to Scheduler.

00 00 00 * * ?

StartTime

string

The time when periodic triggering starts. This parameter applies only when Type is set to Scheduler.

The format is yyyy-MM-dd HH:mm:ss, such as 1970-01-01 00:00:00. This example does not include a time zone identifier.

1970-01-01 00:00:00

EndTime

string

The expiration time of the cycle trigger. This parameter takes effect only when Type is set to Scheduler.

The format is yyyy-MM-dd HH:mm:ss, such as 9999-01-01 00:00:00. The example does not include a time zone identifier.

9999-01-01 00:00:00

RuntimeResource

object

The runtime environment configuration, such as resource group information.

ResourceGroupId

string

The identifier of the scheduling resource group configured for task execution.

S_res_group_524258031846018_1684XXXXXXXXX

Image

string

The ID of the image configured for task execution.

i-xxxxxx

Cu

string

The compute unit (CU) consumption configured for task execution.

0.25

DataSource

object

The associated data source information.

Name

string

The name of the data source.

mysql_test

Inputs

object

The input information.

Variables

array<object>

The list of variable definitions.

object

Name

string

The name of the variable.

key1

Type

string

The type. Valid values:

  • Constant: Constant.

  • PassThrough: Parameter node output.

  • System: Variable.

  • NodeOutput: Script output.

Constant

Value

string

The value of the variable.

Value1

Outputs

object

The output information.

TaskOutputs

array<object>

The list of task output definitions.

object

Output

string

The output identifier.

pre.odps_sql_demo_0

Variables

array<object>

The list of variable definitions.

object

Name

string

The name of the variable.

key1

Type

string

The type. Valid values:

  • Constant: Constant.

  • PassThrough: Parameter node output.

  • System: Variable.

  • NodeOutput: Script output.

Constant

Value

string

The value of the variable.

value1

Dependencies

array<object>

The dependency information.

object

Type

string

The dependency type. Valid values:

  • CrossCycleDependsOnChildren: Cross-cycle dependency on first-level child nodes.

  • CrossCycleDependsOnSelf: Cross-cycle dependency on the node itself.

  • CrossCycleDependsOnOtherNode: Cross-cycle dependency on other nodes.

  • Normal: Same-cycle dependency.

Normal

UpstreamOutput

string

The output identifier of the upstream task. This field is returned when the dependency type is Normal and the input content is specified.

pre.odps_sql_demo_0

UpstreamTaskId

string

The ID of the upstream task. This field is returned when the dependency type is CrossCycleDependsOnOtherNode or Normal and the input content is not specified. This field is not returned in other cases.

1234

SubTasks

object

The nested configuration for complex tasks, such as loop nodes.

SubTasks

array<object>

The list of subtasks.

array<object>

Name

string

The name of the task.

SQL node

Description

string

The description.

test

WorkflowId

integer

The ID of the workflow to which the task belongs.

1234

Type

string

The task type.

ODPS_SQL

BaselineId

integer

The baseline ID.

12345

Priority

integer

The task priority. Valid values: 1 to 8. A larger value indicates a higher priority. Default value: 1.

1

Timeout

integer

The task execution timeout period, in seconds.

3600

RerunMode

string

The configuration that specifies whether the task can be rerun. Valid values:

  • AllDenied: The task cannot be rerun regardless of whether it succeeds or fails.

  • FailureAllowed: The task can be rerun only when it fails.

  • AllAllowed: The task can be rerun regardless of whether it succeeds or fails.

AllAllowed

RerunTimes

integer

The number of retries. This parameter takes effect only when the task is configured to allow reruns.

3

RerunInterval

integer

The retry time interval in seconds.

180

Trigger

object

The task trigger method.

Type

string

The trigger type. Valid values:

  • Scheduler: Triggered by a scheduling cycle.

  • Manual: Triggered manually.

Scheduler

Recurrence

string

The running mode when triggered. This parameter takes effect only when Type is set to Scheduler. Valid values:

  • Pause: Paused.

  • Skip: Dry run.

  • Normal: Normal execution.

Normal

Cron

string

The cron expression. This parameter takes effect only when Type is set to Scheduler.

00 00 00 * * ?

StartTime

string

The time when periodic triggering starts. This parameter applies only when Type is set to Scheduler.

The format is yyyy-MM-dd HH:mm:ss, such as 1970-01-01 00:00:00. This example does not include a time zone identifier.

1970-01-01 00:00:00

EndTime

string

The expiration time of the cycle trigger. This parameter takes effect only when Type is set to Scheduler.

The format is yyyy-MM-dd HH:mm:ss, such as 9999-01-01 00:00:00. The example does not include a time zone identifier.

9999-01-01 00:00:00

RuntimeResource

object

The runtime environment configuration, such as resource group information.

ResourceGroupId

string

The identifier of the scheduling resource group configured for task execution.

S_res_group_524258031846018_1684XXXXXXXXX

Image

string

The ID of the image configured for task execution.

i-xxxxxx

Cu

string

The compute unit (CU) consumption configured for task execution.

0.25

DataSource

object

The associated data source information.

Name

string

The name of the data source.

mysql_test

Id

integer

The unique identifier of the task.

1234

ProjectId

integer

The ID of the DataWorks workspace.

100

ProjectEnv deprecated

string

The project environment. [Deprecated] Use EnvType instead. Valid values:

  • Prod: production

  • Dev: development

Prod

EnvType

string

The project environment. Valid values:

  • Prod: production

  • Dev: development

Prod

Owner

string

The account ID of the task owner.

1000

CreateTime

integer

The creation time. The value is a 13-digit number, such as 1710239005403.

1710239005403

ModifyTime

integer

The update time. The value is a 13-digit number, such as 1710239005403.

1710239005403

CreateUser

string

The account ID of the user who created the task.

1000

ModifyUser

string

The account ID of the user who updated the task.

1000

Type

string

The subtask type. Valid values:

  • DoWhile: do-while node

  • Combined: combined node

  • ForEach: for-each node

Combined

Tags

array<object>

The list of node tags.

object

Key

string

The tag key.

key1

Value

string

The tag value.

value1

Id

integer

The unique identifier of the task.

1234

ProjectId

integer

The ID of the DataWorks workspace.

100

ProjectEnv deprecated

string

The project environment. [Deprecated] Use EnvType instead. Valid values:

  • Prod: production

  • Dev: development

Prod

EnvType

string

The project environment. Valid values:

  • Prod: production

  • Dev: development

Prod

Owner

string

The account ID of the task owner.

1000

CreateTime

integer

The creation time of the scheduled task. The value is a UNIX timestamp in milliseconds.

1710239005403

ModifyTime

integer

The last update time of the scheduled task. The value is a UNIX timestamp in milliseconds.

1710239005403

CreateUser

string

The account ID of the user who created the task.

1000

ModifyUser

string

The account ID of the user who updated the task.

1000

Examples

Success response

JSON format

{
  "RequestId": "22C97E95-F023-56B5-8852-B1A77A17XXXX",
  "Task": {
    "Name": "SQL node",
    "Description": "test",
    "WorkflowId": 1234,
    "InstanceMode": "T+1",
    "Type": "ODPS_SQL",
    "BaselineId": 1234,
    "Priority": 1,
    "Timeout": 3600,
    "RerunMode": "AllAllowed",
    "RerunTimes": 3,
    "RerunInterval": 60,
    "Script": {
      "Content": "echo \"helloWorld\"",
      "Parameters": "para1=$bizdate"
    },
    "Trigger": {
      "Type": "Scheduler",
      "Recurrence": "Normal",
      "Cron": "00 00 00 * * ?",
      "StartTime": "1970-01-01 00:00:00",
      "EndTime": "9999-01-01 00:00:00"
    },
    "RuntimeResource": {
      "ResourceGroupId": "S_res_group_524258031846018_1684XXXXXXXXX",
      "Image": "i-xxxxxx\n",
      "Cu": "0.25"
    },
    "DataSource": {
      "Name": "mysql_test"
    },
    "Inputs": {
      "Variables": [
        {
          "Name": "key1",
          "Type": "Constant\n",
          "Value": "Value1\n"
        }
      ]
    },
    "Outputs": {
      "TaskOutputs": [
        {
          "Output": "pre.odps_sql_demo_0"
        }
      ],
      "Variables": [
        {
          "Name": "key1",
          "Type": "Constant\n",
          "Value": "value1"
        }
      ]
    },
    "Dependencies": [
      {
        "Type": "Normal",
        "UpstreamOutput": "pre.odps_sql_demo_0",
        "UpstreamTaskId": "1234"
      }
    ],
    "SubTasks": {
      "SubTasks": [
        {
          "Name": "SQL node\n",
          "Description": "test",
          "WorkflowId": 1234,
          "Type": "ODPS_SQL\n",
          "BaselineId": 12345,
          "Priority": 1,
          "Timeout": 3600,
          "RerunMode": "AllAllowed",
          "RerunTimes": 3,
          "RerunInterval": 180,
          "Trigger": {
            "Type": "Scheduler",
            "Recurrence": "Normal\n",
            "Cron": "00 00 00 * * ?\n",
            "StartTime": "1970-01-01 00:00:00\n",
            "EndTime": "9999-01-01 00:00:00\n"
          },
          "RuntimeResource": {
            "ResourceGroupId": "S_res_group_524258031846018_1684XXXXXXXXX",
            "Image": "i-xxxxxx",
            "Cu": "0.25"
          },
          "DataSource": {
            "Name": "mysql_test\n"
          },
          "Id": 1234,
          "ProjectId": 100,
          "ProjectEnv": "Prod",
          "EnvType": "Prod",
          "Owner": "1000\n",
          "CreateTime": 1710239005403,
          "ModifyTime": 1710239005403,
          "CreateUser": "1000\n",
          "ModifyUser": "1000\n"
        }
      ],
      "Type": "Combined"
    },
    "Tags": [
      {
        "Key": "key1",
        "Value": "value1"
      }
    ],
    "Id": 1234,
    "ProjectId": 100,
    "ProjectEnv": "Prod",
    "EnvType": "Prod",
    "Owner": "1000",
    "CreateTime": 1710239005403,
    "ModifyTime": 1710239005403,
    "CreateUser": "1000\n",
    "ModifyUser": "1000"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.