DescribeTask

Last updated: 2020-11-09 15:40:18

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 parameter. The value used for this API: DescribeTask.
Version Yes String Common parameter. The value used for this API: 2017-03-12.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
JobId Yes String Instance 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 - Required: No - (Filter) Filter by task instance state. (SUBMITTED: submitted; PENDING: pending; RUNNABLE: runnable; STARTING: starting; RUNNING: running; SUCCEED: succeeded; FAILED: failed; FAILED_INTERRUPTED: instance retained after failure).
  • 3. Output Parameters

    Parameter Name Type Description
    JobId String Instance ID
    TaskName String Job name
    TaskState String Job state
    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 Querying 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",
            "StateIfCreateCvmFailed": "FAILED",
            "LaunchTime": "2018-02-07T09:29:09Z",
            "StateReason": "",
            "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",
            "StateIfCreateCvmFailed": "FAILED",
            "LaunchTime": "2018-02-07T09:29:09Z",
            "StateReason": "",
            "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

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    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 instance ID format.
    ResourceNotFound.Task The specified job task does not exist.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help