All Products
Search
Document Center

DataWorks:GetTask

最終更新日:Dec 19, 2025

Queries the information about a task.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
IdlongYes

The task ID.

1234
ProjectEnvstringNo

The environment of the workspace. Valid values:

  • Prod: production environment
  • Dev: development environment
Prod

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

22C97E95-F023-56B5-8852-B1A77A17XXXX
Taskobject

The details of the task.

Namestring

The name of the task.

SQL node
Descriptionstring

The description of the task.

test
WorkflowIdlong

The workflow ID.

1234
InstanceModestring

The instance generation mode. Valid values:

  • T+1
  • Immediately
T+1
Typestring

The type of the task.

ODPS_SQL
BaselineIdlong

The baseline ID.

1234
Priorityinteger

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

1
Timeoutinteger

The timeout period of task running. Unit: seconds.

3600
RerunModestring

The rerun mode. Valid values:

  • AllDenied: The task cannot be rerun regardless of whether the task is successfully run or fails to be run.
  • FailureAllowed: The task can be rerun only after it fails to be run.
  • AllAllowed: The task can be rerun regardless of whether the task is successfully run or fails to be run.
AllAllowed
RerunTimesinteger

The number of times that the task is rerun. This parameter takes effect only if the RerunMode parameter is set to AllAllowed or FailureAllowed.

3
RerunIntervalinteger

The rerun interval. Unit: seconds.

60
Scriptobject

The script information.

Contentstring

The script content.

echo "helloWorld"
Parametersstring

The script parameters.

para1=$bizdate
Triggerobject

The method to trigger task scheduling.

Typestring

The trigger type. Valid values:

  • Scheduler: periodic scheduling
  • Manual: manual scheduling
Scheduler
Recurrencestring

The running mode of the task after it is triggered. This parameter takes effect only if the Type parameter is set to Scheduler. Valid values:

  • Pause
  • Skip
  • Normal
Normal
Cronstring

The CRON expression of the task. This parameter takes effect only if the Type parameter is set to Scheduler.

00 00 00 * * ?
StartTimestring

The start time of the time range during which the task is periodically scheduled. This parameter takes effect only if the Type parameter is set to Scheduler.

1970-01-01 00:00:00
EndTimestring

The end time of the time range during which the task is periodically scheduled. This parameter takes effect only if the Type parameter is set to Scheduler.

9999-01-01 00:00:00
RuntimeResourceobject

The configurations of the runtime environment, such as the resource group information.

ResourceGroupIdstring

The ID of the resource group for scheduling configured for task running.

S_res_group_524258031846018_1684XXXXXXXXX
Imagestring

The ID of the image configured for task running.

i-xxxxxx
Custring

The default number of compute units (CUs) configured for task running.

0.25
DataSourceobject

The information about the associated data source.

Namestring

The name of the data source.

mysql_test
Inputsobject

The input information.

Variablesarray<object>

The variables.

Variableobject
Namestring

The name of the variable.

key1
Typestring

The type. Valid values:

  • Constant: constant
  • PassThrough: node output
  • System: variable
  • NodeOutput: script output
Constant
Valuestring

The value of the variable.

Value1
Outputsobject

The output information.

TaskOutputsarray<object>

The task outputs.

TaskOutputobject
Outputstring

The identifier of the output.

pre.odps_sql_demo_0
Variablesarray<object>

The variables.

Variableobject
Namestring

The name of the variable.

key1
Typestring

The type. Valid values:

  • Constant: constant
  • PassThrough: node output
  • System: variable
  • NodeOutput: script output
Constant
Valuestring

The value of the variable.

value1
Dependenciesarray<object>

The dependency information.

Dependencieobject
Typestring

The dependency type. Valid values:

  • CrossCycleDependsOnChildren: cross-cycle dependency on level-1 descendant nodes
  • CrossCycleDependsOnSelf: cross-cycle dependency on the current node
  • CrossCycleDependsOnOtherNode: cross-cycle dependency on other nodes
  • Normal: same-cycle scheduling dependency
Normal
UpstreamOutputstring

The identifier of the output of the ancestor task. This parameter is returned only if same-cycle scheduling dependencies and the node input are configured.

pre.odps_sql_demo_0
UpstreamTaskIdstring

The ancestor task ID. This parameter is returned only if cross-cycle scheduling dependencies or same-cycle scheduling dependencies and the node input are not configured.

1234
SubTasksobject

The configurations of the subtasks, such as a do-while node.

SubTasksarray<object>

The subtasks.

SubTaskobject
Namestring

The name of the task.

SQL node
Descriptionstring

The description of the task.

test
WorkflowIdlong

