Querying Compute Resources by Types

Function

This API is used to query compute resources by types.

URI

GET/v1/{project_id}/computing-resource/{type}

Table 1 describes the URI parameters.
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

type

Yes

String

Type of the compute resource to be added

Request

N/A

Response

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

computing_resource

Object

List of compute resources. For details, see Table 3.

error_msg

String

Error message that indicates a request has failed. This parameter is unavailable when a request is successful.

error_code

String

Error code that indicates a request has failed. This parameter is unavailable when a request is successful.

Table 3 computing_resource parameters

Parameter

Type

Description

id

String

Resource ID, which is used to distinguish compute resources.

user_id

String

User ID

project_id

String

Project ID

type

String

Resource type. The value can contain a maximum of 10 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

driver_memory

String

Driver memory. The value must be greater than or equal to 512 MB.

driver_cores

Integer

Number of driver cores. The value must be greater than or equal to 1.

executor_memory

String

Executor memory. The value must be greater than or equal to 1 GB.

executor_cores

Integer

Number of executor cores. The value must be greater than or equal to 1.

num_executors

Integer

Number of cores. The value must be greater than or equal to 1.

Example

  • Example of a successful response
    {
      "is_success": true,
      "computing_resource": {
        "id": "5f0fc90870ef4a678649774f28f9d68e",
        "user_id": "03cfcb78b4b34ba79c9d5aa43dcfb49a",
        "project_id": "b09d59c4e8724078a5e8efa65049e78f",
        "type": "B",
    "driver_memory": "1024 MB",
        "driver_cores": 2,
    "executor_memory": "2 GB",
        "executor_cores": 2,
        "num_executors": 3
      }
    }
  • Example of a failed response
    { 
        "is_success": false, 
        "error_code": "res.1006", 
        "error_msg": "The content for the request is invalid." 
    }

Status Code

For details about status codes, see Status Codes.