Updated on 2022-12-07 GMT+08:00

Querying Batch Job Logs

Function

This API is used to query the back-end logs of batch processing jobs.

URI

  • URI format

    GET /v2.0/{project_id}/batches/{batch_id}/log

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    batch_id

    Yes

    String

    ID of a batch processing job.

    Table 2 Request parameters

    Parameter

    Mandatory

    Type

    Description

    from

    No

    Integer

    Start line of the log to be displayed. By default, the last 100 lines of the log are displayed. If a log file contains fewer than 100 lines, line 0 is the start line.

    size

    No

    Integer

    Number of logs to be queried.

    type

    No

    String

    If type is set to driver, the Spark Driver log is generated.

    index

    No

    Integer

    When a submitted job is retried, multiple driver logs are generated. This parameter specifies the index number of the specified driver log. The default value is 0. This parameter must be used together with the type parameter. If only index is specified, the default value of type is driver.

Request

None

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

id

No

String

ID of a batch processing job.

from

No

String

Start index of a log.

total

No

Long

Total number of records in a log.

log

No

Array of Strings

Log of the current batch processing job.

Example Request

None

Example Response

{
    "id": "0a324461-d9d9-45da-a52a-3b3c7a3d809e",
    "from": 0,
    "total": 3,
    "log": [
           "Detailed information about job logs"
    ]
}

Status Codes

Table 4 describes the status code.

Table 4 Status codes

Status Code

Description

200

The query is successful.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.