main #37

Merged
charles merged 2 commits from main into prod 2025-11-20 16:14:02 +08:00
3 changed files with 10 additions and 7 deletions

View File

@ -40,10 +40,10 @@ async def baidu_sms_kafka_consumer(ns={}):
total_count = 0
for i in range(2):
if i == 0:
# 写入文件记录轮询开始时间 时间格式: YYYY-MM-DD HH:MM:SS
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")
# if i == 0:
# # 写入文件记录轮询开始时间 时间格式: YYYY-MM-DD HH:MM:SS
# 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")
msg = consumer.poll(0.2) # 单次轮询获取消息
@ -171,8 +171,8 @@ async def baidu_sms_kafka_consumer(ns={}):
'msg': f"处理异常: {str(e)}"
}
# 记录total_count
with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f:
f.write(f"本次轮询共处理消息数:{total_count}\n")
# with open('baidu_kafka_msg.txt', 'a', encoding='utf-8') as f:
# f.write(f"本次轮询共处理消息数:{total_count}\n")
consumer.close() # 确保消费者关闭
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
* * * * * 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
*/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__)
# 屏蔽APScheduler框架日志避免记录框架执行信息
logging.getLogger('apscheduler').setLevel(logging.WARNING)
class ProcessChecker:
"""进程检测类"""