Help Center/ Data Lake Insight/ API Reference/ Queue-related APIs (Recommended)/ Restarting, Scaling Out, and Scaling In Queues
Updated on 2023-08-03 GMT+08:00

Restarting, Scaling Out, and Scaling In Queues

Function

This API is used to restart, scale out, and scale in queues.

Only SQL queues in the Available status can be restarted. (The queue status is Available only after the SQL job is successfully executed.)

URI

  • URI format

    PUT /v1.0/{project_id}/queues/{queue_name}/action

  • Parameter description
    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 its value, see Obtaining a Project ID.

    queue_name

    Yes

    String

    Name of a queue.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Operations to be performed:

  • restart: Restart a service. Only queues for SQL jobs can be restarted.
  • scale_out: Scale out the queue
  • scale_in: Scale in the queue
NOTE:

Currently, only restart, scale_out, and scale_in operations are supported.

force

No

Boolean

Specifies whether to forcibly restart the queue. This parameter is optional when action is set to restart. The default value is false.

cu_count

No

Integer

Number of CUs to be scaled in or out. This parameter is optional when action is set to scale_out or scale_in. The value of cu_count must be a multiple of 16.

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Indicates whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

No

String

System prompt. If execution succeeds, the parameter setting may be left blank.

job_id

No

String

Specifies the job ID returned when force is set to true.

queue_name

No

String

Name of the queue to be scaled in or out.

result

No

Boolean

Indicates the scaling result.

Example Request

  • Restart a queue.
    {
        "action": "restart",
        "force": "false"
    }
  • Increase the number of CUs of the queue to 16.
    {
        "action": "scale_out",
        "cu_count": 16
    }

Example Response

  • Set force to false.
    {
        "is_success": true,
        "message": "Restart success"
    }
  • Set force to true.
    {
        "is_success": true,
        "message": "Submit restart job success, it need some time to cancel jobs, please wait for a while and check job status",
        "job_id": "d90396c7-3a25-4944-ad1e-99c764d902e7"
    }
  • Scaling
    {
        "queue_name": "myQueue",
        "result": true
    }

Status Codes

Table 4 describes the status code.

Table 4 Status codes

Status Code

Description

200

The operation is successful.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.

Table 5 Error codes

Error Code

Error Message

DLI.0015

Token info for token is null, return.

DLI.0013

X-Auth-Token is not defined in request. It is mandatory. Please define and send the request.