Updated on 2024-09-30 GMT+08:00

Obtaining Job Information

Function

This API is used to obtain information about a job via the job ID returned after a query request is delivered.

  • The URL for cluster management is in the format of https://Endpoint/uri, where uri specifies the resource path for API access.

  • You can call this API when:

    • Creating or deleting a cluster

    • Creating or deleting a node

Calling Method

For details, see Calling APIs.

URI

GET /autopilot/v3/projects/{project_id}/jobs/{job_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

job_id

Yes

String

Job ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

X-Auth-Token

Yes

String

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see Obtaining a User Token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

kind

String

API type. The value is fixed at Job and cannot be changed.

apiVersion

String

API version. The value is fixed at v3 and cannot be changed.

metadata

JobMetadata object

Job metadata

spec

JobSpec object

Detailed job parameters

status

JobStatus object

Job status

Table 4 JobSpec

Parameter

Type

Description

type

String

Job type. An example value is CreateCluster.

clusterUID

String

ID of the cluster where the job runs.

resourceID

String

ID of the resource on which the job is executed.

resourceName

String

Name of the resource on which the job is executed.

extendParam

Map<String,String>

Extended parameters

subJobs

Array of Job objects

Subjob list.

  • The list contains details about all subjobs.

  • Generally, a cluster/node creation job consists of multiple subjobs. The job is complete only after all subjobs are complete.

Table 5 Job

Parameter

Type

Description

kind

String

API type. The value is fixed at Job and cannot be changed.

apiVersion

String

API version. The value is fixed at v3 and cannot be changed.

metadata

JobMetadata object

Job metadata

spec

JobSpec object

Detailed job parameters

status

JobStatus object

Job status

Table 6 JobMetadata

Parameter

Type

Description

uid

String

Job ID

creationTimestamp

String

Time when the job was created

updateTimestamp

String

Time when the job was updated

Table 7 JobStatus

Parameter

Type

Description

phase

String

Job status. Possible values:

  • JobPhaseInitializing JobPhase = "Initializing"

  • JobPhaseRunning JobPhase = "Running"

  • JobPhaseFailed JobPhase = "Failed"

  • JobPhaseSuccess JobPhase = "Success"

reason

String

Reason why the job is in the current state.

Example Requests

None

Example Responses

Status code: 200

The job information is obtained.

{
  "kind" : "Job",
  "apiVersion" : "v3",
  "metadata" : {
    "uid" : "354331b2c-229a-11e8-9c75-0255ac100ceb",
    "creationTimestamp" : "2018-08-02 08:12:40.672772389 +0000 UTC",
    "updateTimestamp" : "2018-08-02 08:21:50.478108569 +0000 UTC"
  },
  "spec" : {
    "type" : "CreateCluster",
    "clusterUID" : "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
    "resourceID" : "6f4dcb2c-229a-11e8-9c75-0255ac100ceb",
    "resourceName" : "cluster-name",
    "extendParam" : {
      "serverID" : "bc467e3a-2338-11e8-825b-0255ac100c13"
    },
    "subJobs" : [ {
      "kind" : "Job",
      "apiVersion" : "v3",
      "metadata" : {
        "uid" : "fd474fab-9606-11e8-baa9-0255ac10215d",
        "creationTimestamp" : "2018-08-02 03:52:34.615819618 +0000 UTC",
        "updateTimestamp" : "2018-08-02 04:05:29.196243031 +0000 UTC"
      },
      "spec" : {
        "type" : "InstallMaster",
        "clusterUID" : "fcc72de0-9606-11e8-baa8-0255ac10215d",
        "resourceID" : "fd3b4ac0-9606-11e8-baa8-0255ac10215d",
        "extendParam" : {
          "serverID" : "fd3b4ac0-9606-11e8-baa8-0255ac10215d"
        }
      },
      "status" : {
        "phase" : "Success"
      }
    }, {
      "kind" : "Job",
      "apiVersion" : "v3",
      "metadata" : {
        "uid" : "fd474f82-9606-11e8-baa8-0255ac10215d",
        "creationTimestamp" : "2018-08-02 03:52:33.859150791 +0000 UTC",
        "updateTimestamp" : "2018-08-02 03:52:34.615655429 +0000 UTC"
      },
      "spec" : {
        "type" : "CreatePSMCert",
        "clusterUID" : "fcc72de0-9606-11e8-baa8-0255ac10215d"
      },
      "status" : {
        "phase" : "Success"
      }
    } ]
  },
  "status" : {
    "phase" : "Running",
    "reason" : ""
  }
}

Status Codes

Status Code

Description

200

The job information is obtained.

Error Codes

See Error Codes.