# SHOW JOBS **Syntax** ```sql ShowJobsStatement ::= `SHOW JOBS` OptFromPathExpression OptLikeString OptFromPathExpression ::= `FROM` ComponentIdentifier | /* Nothing */ ComponentIdentifier ::= `TASKMANAGER` | `NAMESERVER` OptLikeString ::= `LIKE` string_literal ``` `SHOW JOBS`语句用于显示在集群版下已经提交到TaskManager和NameServer的任务列表。 ## Example ### 查看TaskManager的任务 查看当前所有的任务: ```sql SHOW JOBS; -------- ---------- ------- ------------ ---------- ----------- --------- ---------------- ------- ---- ------ ----- ---------- ----------- job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ---------- ------- ------------ ---------- ----------- --------- ---------------- ------- ---- ------ ----- ---------- ----------- ``` 提交在线数据导入任务: ```sql LOAD DATA INFILE 'file:///tmp/test.csv' INTO TABLE demo_db.t1 options(format='csv', header=false, mode='append'); -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- 1 ImportOfflineData Submitted 2023-05-30 19:54:13 /tmp/sql-14193917739024710575 local[*] NULL NULL NULL NULL TaskManager -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- ``` 查看当前所有的任务: ```sql SHOW JOBS; -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- 1 ImportOfflineData Submitted 2023-05-30 19:54:13 /tmp/sql-14193917739024710575 local[*] NULL NULL NULL NULL TaskManager -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- 1 row in set ``` 查看指定job id的任务: ```sql SHOW JOBS FROM TASKMANAGER like '1'; -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- 1 ImportOfflineData Submitted 2023-05-30 19:54:13 /tmp/sql-14193917739024710575 local[*] NULL NULL NULL NULL TaskManager -------- ------------------- ----------- --------------------- ---------- ------------------------------- ---------- ---------------- ------- ------ ------ ------ ---------- ------------- 1 row in set ``` ### 查看Nameserver里的任务 查看nameserver里的当前db下的所有任务 ```sql show jobs from nameserver; -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ 2 kDeployOP FINISHED 2023-05-29 17:03:12 2023-05-29 17:03:17 NULL NULL NULL NULL test t1 0 - NameServer -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ 1 rows in set ``` 查看nameserver里指定job id的任务 ```sql show jobs from nameserver like '2'; -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ job_id job_type state start_time end_time parameter cluster application_id error db name pid cur_task component -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ 2 kDeployOP FINISHED 2023-05-29 17:03:12 2023-05-29 17:03:17 NULL NULL NULL NULL test t1 0 - NameServer -------- ----------- ---------- --------------------- --------------------- ----------- --------- ---------------- ------- ------ ------ ----- ---------- ------------ 1 rows in set ``` ## 相关语句 [SHOW JOB](./SHOW_JOB.md) [STOP JOBS](./STOP_JOB.md)