Querying the Logs of a Specified Task in a Training Job (OBS Link)
Function
This API is used to obtain the OBS link where the log files of a specified training job are stored.
This API is used when you need to view or download the detailed log information of a training job task. Before using this API, ensure that the training job task exists and you have the required permission. After the query, the API returns the OBS link where the log files of the specified task are stored. If the training job task does not exist or you do not have the required permission, the API will return an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:trainJob:logExport
Write
trainJob *
-
-
-
URI
GET /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/logs/url
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed. Range: N/A Default Value: N/A |
| training_job_id | Yes | String | Definition: Training job ID. For details, see Obtaining Training Jobs. Constraints: N/A Range: N/A Default Value: N/A |
| task_id | Yes | String | Definition: Name of a training job. You can obtain the value from the status.tasks field in the training job details. Constraints: For one node, the default is worker-0. For multiple nodes, it includes worker-0, worker-1, and so on. Range: N/A Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | No | String | Definition: Message body type. Constraints: N/A Range Default Value: N/A |
| start_time | No | Long | Definition: Start time of log query. Constraints: This parameter is only valid for jobs for which the log download by time is enabled. If a shard contains logs within the time range, the shard is matched. Range: N/A. Default Value: N/A. |
| end_time | No | Long | Definition: End time of log query. Constraints: This parameter is only valid for jobs for which the log download by time is enabled. If a shard contains logs within the time range, the shard is matched. Range: N/A. Default Value: N/A. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| obs_url | String | Definition: Temporary OBS URL of logs. You can copy the URL to the browser to view all logs. Range: N/A |
| shards | Shards object | Definition: Log shard information. Range: N/A. |
| Parameter | Type | Description |
|---|---|---|
| object_urls | Array of strings | Definition: OBS download link set of the log shards. Range: N/A. |
| count | Integer | Definition: Number of log shards returned in the request. Range: N/A. |
| total | Integer | Definition: Total number of log shards matched in the request. Range: N/A. |
Example Requests
The following shows how to query the temporary OBS URL for the work-0 tasks of the training job whose UUID is 2cd88daa-31a4-40a8-a58f-d186b0e93e4f.
GET https://endpoint/v2/{project_id}/training-jobs/2cd88daa-31a4-40a8-a58f-d186b0e93e4f/tasks/worker-0/logs/url?Content-Type=text/plain Example Responses
Status code: 200
ok
{
"obs_url" : "http://10.155.101.248:20000/cnnorth4-test/xk/00chess_test/test11/logs/modelarts-job-0f2ccdbb-4f34-4d53-afb9-d526f3be8c68-ma-platform-init-worker-0-172.16.24.51-01909681.log?AWSAccessKeyId=xxxxx"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | ok |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot