From 661d6b43ec703be8ffc32d6713a3ba33ccd6399e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=89=BA=E4=B8=B9?= <53546877+Craven1701@users.noreply.github.com> Date: Tue, 20 May 2025 10:51:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?confit=5Ftuning=E6=96=B0=E5=A2=9E=E5=AF=B9?= =?UTF-8?q?=E4=BA=8Euser=5Fconfig=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- omniadvisor/src/omniadvisor/interface/config_tuning.py | 3 +++ omniadvisor/src/server/app/models.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/omniadvisor/src/omniadvisor/interface/config_tuning.py b/omniadvisor/src/omniadvisor/interface/config_tuning.py index 221a22961..13b6f0c39 100644 --- a/omniadvisor/src/omniadvisor/interface/config_tuning.py +++ b/omniadvisor/src/omniadvisor/interface/config_tuning.py @@ -104,6 +104,9 @@ def main(): # 查询上一次调优的结果是否测试完毕: tuning_result_history = get_tuning_result_history(load) + # 如果上一次的调优结果所使用的配置是用户默认配置 则无需调优 直接将状态设置为success + if tuning_result_history.latest_tuning_result.config == load.default_config: + tuning_result_history.latest_tuning_result.status = OA_CONF.ExecStatu.success if (tuning_result_history.latest_tuning_result and tuning_result_history.latest_tuning_result.status == OA_CONF.ExecStatus.running): # 有上一次调优,且调优的结果仍在复测中,提示无法调优并退出 diff --git a/omniadvisor/src/server/app/models.py b/omniadvisor/src/server/app/models.py index 17243fce9..20ab25f2a 100644 --- a/omniadvisor/src/server/app/models.py +++ b/omniadvisor/src/server/app/models.py @@ -52,7 +52,7 @@ class DatabaseTuningRecord(models.Model): class Meta: constraints = [ - models.UniqueConstraint(fields=['load', 'config'], name='exam_record_unique') + models.UniqueConstraint(fields=['load', 'config'], name='tuning_record_unique') ] db_table = 'omniadvisor_tuning_record' # 自定义表名 -- Gitee From e874a7857d4fc2345e1d656b4da0f22c98acce3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=89=BA=E4=B8=B9?= <53546877+Craven1701@users.noreply.github.com> Date: Wed, 21 May 2025 11:47:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=AF=B9=E4=BA=8Ereque?= =?UTF-8?q?sts=E5=8C=85=E7=9A=84=E4=BE=9D=E8=B5=96=E9=9C=80=E6=B1=82=202.?= =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E4=BD=BF=E7=94=A8=E7=94=A8=E6=88=B7=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E8=B0=83=E4=BC=98=E8=AE=B0=E5=BD=95=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=20=E4=B8=8D?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E8=B0=83=E4=BC=98=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- omniadvisor/pyproject.toml | 1 + omniadvisor/src/omniadvisor/interface/config_tuning.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/omniadvisor/pyproject.toml b/omniadvisor/pyproject.toml index 764ef6b64..37dde83d9 100755 --- a/omniadvisor/pyproject.toml +++ b/omniadvisor/pyproject.toml @@ -19,6 +19,7 @@ python = "^3.8" django = "~4.2.10" smac = "~2.2.0" colorlog = "~6.9.0" +requests = "^2.32.3" [tool.poetry.group.test.dependencies] pytest = "^7.4.4" diff --git a/omniadvisor/src/omniadvisor/interface/config_tuning.py b/omniadvisor/src/omniadvisor/interface/config_tuning.py index f12070962..e105bbf47 100644 --- a/omniadvisor/src/omniadvisor/interface/config_tuning.py +++ b/omniadvisor/src/omniadvisor/interface/config_tuning.py @@ -122,9 +122,10 @@ def main(): # 查询上一次调优的结果是否测试完毕: tuning_result_history = get_tuning_result_history(load) - # 如果上一次的调优结果所使用的配置是用户默认配置 则无需调优 直接将状态设置为success - if tuning_result_history.latest_tuning_result.config == load.default_config: - tuning_result_history.latest_tuning_result.status = OA_CONF.ExecStatu.success + # 如果上一次的调优结果所使用的配置是用户默认配置 则无需调优 直接返回 + if tuning_result_history.latest_tuning_result.tuning_record.method == OA_CONF.TuningMethod.user: + global_logger.info("The method of latest tuning result is user, not need to tuning") + return if (tuning_result_history.latest_tuning_result and tuning_result_history.latest_tuning_result.status == OA_CONF.ExecStatus.running): # 有上一次调优,且调优的结果仍在复测中,提示无法调优并退出 -- Gitee From 5a549a00c882758d13136856363a9f8cae2df28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=89=BA=E4=B8=B9?= <53546877+Craven1701@users.noreply.github.com> Date: Wed, 21 May 2025 16:56:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=85=B3=E4=BA=8E=E8=B0=83=E4=BC=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=98=AF=E5=90=A6=E5=A4=84=E4=BA=8E=E5=A4=8D?= =?UTF-8?q?=E6=B5=8B=E6=B5=81=E7=A8=8B=E7=9A=84=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/omniadvisor/interface/config_tuning.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/omniadvisor/src/omniadvisor/interface/config_tuning.py b/omniadvisor/src/omniadvisor/interface/config_tuning.py index e105bbf47..9e3572fde 100644 --- a/omniadvisor/src/omniadvisor/interface/config_tuning.py +++ b/omniadvisor/src/omniadvisor/interface/config_tuning.py @@ -120,15 +120,14 @@ def main(): if not load: return - # 查询上一次调优的结果是否测试完毕: + # 查询上一次调优的所推送的配置是否完成复测流程 如果满足以下所有条件,则提示无法调优并退出: + # 1. 存在最近的调优结果 + # 2. 调优方法不是用户配置(用户配置无需复测) + # 3. 调优结果状态仍在运行中(复测中) tuning_result_history = get_tuning_result_history(load) - # 如果上一次的调优结果所使用的配置是用户默认配置 则无需调优 直接返回 - if tuning_result_history.latest_tuning_result.tuning_record.method == OA_CONF.TuningMethod.user: - global_logger.info("The method of latest tuning result is user, not need to tuning") - return - if (tuning_result_history.latest_tuning_result and tuning_result_history.latest_tuning_result.status == - OA_CONF.ExecStatus.running): - # 有上一次调优,且调优的结果仍在复测中,提示无法调优并退出 + if (tuning_result_history.latest_tuning_result + and tuning_result_history.latest_tuning_result.tuning_record.method != OA_CONF.TuningMethod.user + and tuning_result_history.latest_tuning_result.status == OA_CONF.ExecStatus.running): global_logger.info('The retest status of latest tuning result is still running, please wait.') return -- Gitee