main #38
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -25,6 +25,9 @@ logging.basicConfig(
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 屏蔽APScheduler框架日志,避免记录框架执行信息
|
||||
logging.getLogger('apscheduler').setLevel(logging.WARNING)
|
||||
|
||||
class ProcessChecker:
|
||||
"""进程检测类"""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user