From c10a2b4ab02efa9f3172aae2741f084a1c477adc Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Mon, 13 Nov 2023 15:56:28 +0800 Subject: [PATCH] =?UTF-8?q?agent=E8=BF=81=E7=A7=BB=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysmig_agent/fork.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py index a128722..daea65f 100644 --- a/sysmig_agent/fork.py +++ b/sysmig_agent/fork.py @@ -38,3 +38,26 @@ def up_to_date_sql_abi(): # 获取abi progress 更新数据库内 sql_abi_progress(abi_process) return 0 + + +# ABI系统检测 +def timed_task_abi(task_id): + time_task = BackgroundScheduler(timezone='Asia/Shanghai') + task_id=str(task_id) + p = time_task.add_job(up_to_date_sql_abi, 'interval', seconds=3) + time_task.start() + try: + task_statue='1' + p_abi = Process(target=migrate_before_abi_chk, args=(q,task_statue,)) + p_abi.start() + p_abi.join() + # Determine whether the message queue is dead or empty to end the timer + while not q.empty(): + continue + time_task.shutdown() + except (KeyboardInterrupt, SystemExit): + # Not strictly necessary if daemonic mode is enabled but should be done if possible + time_task.shutdown() + print('Exit The Job!') + + -- 2.20.1