Help Center/ ModelArts/ API Reference/ Model Training/ Training Job Management (New Version)/ Creating an Image Saving Task of a Training Job
Updated on 2026-09-01 GMT+08:00

Creating an Image Saving Task of a Training Job

Function

This API is used to create an image saving task for a training job.

This API is used when you need to save the current status or model of a training job as an image for future reuse or sharing. Before using this API, ensure that the training job exists and you have the required permission. After the image saving task is created, the system starts to save the image of the training job and notifies you after the saving is complete. If the training job does not exist, you do not have the required permission, or the image saving task fails to be created, the API will return an error message.

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:create

    Write

    trainJob *

    -

    -

    -

    -

    • g:RequestTag/<tag-key>

    • g:TagKeys

    • modelarts:poolType

    • modelarts:poolId

URI

POST /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/save-image-job

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

task_id

Yes

String

Definition: Task ID of a training job. You can obtain the value from the status.tasks field in the training job details.

Constraints: N/A

Range: For a single node, the default value is worker-0. For multiple nodes, the value is worker-0, worker-1, and so on.

Default Value: N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition: Image name.

Constraints: Mandatory. The value can contain up to 512 characters, including lowercase letters, digits, hyphens (-), underscores (_), and periods (.).

Range: N/A

Default Value: N/A

namespace

Yes

String

Definition: Organization to which the image belongs. You can create and view an organization on the Organization Management page of the SWR console.

Constraints: Mandatory.

Range: N/A

Default Value: N/A

tag

Yes

String

Definition: Image tag.

Constraints: Mandatory.

Range: N/A

Default Value: N/A

description

No

String

Definition: Image description.

Constraints: The value can contain at most 512 characters.

Range: N/A

Default Value: N/A

Response Parameters

Status code: 201

Table 3 Response body parameters

Parameter

Type

Description

name

String

Definition: Image name.

Range: The name can contain a maximum of 512 characters. Lowercase letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

namespace

String

Definition: Organization to which the image belongs. You can create and view an organization on the Organization Management page of the SWR console.

Range: N/A

tag

String

Definition: Image tag.

Range: The value can contain a maximum of 64 characters. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

description

String

Definition: Image description.

Range: Up to 512 characters

status

String

Definition: Image status.

Range:

  • INIT: The instance is being initialized.

  • CREATING: The image is being saved. In this state, the training job is unavailable.

  • CREATE_FAILED: Saving the image failed.

  • ACTIVE: The image is saved. You can view the saved image on the SWR console and create a training job based on the saved image.

message

String

Definition: Creation information displayed during image saving.

Range: N/A

create_time

Long

Definition: Time when the image was created, which is a Unix timestamp in milliseconds, for example, 1686718209968.

Range: N/A

Example Requests

Create the worker-0 image saving task of the training job whose UUID is 2cd88daa-31a4-40a8-a58f-d186b0e93e4f.

POST https://{endpoint}/v2/{project_id}/training-jobs/2cd88daa-31a4-40a8-a58f-d186b0e93e4f/tasks/worker-0/save-image-job

{
  "name" : "imagesave",
  "namespace" : "dev",
  "tag" : "0.1",
  "description" : "hello world!"
}

Example Responses

Status code: 201

create image save job successfully

{
  "name" : "imagesave",
  "namespace" : "dev",
  "tag" : "0.1",
  "description" : "hello world!",
  "status" : "ACTIVE",
  "message" : "building",
  "create_time" : 1686718209968
}

Status Codes

Status Code

Description

201

create image save job successfully

Error Codes

See Error Codes.