From ae7a6f9d2aca1e6321fb80757cd698be2f9bab4c Mon Sep 17 00:00:00 2001 From: DimitriWeiss Date: Sun, 15 Oct 2023 15:45:28 +0200 Subject: [PATCH] Handling call_engine_OAT --- up_ac/OAT_configurator.py | 8 ++++---- up_ac/utils/download_OAT.py | 15 +++++++++++---- up_ac/utils/load_smac_feedback.py | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/up_ac/OAT_configurator.py b/up_ac/OAT_configurator.py index 5e89975..ec451fa 100644 --- a/up_ac/OAT_configurator.py +++ b/up_ac/OAT_configurator.py @@ -87,10 +87,10 @@ def planner_feedback(config, instance, reader): Returns: float: Feedback value based on the planner's performance. """ - path = os.getcwd().rsplit('up-ac', 1)[0] + path = os.getcwd().rsplit('up_ac', 1)[0] if path[-1] != "/": path += "/" - path += 'up-ac/up_ac' + path += 'up_ac' sys.path.append(r"{}".format(path)) self.reader = reader @@ -243,10 +243,10 @@ def set_scenario(self, engine, param_space, gaci, param_file = gaci.get_ps_oat(param_space) - path = os.getcwd().rsplit('up-ac', 2)[0] + path = os.getcwd().rsplit('up_ac', 2)[0] if path[-1] != "/": path += "/" - path += 'up-ac/up_ac' + path += 'up_ac' path_to_xml = f'{path}/OAT/{engine}parameterTree.xml' diff --git a/up_ac/utils/download_OAT.py b/up_ac/utils/download_OAT.py index b323a49..b5bcce3 100644 --- a/up_ac/utils/download_OAT.py +++ b/up_ac/utils/download_OAT.py @@ -49,15 +49,22 @@ def get_OAT(): os.chmod(f'{path}/OAT/Optano.Algorithm.Tuner.Application', st.st_mode | stat.S_IEXEC) - shutil.copy('call_engine_OAT.py', f'{path}/OAT/') + +def copy_call_engine_OAT(): + # Copy call_engine_OAT from utils to OAT directory + path = os.getcwd().rsplit('up_ac', 1)[0] + if path[-1] != "/": + path += "/" + path += 'up_ac' + + shutil.copy(f'{path}/utils/call_engine_OAT.py', f'{path}/OAT/') def delete_OAT(): # Set path to up-ac - path = os.getcwd().rsplit('up-ac', 1)[0] + path = os.getcwd().rsplit('up_ac', 1)[0] if path[-1] != "/": path += "/" - path += 'up-ac/up_ac' - print('PATH', path) + path += 'up_ac' if os.path.isdir(f'{path}/OAT/'): shutil.rmtree(f'{path}/OAT/') diff --git a/up_ac/utils/load_smac_feedback.py b/up_ac/utils/load_smac_feedback.py index d1a9746..db543d1 100644 --- a/up_ac/utils/load_smac_feedback.py +++ b/up_ac/utils/load_smac_feedback.py @@ -8,10 +8,10 @@ def get_feedback(config, instance, seed=0): - path = os.getcwd().rsplit('up-ac', 1)[0] + path = os.getcwd().rsplit('up_ac', 1)[0] if path[-1] != "/": path += "/" - path += 'up-ac/up_ac/utils' + path += 'up_ac/utils' sys.path.append(r"{}".format(path)) fb = \