migration-tools/0010-update-abi-result-to-database.patch
2024-11-11 16:00:15 +08:00

73 lines
2.1 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 1b94627aaa5a88b12e8d9d9ebf42be2dc08d7503 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 16:08:31 +0800
Subject: [PATCH] =?UTF-8?q?agent=E7=9A=84abi=E6=A3=80=E6=B5=8B=E7=BB=93?=
=?UTF-8?q?=E6=9E=9C=E6=9B=B4=E6=96=B0=E5=88=B0sql?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/fork.py | 48 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py
index 8c2f4b6..3447678 100644
--- a/sysmig_agent/fork.py
+++ b/sysmig_agent/fork.py
@@ -150,3 +150,51 @@ def get_abi_info():
return msg
# if not q.empty():
+
+def process_time_task_abi(task_id):
+ # 定时任务启动并更新进度
+ timed_task_abi(task_id)
+ # abi结果接入数据库内
+ abi_file_sql(abi_file)
+ # p_timed_task = Process(target=timed_task_abi, args=(task_id,))
+ # p_timed_task.start()
+ # p_timed_task.join()
+
+
+def structure_task():
+ # 先获得mysql的任务
+ ret_task = get_sql_task()
+ if not ret_task:
+ print('agent_task is None..')
+ pass
+ # 判断任务类型
+ print(ret_task)
+ if 1 == ret_task:
+ # 调用ABI权重比函数
+ ret_data = abi_check_priority()
+ # 更新mysql的任务状态
+ put_sql_task(ret_data)
+
+
+
+# ABI对比结果文件存放数据库内
+def abi_file_sql(path):
+ with open(path, 'r') as p:
+ ret = p.readlines()
+ p.close()
+ for i in range(len(ret)):
+ info = ret[i].split(',', 5)
+ info_str = ''
+ for n in range(len(info)):
+ if n < 9:
+ sinfo = ''
+ if info[n].strip().strip('\n'):
+ sinfo = info[n].strip().strip('\n')
+ info_str = info_str+"'{}'".format(sinfo)
+ else:
+ sinfo='NULL'
+ info_str = info_str+"{}".format(sinfo)
+ if n != (len(info)-1):
+ info_str = info_str+','
+ abi_file_connect(info_str)
+
--
2.20.1