Help Center> ModelArts> API Reference> Training Management> Training Jobs> Querying Training Job Logs (Old)

Querying Training Job Logs (Old)

Function

This API is used to query detailed information about training job logs.

URI

GET /v1/{project_id}/training-jobs/{job_id}/versions/{version_id}/log

Table 1 describes the required parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

job_id

Yes

Long

ID of a training job

version_id

Yes

Long

Version ID of a training job

Request Body

Table 2 describes the request parameters.
Table 2 Parameter description

Parameter

Mandatory

Type

Description

start_byte

No

Long

Start position for obtaining the log. The default value is 0. The value range is [-1, +∞]. If the value is -1, the log with the latest offset is obtained.

offset

No

Long

Length of the obtained log. The default value is 2048. The value range is [-2048, 2048].

log_file

Yes

String

Name of the log file to be viewed. Obtain the value by calling the API described in Obtaining the Name of a Training Job Log File.

Response Body

Table 3 describes the response parameters.
Table 3 Parameter description

Parameter

Type

Description

error_msg

String

Error message of a failed API call.

This parameter is not included when the API call succeeds.

error_code

String

Error code of a failed API call. For details, see Error Code.

This parameter is not included when the API call succeeds.

log

String

Content of the requested log

log_byte_count

Long

Log bytes

end_byte

Long

End position of the obtained log

is_success

Boolean

Whether the request is successful

Samples

The following shows how to query the logs contained in log1.log of the job whose job_id is 10 and version_id is 10.

  • Sample request
    GET    https://endpoint/v1/{project_id}/training-jobs/10/versions/10/log?log_file=log1.log&start_byte=0&offset=2048
  • Successful sample response
    {
        "is_success": true,
        "log": "Log string",
        "end_byte": "10",
        "count": "10"
    }
  • Failed sample response
    {
        "is_success": false,
        "error_msg": "Error string",
        "error_code": "ModelArts.0105"
    }

Status Code

For details about the status code, see Status Code.