ListLanceTasks

更新时间:
复制 MD 格式

按任务类型列举当前表的维护任务,按创建时间从新到旧返回,支持 marker 分页。

权限说明

API

Action

说明

ListLanceTasks

oss:GetTableMaintenanceJobStatus

列举维护任务。

请求语法

GET /lance/oss/v1/table/{id}/tasks?task_type=lance_compact&max_results=100 HTTP/1.1
Host: {tableBucketHost}
Date: GMT Date
Authorization: SignatureValue

# 后续页:
# GET /lance/oss/v1/table/{id}/tasks?task_type=lance_compact&max_results=100&marker={next_marker} HTTP/1.1

请求参数

接口的公共约定(访问地址、表标识、请求与响应头、权限、异步提交与额度、任务状态、错误码)请参见 Lance 表维护。

参数

位置

数据类型

是否必须

描述

id

path

string

是

当前表标识。

task_type

query

string

是

必须使用下列五种完整类型之一。

max_results

query

int32

否

默认值 100。单页最多返回任务数,范围 [1, 1000]。

marker

query

string

否

默认不传。不透明续页 token,原样使用上次响应的 next_marker,并按 Query 参数正确编码。

delimiter

query

string

否

默认值 $。表标识分隔符。

task_type 允许值与约束

lance_compact
lance_scalar_index
lance_vector_index
lance_optimize_indices
lance_cleanup

compact、create_scalar_index 等路径 action 名不是合法 task_type。一次请求只列举一种类型。不支持 mode 或 status Query 参数;只要出现这两个参数就返回 400 / InvalidInput / 13,包括空值。状态筛选应由客户端对返回结果进行处理。

响应

HTTP/1.1 200 OK
Content-Type: application/json
x-oss-table-id: {table_id}

{
  "tasks": [
    {
      "task_id": "123xxxxxxxxxxxxxxx",
      "task_type": "lance_compact",
      "params": {
        "target_rows_per_fragment": 1048576,
        "materialize_deletions": true,
        "materialize_deletions_threshold": 0.1,
        "max_rows_per_group": 1024,
        "max_bytes_per_file": 0,
        "compaction_mode": "reencode"
      },
      "status": "submitted",
      "created_at": "2026-09-18T04:00:00.000000+00:00",
      "started_at": "",
      "completed_at": "",
      "result": {},
      "error": null
    }
  ],
  "next_marker": "",
  "is_truncated": false
}

响应参数

类型

描述

tasks

object[]

本页任务列表。元素直接使用任务对象,没有额外的 task_info 包装。元素字段见下表。

next_marker

string

有后续有效任务时返回续页 token;末页为空字符串。

is_truncated

boolean

true 表示还有下一页有效任务。

tasks 参数包含的字段如下:

字段

类型

描述

task_id

string

任务 ID。

task_type

string

五种 lance_ 前缀类型之一。

params

object

实际保存的任务参数,包含服务端补齐的默认值。

status

string

当前任务状态。

created_at

string

任务创建时间。

started_at

string

任务开始时间;未开始时为空字符串。

completed_at

string

进入终态的时间;非终态时为空字符串。

result

object

任务执行结果,初始为 {};可以包含嵌套对象和数组,不同任务类型的结果结构不固定。

error

object 或 null

已知状态为 failed 时包含错误对象;其他已知状态为 null。

无任务时返回 {"tasks":[],"next_marker":"","is_truncated":false}。首页应省略 marker。显式空 marker、非法token、跨表或跨 task_type 使用 token,均返回 400 / InvalidContinuationToken /13。不要把内部索引路径作为 marker。

服务端会跳过缺失任务记录的孤儿索引、畸形索引及旧时间戳的重复索引,并确认存在下一条有效任务后才置 is_truncated=true。损坏的任务正文可能导致内部错误。分页不是固定时间点快照;并发提交或删除时,客户端不能假定任务集合完全不变。

错误码

本接口使用 Lance 统一 JSON 错误格式,通用错误码与错误响应结构见公共约定中的 错误响应格式。