Deleting a Training Job Version

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.

  • Method 1: Delete a training job version based on the specified job_id and version_id.

    from modelarts.session import Session
    from modelarts.estimator import Estimator
    session = Session()
    estimator = Estimator(session, job_id="182626", version_id="278813")
    status = estimator.delete_job_version()
    
  • Method 2: Delete the training job version created in Creating a Training Job Version.

    status = job_version_instance.delete_job_version()
    
  • Method 3: Delete the training job version object returned in Querying the List of Training Job Versions.

    status = job_version_instance_list[0].delete_job_version()
    

Parameter Description

Table 1 Estimator request parameters

Parameter

Mandatory

Type

Description

modelarts_session

Yes

Object

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

job_id

Yes

String

ID of a training job. Obtain job_id using the training job object generated in Creating a Training Job, for example, job_instance.job_id, or from the response in Obtaining Training Jobs.

version_id

Yes

String

Version ID of a training job. Obtain version_id from the response in Querying the List of Training Job Versions.

Table 2 delete_job_version 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 in ModelArts API Reference.

This parameter is not included when the API call succeeds.

is_success

Boolean

Whether the API call succeeds