Querying the Logs of a Specified Task in a Given Training Job (Preview)
Function
This API is used to query the logs of a specified task in a given training job on ModelArts (preview).
This API applies to the following scenario: When you need to view the running logs of a specified task in a training job, you can use this API to preview the logs. Before using this API, ensure that you have obtained the training job ID and task ID and have the permission to view logs. After the query is complete, the platform returns the preview information of the task logs. If the training job ID or task ID does not exist, no task log is generated, or you do not have the operation 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.
URI
GET /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/logs/preview
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: ID of a training job Constraints: For details, see Querying a Training Job List. 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 |
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: ID of a training job Constraints: For details, see Querying a Training Job List. 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
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
content |
String |
Definition: Log content. If the size of a log file does not exceed the upper limit (n MB), all the log files are returned. Otherwise, the latest log file (n MB) is returned. After March 1, 2022, 00:00:00 (GMT+08:00), the parameter name is changed from context to content. Range: N/A |
current_size |
Integer |
Definition: Size of the returned log file, in bytes. The maximum value is 5 MB. Range: N/A |
full_size |
Integer |
Definition: Size of the complete log file, in bytes. Range: N/A |
Example Requests
The following shows how to obtain the worker-0 logs 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/preview
Example Responses
Status code: 200
ok
{ "content" : "[Modelarts Service Log]collect and upload ascend logs end at 2021-05-18-14:28:13\n[Modelarts Service Log]exiting..:\n [Modelarts Service Log]exiting...\n[Modelarts Service Log]exiting..:\n [Modelarts Service Log]exiting...\n[Modelarts Service Log]exit with :\n [Modelarts Service Log]exit with 0\n[Modelarts Service Log]exit with :\n [Modelarts Service Log]exit with 0\n[ModelArts Service Log][INFO][2021/05/18 14:28:14,207]:\n output-handler finalizing due to: [training finished]\n[ModelArts Service Log][INFO][2021/05/18 14:28:14,207]:\n output-handler finalized\n[Modelarts Service Log][sidecar] exiting at 2021-05-18-14:28:14\n[Modelarts Service Log][sidecar] wait python processes exit..:\n [Modelarts Service Log][sidecar] wait python processes exit...\n[Modelarts Service Log][sidecar] exit with :\n [Modelarts Service Log][sidecar] exit with 0", "current_size" : 126548, "full_size" : 5242880 }
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