The ID of the workflow to which the task belongs.

1234
Typestring

The type of the task.

ODPS_SQL
BaselineIdlong

The baseline ID.

The baseline ID.
Priorityinteger

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

1
Timeoutinteger

The timeout period of task running. Unit: seconds.

3600
RerunModestring

The rerun mode. Valid values:

  • AllDenied: The task cannot be rerun regardless of whether the task is successfully run or fails to be run.
  • FailureAllowed: The task can be rerun only after it fails to be run.
  • AllAllowed: The task can be rerun regardless of whether the task is successfully run or fails to be run.
AllAllowed
RerunTimesinteger

The number of times that the task is rerun. This parameter takes effect only if the RerunMode parameter is set to AllAllowed or FailureAllowed.

3
RerunIntervalinteger

The rerun interval. Unit: seconds.

180
Triggerobject

The method to trigger task scheduling.

Typestring

The trigger type. Valid values:

  • Scheduler: periodic scheduling
  • Manual: manual scheduling
Scheduler
Recurrencestring

The running mode of the task after it is triggered. This parameter takes effect only if the Type parameter is set to Scheduler. Valid values:

  • Pause
  • Skip
  • Normal
Normal
Cronstring

The CRON expression of the task. This parameter takes effect only if the Type parameter is set to Scheduler.

00 00 00 * * ?
StartTimestring

The start time of the time range during which the task is periodically scheduled. This parameter takes effect only if the Type parameter is set to Scheduler.

1970-01-01 00:00:00
EndTimestring

The end time of the time range during which the task is periodically scheduled. This parameter takes effect only if the Type parameter is set to Scheduler.

9999-01-01 00:00:00
RuntimeResourceobject

The runtime environment configuration of the task, such as the resource group.

ResourceGroupIdstring

The ID of the resource group for scheduling configured for task running.

S_res_group_524258031846018_1684XXXXXXXXX
Imagestring

The ID of the image configured for task running.

i-xxxxxx
Custring

The default number of CUs configured for task running.

0.25
DataSourceobject

The information about the associated data source.

Namestring

The name of the data source.

mysql_test
Idlong

The task ID.

1234
ProjectIdlong

The workspace ID.

100
ProjectEnvdeprecatedstring

The environment of the workspace. This parameter is deprecated and replaced by the EnvType parameter. Valid values:

  • Prod: production environment
  • Dev: development environment
Prod
EnvTypestring

The environment of the workspace. Valid values:

  • Prod: production environment
  • Dev: development environment
Prod
Ownerstring

The account ID of the task owner.

1000
CreateTimelong

The creation time.

1710239005403
ModifyTimelong

The modification time.

1710239005403
CreateUserstring

The account ID of the creator.

1000
ModifyUserstring

The account ID of the modifier.

1000
Typestring

The type of the subtask. Valid values:

  • DoWhile: do-while node
  • Combined: node group
  • ForEach: for-each node
Combined
Tagsarray<object>

The tags.

Tagobject
Keystring

The tag key.

key1
Valuestring

The tag value.

value1
Idlong

The instance ID.

1234
ProjectIdlong

The workspace ID.

100
ProjectEnvdeprecatedstring

The environment of the workspace. This parameter is deprecated and replaced by the EnvType parameter. Valid values:

  • Prod: production environment
  • Dev: development environment
Prod
EnvTypestring

The environment of the workspace. Valid values:

  • Prod: production environment
  • Dev: development environment
Prod
Ownerstring

The account ID of the task owner.

1000
CreateTimelong

The creation time.

1710239005403
ModifyTimelong

The modification time.

1710239005403
CreateUserstring

The account ID of the creator.

1000
ModifyUserstring

The account ID of the modifier.

1000

Examples

Sample success responses

JSONformat

{
  "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",
          "Description": "test",
          "WorkflowId": 1234,
          "Type": "ODPS_SQL\n",
          "BaselineId": 0,
          "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,
          "CreateTime": 1710239005403,
          "ModifyTime": 1710239005403,
          "CreateUser": 1000,
          "ModifyUser": 1000
        }
      ],
      "Type": "Combined"
    },
    "Tags": [
      {
        "Key": "key1",
        "Value": "value1"
      }
    ],
    "Id": 1234,
    "ProjectId": 100,
    "ProjectEnv": "Prod",
    "EnvType": "Prod",
    "Owner": 1000,
    "CreateTime": 1710239005403,
    "ModifyTime": 1710239005403,
    "CreateUser": 1000,
    "ModifyUser": 1000
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-01-21The response structure of the API has changedView Change Details
2025-01-07The response structure of the API has changedView Change Details
2024-11-20The response structure of the API has changedView Change Details