Querying Compute Resource Lists

Function

This API is used to query the compute resource lists.

URI

GET/v1/{project_id}/computing-resource

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.

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_resources

List

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_resources 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_resources": [
        {
          "id": "5f0fc90870ef4a678649774f28f9d68e",
          "user_id": "03cfcb78b4b34ba79c9d5aa43dcfb49a",
          "project_id": "b09d59c4e8724078a5e8efa65049e78f",
          "type": "B",
          "driver_memory": "1024M",
          "driver_cores": 2,
          "executor_memory": "2G",
          "executor_cores": 2,
          "num_executors": 3
        },
        {
          "id": "63ab2fcc83da41f381fddcaf357b34dc",
          "user_id": "03cfcb78b4b34ba79c9d5aa43dcfb49a",
          "project_id": "b09d59c4e8724078a5e8efa65049e78f",
          "type": "A",
    "driver_memory": "512 MB",
          "driver_cores": 1,
    "executor_memory": "1 GB",
          "executor_cores": 1,
          "num_executors": 2
        }
      ]
    }
  • 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.