main #38

Merged
charles merged 4 commits from main into prod 2025-11-20 17:08:08 +08:00
3 changed files with 10 additions and 7 deletions
Showing only changes of commit 26ce699c60 - Show all commits

View File

@ -40,10 +40,10 @@ async def baidu_sms_kafka_consumer(ns={}):
total_count = 0 total_count = 0
for i in range(2): for i in range(2):
if i == 0: # if i == 0:
# 写入文件记录轮询开始时间 时间格式: YYYY-MM-DD HH:MM:SS # # 写入文件记录轮询开始时间 时间格式: YYYY-MM-DD HH:MM:SS
with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f: # with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f:
f.write(f"轮询开始时间:{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n") # f.write(f"轮询开始时间:{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
msg = consumer.poll(0.2) # 单次轮询获取消息 msg = consumer.poll(0.2) # 单次轮询获取消息
@ -171,8 +171,8 @@ async def baidu_sms_kafka_consumer(ns={}):
'msg': f"处理异常: {str(e)}" 'msg': f"处理异常: {str(e)}"
} }
# 记录total_count # 记录total_count
with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f: # with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f:
f.write(f"本次轮询共处理消息数:{total_count}\n") # f.write(f"本次轮询共处理消息数:{total_count}\n")
consumer.close() # 确保消费者关闭 consumer.close() # 确保消费者关闭
return { return {

View File

@ -34,4 +34,4 @@
*/1 * * * * curl https://www.opencomputing.cn/jdcloud/get_partner_order_list.dspy?page=1 > /d/zhc/crontab_prod.log 2>&1 */1 * * * * curl https://www.opencomputing.cn/jdcloud/get_partner_order_list.dspy?page=1 > /d/zhc/crontab_prod.log 2>&1
* * * * * curl https://www.opencomputing.cn/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_prod.log 2>&1 * * * * * curl https://www.opencomputing.cn/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_prod.log 2>&1
#* * * * * curl https://www.opencomputing.cn/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1 #* * * * * curl https://www.opencomputing.cn/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1
*/5 * * * * /usr/bin/python3 /d/zhc/kboss_prod/kgadget/src/more_task_scheduler.py >> /tmp/multi_task_scheduler_cron.log 2>&1 */5 * * * * /usr/bin/python3 /d/zhc/kboss_prod/kgadget/src/more_task_scheduler.py

View File

@ -25,6 +25,9 @@ logging.basicConfig(
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# 屏蔽APScheduler框架日志避免记录框架执行信息
logging.getLogger('apscheduler').setLevel(logging.WARNING)
class ProcessChecker: class ProcessChecker:
"""进程检测类""" """进程检测类"""