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

Querying Scheduled Tasks

Function

This function is used to query scheduled tasks based on specified conditions.

Constraints

This API supports the following types of instances:

  • GeminiDB Influx
  • GeminiDB Redis
  • GeminiDB Mongo
  • GeminiDB Cassandra

URI

GET https://{Endpoint}/v3/{project_id}/scheduled-jobs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a user in a region

Table 2 Query parameters

Parameter

Mandatory

Type

Description

job_name

No

String

Task name. This parameter is left blank by default. The value can be:

  • REBOOT: Restart the instance.
  • RESIZE_FLAVOR: Change the CPU or memory of an instance.
  • UPGRADE_DATABASE: patch upgrade

job_status

No

String

Task execution status. This parameter is left blank by default. The value can be:

  • Pending: The task is not executed.
  • Running: The task is being executed.
  • Completed: The task has been successfully executed.
  • Failed: The task fails to be executed.
  • Canceled: The task is canceled.

instance_id

No

String

Instance ID. If this parameter is not specified, all instances that meet the search criteria are queried by default.

start_time

No

String

Task creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T indicates the start time, and Z indicates the time zone offset. For example, if the time zone offset is one hour, +0100 is displayed. If this parameter is not transferred, the time zone offset is seven days before the current time by default.

end_time

No

String

Task creation end time in the "yyyy-mm-ddThh:mm:ssZ" format. T indicates the start time, and Z indicates the time zone offset. For example, if the time zone offset is one hour, +0100 is displayed. If this parameter is not transferred, the current time is used by default.

offset

No

Integer

Index offset. The query starts from the next piece of data indexed by this parameter. The value is 0 by default.

limit

No

Integer

Number of records to be queried. If this parameter is not transferred, the default value 10 is used. The value ranges from 1 to 100.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of records.

schedules

Array of objects

Task details. For details, see Table 5.

Table 5 ScheduleDetailInfo

Parameter

Type

Description

job_id

String

Task ID

job_name

String

Task name. The value can be:

  • REBOOT: Restart the instance.
  • RESIZE_FLAVOR: Change the CPU or memory of an instance.
  • UPGRADE_DATABASE: patch upgrade

job_status

String

Task execution status. The value can be: The value can be:

  • Pending: The task is not executed.
  • Running: The task is being executed.
  • Completed: The task has been successfully executed.
  • Failed: The task fails to be executed.
  • Canceled: The task is canceled.

instance_id

String

Instance ID

instance_name

String

Instance name

instance_status

String

Instance status. The value can be:

  • Createfail, indicating that the instance failed to be created.
  • Creating, indicating that the instance is being created.
  • Normal: The instance is normal.
  • Abnormal: The instance is abnormal.
  • Deleted: The instance has been deleted.

datastore_type

String

Database type

create_time

String

Task creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

start_time

String

Task start time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

end_time

String

Task end time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

Example Requests

This function is used to query scheduled tasks based on specified conditions.

GET https://{Endpoint}/v3/0549b4a43100d4f32f51c01c2fe4acdb/scheduled-jobs?offset=2&limit=2&start_time=2019-05-27T03:38:51+0000&job_status=Pending

Example Responses

Status code: 200

Success

{ 
  "schedules" : [ { 
    "job_id" : "56d3c1138dcf4f1da73b0170700c78d0", 
    "job_name" : "REBOOT", 
    "job_status" : "Pending", 
    "instance_id" : "8a6117ece8a0457a90060441fa372e8ein06", 
    "instance_name" : "gauss-nosql", 
    "instance_status" : "normal", 
    "datastore_type" : "GeminiDB Cassandra", 
    "create_time" : "2019-05-26T10:41:14+0000", 
    "start_time" : "2019-05-26T12:41:14+0000", 
    "end_time" : "2019-05-26T12:51:14+0000" 
  } ], 
  "total_count" : 1 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.