فهرست منبع

feat:优化日志SQL

zhaohaipeng 5 روز پیش
والد
کامیت
2569abe5d9
1فایلهای تغییر یافته به همراه18 افزوده شده و 4 حذف شده
  1. 18 4
      monitor/supply_workflow_monitor.py

+ 18 - 4
monitor/supply_workflow_monitor.py

@@ -128,12 +128,19 @@ def workflow_status_stat(ts: int, workflow_id: str, workflow_name: str):
                                          when swcpr.status = 1 then '运行中'
                                          when swcpr.status = 2 then '成功'
                                          when swcpr.status = 3 then '失败'
+                                         when swt.task_status = 0 then '初始化'
+                                         when swt.task_status = 1 then '运行中'
+                                         when swt.task_status = 2 then '成功'
+                                         when swt.task_status = 3 then '失败'
                                          else '未知' end   AS status,
                                      case
                                          when swcpr.error_msg like '%Data too long%' then '数据超过字段长度限制'
                                          when swcpr.error_msg like '%Deadlock%' then '数据库死锁'
-                                         when (swcpr.error_msg = '' or swcpr.error_msg is null) then ''
-                                         else substring_index(swcpr.error_msg, ',', 1)
+                                         when (swcpr.error_msg <> '' AND swcpr.error_msg is not null) then substring_index(swcpr.error_msg, ',', 1)
+                                         when swt.error_msg like '%Data too long%' then '数据超过字段长度限制'
+                                         when swt.error_msg like '%Deadlock%' then '数据库死锁'
+                                         when (swt.error_msg <> '' AND swt.error_msg is not null) then substring_index(swt.error_msg, ',', 1)
+                                         else '' 
                                          end               AS error_msg
                               from supply_workflow_task swt
                                        left join supply_workflow_crawler_plan_record swcpr
@@ -156,12 +163,19 @@ def workflow_status_stat(ts: int, workflow_id: str, workflow_name: str):
                                          when swppr.status = 1 then '运行中'
                                          when swppr.status = 2 then '成功'
                                          when swppr.status = 3 then '失败'
+                                         when swt.task_status = 0 then '初始化'
+                                         when swt.task_status = 1 then '运行中'
+                                         when swt.task_status = 2 then '成功'
+                                         when swt.task_status = 3 then '失败'
                                          else '未知' end AS status,
                                      case
                                          when swppr.error_msg like '%Data too long%' then '数据超过字段长度限制'
                                          when swppr.error_msg like '%Deadlock%' then '数据库死锁'
-                                         when (swppr.error_msg = '' or swppr.error_msg is null) then ''
-                                         else substring_index(swppr.error_msg, ',', 1)
+                                         when (swppr.error_msg <> '' and swppr.error_msg is not null) then substring_index(swppr.error_msg, ',', 1)
+                                         when swt.error_msg like '%Data too long%' then '数据超过字段长度限制'
+                                         when swt.error_msg like '%Deadlock%' then '数据库死锁'
+                                         when (swt.error_msg <> '' AND swt.error_msg is not null) then substring_index(swt.error_msg, ',', 1)
+                                         else ''
                                          end             AS error_msg
                               from supply_workflow_task swt
                                        left join supply_workflow_produce_bind_record swppr