Help Center/ Image Management Service/ API Reference/ IMS APIs/ Image Jobs/ Querying the Progress of an Asynchronous Job
Updated on 2024-12-09 GMT+08:00

Querying the Progress of an Asynchronous Job

Function

This is an extension API. It is used to query for the progress of an asynchronous job.

URI

GET /v1/cloudimages/job/{job_id}

Table 1 lists the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

job_id

Yes

Specifies the asynchronous job ID.

Request

  • Request parameters

    None

Example Request

Querying the progress of an asynchronous job

GET /v1/cloudimages/job/ff8080814dbd65d7014dbe0d84db0013

Response

  • Response parameters

    Parameter

    Type

    Description

    job_id

    String

    Specifies the job ID.

    job_type

    String

    Specifies the job type.

    • imsCreateImageByInstance: Creating a system disk image from a cloud server
    • imsImportImageJob: Creating a system disk image from an external image file
    • imsImportOvaImageJob: Creating an image from an OVA image file
    • imsVolumeCreateImageJob: Creating a system disk image from a data disk
    • imsVolumesToSysDataImagesJob: Creating a data disk image from a data disk
    • imsImportDataImageJob: Creating a data disk image from an external image file
    • imsCreateWholeImageByInstanceJob: Creating a full-ECS image from an ECS
    • imsCreateWholeImageByBackupJob: Creating a full-ECS image from a CBR or CSBS backup
    • imsNativeImportImageJob: Registering an image
    • imsNativeExportImageJob: Exporting an image
    • imsAddImageMembersJob: Adding tenants that can use a shared image
    • imsDelImageMembersJob: Deleting tenants that can use a shared image
    • imsUpdateImageMembersJob: Updating status of tenants who will accept or reject shared images
    • imsCopyImageInRegionJob: Replicating images within a region
    • imsCrossRegionCopyImageJob: Replicating images across regions

    begin_time

    String

    Specifies the start time of the job. The value is in UTC format.

    end_time

    String

    Specifies the end time of the job. The value is in UTC format.

    status

    String

    Specifies the job status. The value can be:

    • SUCCESS: The job is successfully executed.
    • FAIL: The job failed to be executed.
    • RUNNING: The job is in progress.
    • INIT: The job is being initialized.

    error_code

    String

    Specifies the error code.

    fail_reason

    String

    Specifies the failure cause.

    entities

    Object

    Specifies the custom attributes of the job.

    If the job status is normal, the image ID will be returned. If the status is abnormal, an error code and details will be returned.

    For details, see Table 2.

    Table 2 Data structure description of the entities field

    Parameter

    Type

    Description

    image_name

    String

    Specifies the image name.

    process_percent

    Double

    Specifies the job progress.

    current_task

    String

    Specifies the job name.

    subJobId

    String

    Specifies a sub-job ID.

    image_id

    String

    Specifies the image ID.

    sub_jobs_result

    Array of SubJobResult objects

    Specifies sub-job execution results. For details, see Table 3.

    sub_jobs_list

    Array of string

    Specifies the sub-job IDs.

    Table 3 Data structure description of the SubJobResult field

    Parameter

    Type

    Description

    status

    String

    Specifies the sub-job status. The value can be:

    • SUCCESS: The sub-job is successfully executed.
    • FAIL: The sub-job failed to be executed.
    • RUNNING: The sub-job is in progress.
    • INIT: The sub-job is being initialized.

    job_id

    String

    Specifies a sub-job ID.

    job_type

    String

    Specifies the sub-job type.

    begin_time

    String

    Specifies the start time of the sub-job. The value is in UTC format.

    end_time

    String

    Specifies the end time of the sub-job. The value is in UTC format.

    error_code

    String

    Specifies the error code.

    fail_reason

    String

    Specifies the failure cause.

    entities

    Object

    Specifies the custom attributes of the sub-job. For details, see Table 4.

    • If a sub-job is properly executed, an image ID is returned.
    • If an exception occurs on the sub-job, an error code and associated information are returned.
    Table 4 Data structure description of the sub_jobs_result.entities field

    Parameter

    Type

    Description

    image_id

    String

    Specifies the image ID.

    This parameter is returned only when the value of job_type is one of the following:

    • imsImportOvaImageJob
    • imsVolumesToSysDataImagesJob

    image_name

    String

    Specifies the image name.

  • Example response
    STATUS CODE 200
    {
        "job_id": "ff80808280c204e30180d2784c3c0d86",
        "job_type": "imsCopyImageInRegionJob",
        "begin_time": "2022-05-17T14:42:20.859Z",
        "end_time": "",
        "status": "RUNNING",
        "error_code": null,
        "fail_reason": null,
        "entities": {
            "image_name": "d0d2e701-dfc4-4520-9247-f92907f38eb0",
            "process_percent": 0.40,
            "current_task": "CopyImageInRegionTask:",
            "subJobId": "ff80808280ca6cd30180d278b9db0221",
            "image_id": "498cc67e-7795-482c-8c47-32bcece2d7ec"
        }
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    You do not have the rights to perform the operation.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    The service is unavailable.