📣
TiDB Cloud Premium 开放公测中。为企业级工作负载提供无限扩展、即时弹性伸缩和高级安全保障。此页面由 AI 自动翻译,英文原文请见此处。

SHOW TASKS



列出当前角色可见的任务。

NOTICE: 此命令开箱即用仅适用于 TiDB Cloud Lake。对于自托管部署,请配置 Cloud Control 以查询任务。

语法

SHOW TASKS [LIKE '<pattern>' | WHERE <expr>]
参数描述
LIKE使用大小写敏感的模式匹配和 % 通配符过滤任务名称。
WHERE使用输出列上的表达式过滤结果集。

输出

SHOW TASKS 返回以下列:

  • created_on:任务创建时的时间戳。
  • name:任务名称。
  • id:内部任务标识符。
  • owner:拥有该任务的角色。
  • comment:可选注释。
  • warehouse:分配给任务的计算集群 (Warehouse)。
  • schedule:间隔或 CRON 调度(如果存在)。
  • state:当前状态(Started 或 Suspended)。
  • definition:任务运行的 SQL。
  • condition_text:任务的 WHEN 条件。
  • after:DAG 中上游任务的逗号分隔列表。
  • suspend_task_after_num_failures:挂起前允许连续失败的次数。
  • error_integration:失败时使用的通知集成。
  • next_schedule_time:下一次计划运行的时间戳。
  • last_committed_on:上次修改任务定义时的时间戳。
  • last_suspended_on:任务上次被挂起时的时间戳(如果有)。
  • session_parameters:任务运行时应用的会话参数。

示例

列出当前角色可用的所有任务:

SHOW TASKS; +----------------------------+---------------+------+---------------+---------+-----------+---------------------------------+----------+-------------------------------------------+------------------------+---------+-------------------------------------+-------------------+----------------------------+----------------------------+----------------------------+---------------------------------------------------+ | created_on | name | id | owner | comment | warehouse | schedule | state | definition | condition_text | after | suspend_task_after_num_failures | error_integration | next_schedule_time | last_committed_on | last_suspended_on | session_parameters | +----------------------------+---------------+------+---------------+---------+-----------+---------------------------------+----------+-------------------------------------------+------------------------+---------+-------------------------------------+-------------------+----------------------------+----------------------------+----------------------------+---------------------------------------------------+ | 2024-07-01 08:00:00.000000 | ingest_sales | 101 | ACCOUNTADMIN | NULL | etl_wh | CRON 0 5 * * * * TIMEZONE UTC | Started | COPY INTO sales FROM @stage PATTERN '.*' | STREAM_STATUS('s1') | | 3 | slack_errors | 2024-07-01 08:05:00.000000 | 2024-07-01 08:00:00.000000 | NULL | {"enable_query_result_cache":"1"} | | 2024-07-01 09:00:00.000000 | hourly_checks | 102 | SYSADMIN | health | etl_wh | INTERVAL 3600 SECOND | Suspended | CALL run_health_check() | | ingest_sales | NULL | NULL | 2024-07-01 10:00:00.000000 | 2024-07-01 09:05:00.000000 | 2024-07-01 09:10:00.000000 | {"query_result_cache_min_execute_secs":"5"} | +----------------------------+---------------+------+---------------+---------+-----------+---------------------------------+----------+-------------------------------------------+------------------------+---------+-------------------------------------+-------------------+----------------------------+----------------------------+----------------------------+---------------------------------------------------+

仅显示名称以 ingest_ 开头的任务:

SHOW TASKS LIKE 'ingest_%';

文档内容是否有帮助?