Obtaining Visualization 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.

from modelarts.session import Session
from modelarts.estimator import VisualizationJob
session = Session()
job_list = VisualizationJob.get_visualization_job_list(modelarts_session=session, status=8, per_page=10, page=1, sort_by="create_time", order="asc", search_content="job")

Parameter Description

Table 1 get_visualization_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

String

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

per_page

No

Integer

Number of jobs displayed on each page. The value range is [1, 100]. 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 the username and password are used for authentication, 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, create_time, or log_dir. Default value: job_name

order

No

String

Sorting order. The options are as follows:

  • asc: ascending order. It is the default value.

  • desc: descending order

search_content

No

String

Search content, for example, a visualization job name. The value must contain 0 to 100 characters. By default, this parameter is left blank.

Table 2 get_visualization_job_list response parameters

Parameter

Type

Description

error_code

String

Error code when the API fails to be called. For details, see Error Codes in ModelArts API Reference.

This parameter is not included when the API call succeeds.

error_msg

String

Error message when the API call fails.

This parameter is not included when the API call succeeds.

job_total_count

Integer

Total number of the queried visualization jobs

job_count_limit

Integer

Number of visualization jobs that can be created

jobs

JSON Array

Visualization job attributes. For details, see Table 3.

Table 3 jobs parameters

Parameter

Type

Description

job_id

Integer

ID of a visualization job

job_name

String

Name of a visualization job

status

Integer

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

create_time

Long

Time when a visualization job is created

duration

Long

Running duration of a visualization job, in milliseconds

job_desc

String

Description of a visualization job

service_url

String

Endpoint of a visualization job

train_url

String

Path to visualization job logs