luojunhui 5 ماه پیش
والد
کامیت
24df44b607
3فایلهای تغییر یافته به همراه20 افزوده شده و 11 حذف شده
  1. 2 1
      applications/longArticlesMysql.py
  2. 10 5
      checkVideoStatusDaily.py
  3. 8 5
      getOffVideosDaily.py

+ 2 - 1
applications/longArticlesMysql.py

@@ -14,7 +14,8 @@ class longArticlesMySQL(object):
         user='changwen_admin',
         password='changwen@123456',
         db='long_articles',
-        charset='utf8mb4'
+        charset='utf8mb4',
+        connect_timeout=120
     )
 
     @classmethod

+ 10 - 5
checkVideoStatusDaily.py

@@ -6,7 +6,7 @@ import traceback
 
 from tqdm import tqdm
 
-from applications import PQAPI, PQMySQL, bot
+from applications import PQAPI, longArticlesMySQL, bot
 
 
 class VideoStatusManager(object):
@@ -22,14 +22,15 @@ class VideoStatusManager(object):
         初始化数据库连接和 pq 方法类
         """
         try:
-            self.db_client = PQMySQL()
+            self.db_client = longArticlesMySQL()
         except Exception as e:
             error_msg = traceback.format_exc()
             bot(
                 title="视频状态校验任务,每 20 分钟执行一次,数据库初始化异常",
                 detail={
                     "error": str(e),
-                    "error_msg": error_msg
+                    "error_msg": error_msg,
+                    "server": "new_server"
                 }
             )
             return False
@@ -41,7 +42,8 @@ class VideoStatusManager(object):
                 title="视频状态校验任务,每 20 分钟执行一次,apollo连接异常",
                 detail={
                     "error": str(e),
-                    "error_msg": error_msg
+                    "error_msg": error_msg,
+                    "server": "new_server"
                 }
             )
             return False
@@ -120,7 +122,10 @@ class VideoStatusManager(object):
             if fail_list:
                 bot(
                     title="修改视频状态失败",
-                    detail=fail_list
+                    detail={
+                        "list": fail_list,
+                        "server": "new_server"
+                    }
                 )
             self.update_check_status(video_temp)
         print("total", len(video_id_list))

+ 8 - 5
getOffVideosDaily.py

@@ -8,7 +8,7 @@ import traceback
 
 from tqdm import tqdm
 
-from applications import PQMySQL, PQAPI, log, bot
+from applications import longArticlesMySQL, PQAPI, log, bot
 
 EXPIRE_TIME = 3 * 24 * 60 * 60
 
@@ -28,14 +28,15 @@ class AutoGetOffVideos(object):
         :return:
         """
         try:
-            self.db_client = PQMySQL()
+            self.db_client = longArticlesMySQL()
         except Exception as e:
             error_msg = traceback.format_exc()
             bot(
                 title="自动下架视频任务,数据库初始化失败",
                 detail={
                     "error": str(e),
-                    "error_msg": error_msg
+                    "error_msg": error_msg,
+                    "server": "new_server"
                 }
             )
             return False
@@ -48,7 +49,8 @@ class AutoGetOffVideos(object):
                 title="自动下架视频任务,pq公共方法连接失败",
                 detail={
                     "error": str(e),
-                    "error_msg": error_msg
+                    "error_msg": error_msg,
+                    "server": "new_server"
                 }
             )
             return False
@@ -202,7 +204,8 @@ def main():
             title="get_off_jobs任务执行完成通知",
             mention=False,
             detail={
-                "finish_time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+                "finish_time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
+                "server": "new server"
             }
         )