update abi result to database

This commit is contained in:
xuezhixin 2024-11-11 16:00:15 +08:00
parent 3c232b475b
commit bb5d180913
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,72 @@
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

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.3
Release: 9
Release: 10
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -16,6 +16,7 @@ Patch006: 0006-add-message-query-to-update-abi-process.patch
Patch007: 0007-start-task-to-check-migration.patch
Patch008: 0008-add-system-migration-task.patch
Patch009: 0009-get-abi-detection-process.patch
Patch010: 0010-update-abi-result-to-database.patch
BuildArch: noarch
@ -115,6 +116,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-10
- 0010-update-abi-result-to-database.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-9
- 0009-get-abi-detection-process.patch