Updated on 2026-11-12 GMT+08:00

Updating a Training Job

Function

This API is used to modify the description, event notification, priority, and preemption allowance of an existing training job.

This API is applicable in scenarios where you need to update the description, event notification, priority, or preemption allowance of a training job. Before using this API, ensure that the training job exists and you have the required permissions. After the update, the description, event notification, priority, and preemption allowance of the training job will be updated accordingly. If the training job does not exist or you do not have the required permissions, an error message will be returned.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    modelarts:trainJob:updateJob

    Write

    trainJob *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    modelarts:trainJob:update

    -

    -

    • modelarts:poolType

    • modelarts:poolId

URI

PUT /v2/{project_id}/training-jobs/{training_job_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details, see Obtaining a Project ID and Name.

Constraints: N/A

Range: The value can contain 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

training_job_id

Yes

String

Definition: Training job ID. For details, see Obtaining Training Jobs.

Constraints: N/A

Range: N/A

Default Value: N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

description

No

String

Definition: Training job description.

Constraints: The length range is [0, 256].

Range: N/A

Default Value: NULL

spec

No

spec object

Definition: Training job specifications.

Constraints: N/A

endpoints

No

JobEndpointsReq object

Definition: Configurations required for remotely accessing a training job.

Constraints: N/A

metadata

No

metadata object

Definition: Training job metadata.

Constraints: N/A

Table 3 spec

Parameter

Mandatory

Type

Description

notification

No

Notification object

Definition: Message notification of a training event.

Constraints: N/A

schedule_policy

No

schedule_policy object

Definition: Scheduling policy of a training job.

Constraints: N/A

Table 4 Notification

Parameter

Mandatory

Type

Description

topic_urn

No

String

Definition: URN of the selected topic in SMN.

Constraints: N/A

Range: N/A

Default Value: N/A

events

No

Array of strings

Definition: Training event that triggers a notification.

Constraints: The options are as follows:

  • JobStarted: The job is started.

  • JobCompleted: The job is completed.

  • JobFailed: The job is failed.

  • JobTerminated: The job is terminated.

  • JobRestarted: The job is restarted.

  • JobHanged: The job is suspended.

  • JobPreempted: The job is preempted.

Table 5 schedule_policy

Parameter

Mandatory

Type

Description

priority

No

Integer

Definition: Priority of a training job.

Constraints

  • The priority can be set for a training job only when a dedicated resource pool is used.

  • The value ranges from 1 to 3. The default priority is 1, and the highest priority is 3.

By default, the job priority can be set to 1 or 2. After the permission to set the highest job priority is configured, the priority can be set to 1 to 3.

Range: 1 to 3

Default Value: N/A

preemptible

No

Boolean

Definition: Whether the resource can be preempted.

Constraints: N/A

Range

  • true: The resource can be preempted.

  • false: The resource cannot be preempted.

Default Value: N/A

Table 6 JobEndpointsReq

Parameter

Mandatory

Type

Description

ssh

No

SSHReq object

Definition: SSH connection information.

Constraints: N/A

Table 7 SSHReq

Parameter

Mandatory

Type

Description

key_pair_names

No

Array of strings

Definition: Name of the SSH key pair, which can be created and viewed on the Key Pair page of the Elastic Cloud Server (ECS) console.

Constraints: N/A

Table 8 metadata

Parameter

Mandatory

Type

Description

annotation

No

Map<String,String>

Definition: Advanced functions of a training job. The value can be:

  • "jupyter-lab/enable": "true" (JupyterLab training application)

Constraints: N/A

Response Parameters

Status code: 200

None

Example Requests

The following shows how to modify a training job with UUID 3faf5c03-aaa1-4cbe-879d-24b05d997347. After the modification, call the API for obtaining a training job(ListTrainingJobs.xml) to view the modified description.

PUT https://{endpoint}/v2/{project_id}/training-jobs/3faf5c03-aaa1-4cbe-879d-24b05d997347

{
  "description" : "hahaha"
}

Example Responses

Status code: 200

null

Status Codes

Status Code

Description

200

No Content

Error Codes

See Error Codes.