Updated on 2024-04-22 GMT+08:00

Obtaining Batch Tasks

Function

This API is used to obtain batch tasks.

URI

GET /v2/{project_id}/batch-tasks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

is_paged

No

Boolean

Whether to display records on different pages

Default: true

page_size

No

Integer

Number of records displayed on each page

Minimum: 5

Maximum: 200

Default: 10

page_num

No

Integer

Page number

Minimum: 1

Maximum: 10000

Default: 1

order_by

No

String

Ascending or descending order. The value can be asc or desc.

Default: desc

sort_name

No

String

Sorting field. The value can be task_count or created_at.

Default: created_at

video_group

No

String

Video source group list. Use commas (,) to separate multiple groups. The value must match the regular expression ^[a-zA-Z0-9\u4e00-\u9fa5,-_]{1,1000}$.

Minimum: 1

Maximum: 1000

task_state

No

String

Task status. The value can be pending, recovering, starting, upgrading, create_failed, start_failed, running, stopping, stopped, abnormal, succeeded, failed, deleting, freezing, frozen, stopped_no_service, scheduling, or lack_of_resources.

type_like

No

String

Fuzzy search field. The value can be batch_task_name or publish_service_name.

name_like

No

String

Name for fuzzy search. This parameter must be used together with type_like to determine whether to perform fuzzy search based on batch_task_name or publish_service_name.

Minimum: 0

Maximum: 100

manufacturer

No

String

Filter by vendor. The value must match the regular expression ^[a-zA-Z0-9\u4e00-\u9fa5,-_]{2,64}$.

Minimum: 2

Maximum: 64

title

No

String

Algorithm name, which must match the regular expression ^[a-zA-Z0-9\u4e00-\u9fa5,-_]{2,64}$.

Minimum: 2

Maximum: 64

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details about how to obtain a user token, see Authentication.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total number of records

batch_task_list

Array of BatchTaskDto objects

Batch tasks

Table 5 BatchTaskDto

Parameter

Type

Description

id

String

Batch task ID

batch_task_name

String

Batch task name

video_source_name

String

Video source name

video_group_name

String

Group name

alg_name

String

Algorithm name

company

String

Vendor name

type

String

Task type

num_task

Integer

Total number of batch tasks

created_at

Long

Creation time

batch_task_status_info

BatchTaskStatusInfoDto object

Batch task status information

Table 6 BatchTaskStatusInfoDto

Parameter

Type

Description

pending

Integer

Number of pending tasks

recovering

Integer

Number of tasks being restored

starting

Integer

Number of tasks being started

upgrading

Integer

Number of tasks being upgraded

create_failed

Integer

Number of tasks that failed to be created

start_failed

Integer

Number of tasks that failed to be started

running

Integer

Number of running tasks

stopping

Integer

Number of tasks being stopped

stopped

Integer

Number of stopped tasks

abnormal

Integer

Number of abnormal tasks

succeeded

Integer

Number of successfully executed tasks

failed

Integer

Number of failed tasks

deleting

Integer

Number of tasks being deleted

freezing

Integer

Number of tasks being frozen

frozen

Integer

Number of frozen tasks

stopped_no_service

Integer

Number of tasks that are pending after the service is redeployed

scheduling

Integer

Scheduling

lack_of_resources

Integer

Failed to create the batch task due to insufficient resources.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Example Requests

This request is used to obtain batch task information, including the batch task name, video source group, algorithm service name, configuration type, number of tasks, creation time, and task status.

 https://xxx/v2/xxx/batch-tasks?page_num=1&page_size=10

Example Responses

Status code: 200

Response to a batch operation request

{
  "count" : 2,
  "batch_task_list" : [ {
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "batch_task_name" : "qqqq",
    "video_group_name" : "2312,1889,927,914",
    "alg_name" : "testwjh",
    "type" : "0",
    "priority" : "low",
    "num_task" : 3,
    "created_at" : 1685667905165,
    "batch_task_status_info" : {
      "stopped" : 3
    }
  }, {
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "batch_task_name" : "qqq",
    "video_group_name" : "2312",
    "alg_name" : "testwjh",
    "type" : "0",
    "priority" : "low",
    "num_task" : 1,
    "created_at" : 1685667856283,
    "batch_task_status_info" : {
      "running" : 1
    }
  } ]
}

Status Codes

Status Code

Description

200

Response to a batch operation request

400

Request error

500

Internal error

Error Codes

See Error Codes.