Quellcode durchsuchen

修复附件识别和要素提取消费不足问题

luojiehua vor 1 Jahr
Ursprung
Commit
07982775cf

+ 4 - 2
BaseDataMaintenance/dataMonitor/data_monitor.py

@@ -498,8 +498,10 @@ class BaseDataMonitor():
                 process_count = 0
             if int(process_count)==0:
                 atAll = True
-            # if int(process_count)>0 and int(process_count)<100:
-            #     self.cmd_execute("ps -ef | grep dumplicate | grep -v grep|cut -c 9-15|xargs kill -9")
+                _cmd = "echo `tail %s -c 10000k` > %s"%(flow_dumplicate_log_path,flow_dumplicate_log_path)
+                self.cmd_execute(_cmd)
+            if int(process_count)>0 and int(process_count)<100:
+                self.cmd_execute("ps -ef | grep dumplicate | grep -v grep|cut -c 9-15|xargs kill -9")
             _msg = "数据流报警:待去重公告数为:%d,最近十分钟去重数为:%s"%(total_count,str(process_count))
             sentMsgToDD(_msg,ACCESS_TOKEN_DATAWORKS,atAll=atAll)
             # sendEmail(smtp_host,smtp_username,smtp_password,self.recieviers,_msg)

+ 9 - 5
BaseDataMaintenance/maintenance/dataflow_mq.py

@@ -615,11 +615,15 @@ class Dataflow_ActivteMQ_attachment(Dataflow_attachment):
         current_date = getCurrent_date(format="%Y-%m-%d")
         last_date = timeAdd(current_date,-2,format="%Y-%m-%d")
         sql = " delete from attachment where crtime<='%s 00:00:00' "%(last_date)
-        conn = getConnection_postgres()
-        cursor = conn.cursor()
-        cursor.execute(sql)
-        conn.commit()
-        conn.close()
+        conn = self.attach_pool.getConnector()
+        try:
+            cursor = conn.cursor()
+            cursor.execute(sql)
+            conn.commit()
+            self.attach_pool.putConnector(conn)
+        except Exception as e:
+            conn.close()
+
 
 
     def start_flow_attachment(self):