doc-exports/docs/modelarts/api-ref/en-us_topic_0000001147936839.html
Artem Goncharov 3196b64bfc
move doc sources to other location (#3)
move doc sources to other location

Reviewed-by: OpenTelekomCloud Bot <None>
2022-04-27 16:24:25 +00:00

29 KiB

Querying the Statuses and GPU Quantity of All Job Versions

Function

You can use this API to query the overview information about all job versions created by a user based on specified conditions, including the statuses and GPU quantity of all job versions.

URI

GET /v1/{project_id}/training-jobs/versions

Table 1 Parameter description describes the required parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Body

Table 2 describes the request parameters.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

offset

No

Integer

Offset.

limit

No

Integer

Number of displayed records. The default value is 20. The value 0 indicates that all records are displayed.

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.

sort_by

No

String

Sorting mode of the query. By default, the records are sorted by create_time. The records can be sorted by job_desc, status, duration, or job_name.

order

No

String

Sorting order. Options:

  • asc: ascending order
  • desc: descending order. The default value is desc.

pool_id

No

String

ID of the resource pool to be queried.

workspace_id

No

String

Workspace where a job resides. Default value: 0

Response Body

Table 3 describes the response parameters.
Table 3 Parameter description

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.

total_count

Integer

Total number of created job versions.

versions

JSON Array

Attributes of a training job. For details, see Table 4.

Table 4 jobs parameters

Parameter

Type

Description

version_id

Long

ID of a training job

version_name

String

Name of a training job

status

Byte

Status of a training job. For details about the job statuses, see Job Statuses.

create_time

Long

Timestamp when a training job is created

start_time

Long

Timestamp when a training job starts.

end_time

Long

Timestamp when a training job ends.

duration

Long

Running duration of a training job.

version_desc

String

Description of a training job

pool_id

String

ID of the resource pool to which a training job belongs.

flavor_code

String

Resource specifications selected for a training job

npu_num

integer

Number of NPUs used by a training job.

gpu_num

integer

Number of GPUs used by a training job.

Samples

Query training jobs in batches.

  • Sample request
    GET    https://endpoint/v1/{project_id}/training-jobs/versions
  • Sample response of a successful query
    {
        versions:[  
    	    {
                "version_id": 1485,
                "version_name": "trainjob-3f47",
                "status": 12,
                "create_time": 1557473030000,
                "start_time": 1557473040000,
                "end_time": 1557473093000,
                "duration": 53000,
                "version_desc": null,
                "pool_id": "pool9928813f",
                "flavor_code": "modelarts.p1.2xlarge",
                "npu_num": 0,
                "gpu_num": 1
            }
        ],
        "offset": 20,
        "limit": 20,
        "total_count": 1,
        "is_success": true
    }
  • Sample response of a failed query
    {
        "is_success": false,
        "error_message": "Error string",
        "error_code": "ModelArts.0105"
    
    }

Status Code

For details about the status code, see Status Code.