All Products
Search
Document Center

Data Management:CreateTask

Last Updated:Oct 21, 2024

Creates a task node for a task flow.

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
TidlongNo

The tenant ID.

Note To view the tenant ID, move the pointer over the profile picture in the upper-right corner of the Data Management (DMS) console. For more information, see the "View information about the current tenant" section of the Manage DMS tenants topic.
3***
DagIdlongYes

The ID of the task flow. You can call the ListTaskFlow or ListLhTaskFlowAndScenario operation to query the task flow ID.

7***
NodeNamestringYes

The name of the node that you want to create.

zhttest
NodeTypestringYes

The type of the node that you want to create. For more information about the valid values for this parameter, see NodeType parameter.

36
NodeContentstringNo

The configuration of the node.

test
TimeVariablesstringNo

The time variables configured for the node.

test
NodeOutputstringNo

The output variables configured for the task.

test
GraphParamstringNo

The position of the node on the Directed Acyclic Graph (DAG).

test

Description of node-related parameters

The configuration of a node varies based on the node type. This topic is a supplementary description of task node-related operations, such as CreateTask and UpdateTaskOutput. The NodeParam, NodeContent, and GraphParam parameters apply to all task node-related operations.
Only nodes such as single-instance SQL assignment, script code, and Elastic Compute Service (ECS) remote command have output variables. The configurations of output variables vary based on the node type. For more information, see the related topic of the UpdateTaskOutput operation.

SQL for single instance

  • DagId
  • NodeName
  • NodeType: 1
  • NodeParam
  • GraphParam
  • NodeContent:
{
    "dbId":123456, // The database ID.
    "sql":"/* Use the database syntax for the current node to write SQL statements */", // The SQL statement.
    "dbType":"lindorm_sql" // The database type.
}

Script

  • DagId
  • NodeName
  • NodeType: 28
  • NodeParam
  • GraphParam
  • NodeOutput
{
    "outputs":[
        {
            "extractMethod":"json", // The value is in the JSON format.
            "variableName":"var", // The name of the variable.
            "description":"demo desc" // The description of the variable.
        }
    ]
}
  • NodeContent:
{
    "regionId":"cn-hangzhou", // The region ID.
    "gatewayId":"dg-xxxxxxxxxxxxxx", // The gateway ID.
    "gatewayInstanceId":"dg-node-xxxxxxxxxxxxxx", // The ID of the gateway instance.
    "scriptFileName":"demo.sh", // The file name.
    "args":[ // The running parameters.
        "-n value",
        "-n1 value1"
    ]
}

Lock-free data change

  • DagId
  • NodeName
  • NodeType: 24
  • NodeParam
  • GraphParam
  • NodeContent:
{
    "dbId":123456, // The database ID.
    "sql":"/* Use the database syntax for the current node to write SQL statements */", // The SQL statement.
    "dbType":"polardb" // The database type.
}

SQL assignment for single instance

  • DagId
  • NodeName
  • NodeType: 32
  • NodeParam
  • GraphParam
  • NodeOutput:
{
    "outputs":[
        {
            /*
            // The variable extraction settings.
            {
                "row":0, // Rows. A value of -1 indicates all rows.
                "column":-1, // Columns. A value of -1 indicates all columns.
                "combiner":"," // The delimiter. If you select all rows or columns, you must specify a delimiter. The returned value of the variable is a string.
            }
            */
            "extractMethod":"{\"row\":0,\"column\":-1,\"combiner\":\",\"}", 
            "variableName":"var", // The name of the variable.
            "description":"For demo" // The description of the variable.
        }
    ]
}
  • NodeContent:
{
    "dbId":123456, // The database ID.
    "sql":"/* Use the database syntax for the current node to write SQL statements. Only SELECT statements are supported. By default, the maximum number of rows returned is 30. *", // The SQL statement.
    "dbType":"lindorm_cql" // The database type.
}

Dependency check

  • DagId
  • NodeName
  • NodeType: 2
  • NodeParam
  • GraphParam
  • NodeContent:
{
    "dependentDAGId":132, // Dependency object: task flow.
    "dependentNodeId":"", // Dependency object: a single node. By default, the dependency object is the specified task flow.
    "dependentStartTimePattern":"yyyy-MM-dd HH:mm|-2d+0h+0m", // The offset of the start time.
    "dependentEndTimePattern":"yyyy-MM-dd HH:mm|+1d +0h+0m", // The offset of the end time.
    "multiSuccessStrategy":2, // The instance check policy. A value of 0 specifies that the most previous node is successful. A value of 1 specifies that all nodes are successful. A value of 2 specifies that the specified node is successful
    "multiSuccessStrategyIndex":1 // Instance check policy: The node x+1 is successful.
}

Status check of a time column in a table

  • DagId
  • NodeName
  • NodeType: 2
  • NodeParam
  • GraphParam
  • NodeContent:
{
    "dependentDAGId":132, // Dependency object: task flow.
    "dependentNodeId":"", // Dependency object: a single node. By default, the dependency object is the specified task flow.
    "dependentStartTimePattern":"yyyy-MM-dd HH:mm|-2d+0h+0m", // The offset of the start time.
    "dependentEndTimePattern":"yyyy-MM-dd HH:mm|+1d +0h+0m", // The offset of the end time.
    "multiSuccessStrategy":2, // The instance check policy. A value of 0 specifies that the most previous node is successful. A value of 1 specifies that all nodes are successful. A value of 2 specifies that the specified node is successful
    "multiSuccessStrategyIndex":1 // Instance check policy: The node x+1 is successful.
}

SQL status check

  • DagId
  • NodeName
  • NodeType: 25
  • NodeParam
  • GraphParam
  • NodeContent:
{
    "dbId":123456,
    "sql":"/* Use the database syntax for the current node to write SQL statements*/ \n\n select 1 from abc",
    "dbType":"lindorm_cql"
}

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The ID of the request. You can use the ID to query logs and troubleshoot issues.

CFD8FE00-36D9-4C1B-940D-65A7B73D9066
ErrorCodestring

The error code returned.

InvalidParameterValid
ErrorMessagestring

The error message returned if the request failed.

InvalidParameterValid
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
NodeIdlong

The ID of the task node returned when the task was created.

3***

Examples

Sample success responses

JSONformat

{
  "RequestId": "CFD8FE00-36D9-4C1B-940D-65A7B73D9066",
  "ErrorCode": "InvalidParameterValid",
  "ErrorMessage": "InvalidParameterValid",
  "Success": true,
  "NodeId": 0
}

Error codes

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

Change history

Change timeSummary of changesOperation
No change history