This API is used to query the created training jobs that meet the search criteria.
GET /v1/{project_id}/training-jobs
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
status |
No |
String |
Job status. By default, all job statuses are returned. For example, to query failed jobs, set the value of status to 3, 5, 6, or 13. For details about the job statuses, see Job Statuses. |
per_page |
No |
Integer |
Number of jobs displayed on each page. The value range is [1, 1000]. Default value: 10 |
page |
No |
Integer |
Index of the page to be queried. Default value: 1 The value range is [1, 65535]. |
sortBy |
No |
String |
Sorting mode of the query. The value can be job_name, job_desc, status, duration, version_count, or create_time. Default value: job_name |
order |
No |
String |
Sorting order. The options are as follows:
|
search_content |
No |
String |
Search content, for example, a training job name. The value must contain 0 to 64 characters. By default, this parameter is left blank. |
workspace_id |
No |
String |
Workspace where a job resides. Default value: 0 |
None
Parameter |
Type |
Description |
---|---|---|
is_success |
Boolean |
Whether the request is successful |
error_message |
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 Codes. This parameter is not included when the API call succeeds. |
job_total_count |
Integer |
Total number of created jobs |
job_count_limit |
Integer |
Number of training jobs that can be created |
jobs |
jobs array |
Attributes of a training job. For details, see Table 4. |
quotas |
Integer |
Maximum number of training jobs |
Parameter |
Type |
Description |
---|---|---|
job_id |
Long |
ID of a training job |
job_name |
String |
Name of a training job |
version_id |
Long |
Version ID of a training job |
status |
Int |
Status of a training job. For details about the job statuses, see Job Statuses. |
create_time |
Long |
Timestamp when a training job is created |
duration |
Long |
Training job running duration, in milliseconds |
job_desc |
String |
Description of a training job |
version_count |
Long |
Number of versions of a training job |
The following shows how to query training jobs whose status is 7 and whose name contains job on the first page. Each page displays 10 records sorted by job_name in ascending order.
GET https://endpoint/v1/{project_id}/training-jobs?status=7&per_page=10&page=1&sortBy=job_name&order=asc&search_content=job
{ "is_success": true, "quotas": 5, "job_total_count": 1, "job_count_limit": 3, "jobs": [ { "job_id": 10, "job_name": "testModelArtsJob", "version_id": 10, "status": 10, "create_time": 1524189990635, "duration": 532003, "job_desc": "This is ModelArts job", "version_count": 5 } ] }
{ "is_success": false, "error_message": "Error string", "error_code": "ModelArts.0105" }
For details about the status code, see Status Code.
See Error Codes.