Updated on 2024-03-21 GMT+08:00

Querying the List of Training Jobs

Sample Code

In ModelArts notebook, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see Session Authentication.

1
2
3
4
5
from modelarts.session import Session
from modelarts.estimator import Estimator
session = Session()
job_list_info = Estimator.get_job_list(modelarts_session=session, status=8, per_page=10, page=1, order="asc", search_content="job")
print(job_list_info)

Parameters

Table 1 get_job_list request parameters

Parameter

Mandatory

Type

Description

modelarts_session

Yes

Object

Session object. For details about the initialization method, see Session Authentication.

status

No

Integer

Job status to be queried. By default, jobs of all statuses are queried. For example, to view jobs that fail to be created, set this parameter 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

sortBy/sort_by

No

String

When AK/SK-based authentication is used, the parameter name is sortBy. When account-based authentication is used, the parameter name is sort_by. The parameter specifies the sorting mode of the query. The value can be job_name, job_desc, status, duration, engine_type, or create_time. Default value: job_name

order

No

String

The options are as follows:

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

search_content

No

String

Search content, for example, a training job name. The value consists of 0 to 100 characters. By default, this parameter is left blank.

Table 2 get_job_list response parameters

Parameter

Type

Description

error_msg

String

Error message when the API call fails.

This parameter is not included when the API call succeeds.

error_code

String

Error code when the API fails to be called. 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

is_success

Boolean

Whether the API call succeeds

quotas

Integer

Maximum number of training jobs

jobs

JSON Array

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

Table 3 jobs parameters

Parameter

Type

Description

job_id

Long

Training job ID

job_name

String

Training job name

version_id

Long

Version ID 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

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