tencent cloud

文档反馈

DescribeTask

最后更新时间:2023-05-04 15:47:08

1. API Description

Domain name for API request: batch.tencentcloudapi.com.

This API is used to query the details of a specified task, including information of the task instances inside the task.

A maximum of 3 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeTask.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region No String Common Params. This parameter is not required for this API.
JobId Yes String Job ID
TaskName Yes String Task name
Offset No Integer Offset
Limit No Integer Number of returned results. Default value: 100. Maximum value: 1,000.
Filters.N No Array of Filter Filter as detailed below:
  • task-instance-type - String - Optional - Filter by the task instance state. (SUBMITTED, PENDING, RUNNABLE, STARTING, RUNNING, SUCCEED, FAILED, FAILED_INTERRUPTED).
  • 3. Output Parameters

    Parameter Name Type Description
    JobId String Job ID
    TaskName String Task name
    TaskState String Task status
    CreateTime String Creation time
    EndTime String End time
    TaskInstanceTotalCount Integer Total number of task instances
    TaskInstanceSet Array of TaskInstanceView Task instance information
    TaskInstanceMetrics TaskInstanceMetrics Task instance statistical metrics
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Queries task details

    Input Example

    https://batch.tencentcloudapi.com/?Action=DescribeTask
    &JobId=job-97zcl3wt
    &TaskName=A
    &Filters.0.Name=task-instance-state
    &Filters.0.Values.0=SUCCEED
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "TaskInstanceSet": [
                {
                    "TaskInstanceIndex": 1,
                    "RedirectInfo": {
                        "StderrRedirectFileName": "stderr.job-97zcl3wt.A.1.log",
                        "StdoutRedirectFileName": "stdout.job-97zcl3wt.A.1.log",
                        "StdoutRedirectPath": "cos://dondonbatch-1251783334.cosgz.myqcloud.com/hello2/logs/",
                        "StderrRedirectPath": "cos://dondonbatch-1251783334.cosgz.myqcloud.com/hello2/logs/"
                    },
                    "RunningTime": "2018-02-07T09:29:55Z",
                    "LaunchTime": "2018-02-07T09:29:09Z",
                    "StateReason": "",
                    "StateDetailedReason": "xx",
                    "ComputeNodeInstanceId": null,
                    "EndTime": "2018-02-07T09:30:23Z",
                    "TaskInstanceState": "SUCCEED",
                    "CreateTime": "2018-02-07T09:29:09Z",
                    "ExitCode": 0
                },
                {
                    "TaskInstanceIndex": 0,
                    "RedirectInfo": {
                        "StderrRedirectFileName": "stderr.job-97zcl3wt.A.0.log",
                        "StdoutRedirectFileName": "stdout.job-97zcl3wt.A.0.log",
                        "StdoutRedirectPath": "cos://dondonbatch-1251783334.cosgz.myqcloud.com/hello2/logs/",
                        "StderrRedirectPath": "cos://dondonbatch-1251783334.cosgz.myqcloud.com/hello2/logs/"
                    },
                    "RunningTime": "2018-02-07T09:30:02Z",
                    "LaunchTime": "2018-02-07T09:29:09Z",
                    "StateReason": "",
                    "StateDetailedReason": "xx",
                    "ComputeNodeInstanceId": null,
                    "EndTime": "2018-02-07T09:30:31Z",
                    "TaskInstanceState": "SUCCEED",
                    "CreateTime": "2018-02-07T09:29:09Z",
                    "ExitCode": 0
                }
            ],
            "TaskState": "SUCCEED",
            "JobId": "job-97zcl3wt",
            "TaskInstanceMetrics": {
                "PendingCount": 0,
                "FailedCount": 0,
                "StartingCount": 0,
                "SucceedCount": 2,
                "FailedInterruptedCount": 0,
                "SubmittedCount": 0,
                "RunnableCount": 0,
                "RunningCount": 0
            },
            "TaskInstanceTotalCount": 2,
            "TaskName": "A",
            "EndTime": "2018-02-07T09:30:31Z",
            "CreateTime": "2018-02-07T09:29:09Z",
            "RequestId": "f4723b24-e080-4599-b12d-b7eb657faefe"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError Internal error.
    InvalidParameter.JobIdMalformed Invalid job ID format.
    ResourceNotFound.Task The specified job task does not exist.