Obtaining the Events of a Training Job
Function
This API is used to obtain the events of a training job on ModelArts.
This API applies to the following scenario: When you need to view the event records of a specific training job, you can use this API to obtain the event list. Before using this API, ensure that you have obtained the training job ID and have the permission to view the event list. After the query is complete, the platform returns the event records of the training job. If the training job ID does not exist 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}/events
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Integer |
Definition: Offset of data records Constraints: N/A Range: N/A Default Value: N/A |
limit |
No |
Integer |
Definition: Maximum number of records returned on each page Constraints: N/A Range: [1, 100] Default Value: 50 |
order |
No |
String |
Definition: Instance order Constraints: N/A Range: N/A Default Value: N/A |
start_time |
No |
String |
Definition: Start time Constraints: The start time must be passed together with the end time. Range: N/A Default Value: N/A |
end_time |
No |
String |
Definition: End time Constraints: The end time must be passed together with the start time. Range: N/A Default Value: N/A |
level |
No |
String |
Definition: Level of the event to be returned Constraints: N/A Range: [Info Error Warning] Default Value: N/A |
pattern |
No |
String |
Definition: Content contained in an event Constraints: The value can contain a maximum of 256 characters. Range: N/A Default Value: N/A |
source |
No |
String |
Definition: Source of the event to be returned Constraints: N/A Range: [K8S Job Task] Default Value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Language |
No |
String |
Definition: Language Constraints: N/A Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total |
String |
Definition: Total number of records. Range: N/A |
limit |
String |
Definition: Maximum number of records that can be displayed. Range: N/A |
offset |
String |
Definition: Start number of records. Range: N/A |
order |
String |
Definition: Sorting mode. Range: N/A |
start_time |
String |
Definition: Start time of an event. Range: N/A |
end_time |
String |
Definition: End time of an event. Range: N/A |
events |
Array of Event objects |
Definition: Event list. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Definition: Event information. Range: N/A |
level |
String |
Definition: Event level. Range: N/A |
time |
String |
Definition: Time when an event occurs. Range: N/A |
source |
String |
Definition: Event source. Range: N/A |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Range: N/A |
error_msg |
String |
Definition: Error message. Range: N/A |
Example Requests
GET https://endpoint/v2/{project_id}/training-jobs/{training_job_id}/events?order=desc&offset=0&limit=10&start_time=1669449696964&end_time=1669711991259
Example Responses
Status code: 200
ok
{ "total" : 27, "limit" : 10, "offset" : 0, "order" : "desc", "start_time" : "2022-11-26T16:01:36+08:00", "end_time" : "2022-11-29T16:53:11+08:00", "events" : [ { "time" : "2022-11-26T16:03:41+08:00", "level" : "Error", "message" : "Training job failed.", "source" : "Job" }, { "time" : "2022-11-26T16:03:16+08:00", "level" : "Info", "message" : "[Job: modelarts-job-5bd61eea-9de2-4864-a0f7-5fae966171b5] ExecuteAction: Start to execute action TerminateJob", "source" : "K8S" }, { "time" : "2022-11-26T16:03:12+08:00", "level" : "Info", "message" : "[worker-0][time used: 0.296s] Upload training output(parameter name: train_url) finished.", "source" : "Task" }, { "time" : "2022-11-26T16:03:12+08:00", "level" : "Info", "message" : "[worker-0] Training output(parameter name: train_url) Uploading.", "source" : "Task" }, { "time" : "2022-11-26T16:03:11+08:00", "level" : "Info", "message" : "[worker-0] Training finished. Exit code 1.", "source" : "Task" }, { "time" : "2022-11-26T16:02:10+08:00", "level" : "Info", "message" : "[worker-0] training started.", "source" : "Task" }, { "time" : "2022-11-26T16:02:09+08:00", "level" : "Info", "message" : "Training job is running.", "source" : "Job" }, { "time" : "2022-11-26T16:02:06+08:00", "level" : "Info", "message" : "[Pod: modelarts-job-5bd61eea-9de2-4864-a0f7-5fae966171b5-worker-0] Started: Started container", "source" : "K8S" }, { "time" : "2022-11-26T16:02:06+08:00", "level" : "Info", "message" : "[Pod: modelarts-job-5bd61eea-9de2-4864-a0f7-5fae966171b5-worker-0] SuccessfulCreate: Created container", "source" : "K8S" }, { "time" : "2022-11-26T16:02:05+08:00", "level" : "Info", "message" : "[Pod: modelarts-job-5bd61eea-9de2-4864-a0f7-5fae966171b5-worker-0] Pulled: Successfully pulled image \"swr.cn-north-7.myhuaweicloud.com/modelarts-job-dev-image/modelarts-tool-container:1.0.0-5.3.1-b002.2\"", "source" : "K8s" } ] }
Status code: 400
Bad request.
{ "error_code" : "ModelArts.50004000", "error_msg" : "Bad request." }
Status Codes
Status Code |
Description |
---|---|
200 |
ok |
400 |
Bad request. |
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