From ddddc7907ad7ea2cadf93f9fd31f098032532ffc Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 19 Jul 2024 02:27:11 -0700 Subject: [PATCH 1/2] Fix --copy_executable --- polaris/model_step.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/polaris/model_step.py b/polaris/model_step.py index b0a6dc2a1..2819dadc1 100644 --- a/polaris/model_step.py +++ b/polaris/model_step.py @@ -465,12 +465,12 @@ def _process_model(config, base_work_dir): copy_executable = config.getboolean('setup', 'copy_executable') if copy_executable: # make a copy of the model executable, then link to that - mpas_subdir = os.path.basename( - config.get('paths', 'mpas_model')) - mpas_workdir = os.path.join(base_work_dir, mpas_subdir) - target = os.path.join(mpas_workdir, filename) + component_subdir = os.path.basename( + config.get('paths', 'component_path')) + component_workdir = os.path.join(base_work_dir, component_subdir) + target = os.path.join(component_workdir, filename) try: - os.makedirs(mpas_workdir) + os.makedirs(component_workdir) except FileExistsError: pass From 477a0f43874b7802cab40db603400707c26523d3 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 19 Jul 2024 02:54:48 -0700 Subject: [PATCH 2/2] Fix submodule checkout in bisect utility --- utils/bisect/bisect_step.py | 16 +++++++++++----- utils/bisect/example.cfg | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/utils/bisect/bisect_step.py b/utils/bisect/bisect_step.py index 68dff6271..465e6977d 100755 --- a/utils/bisect/bisect_step.py +++ b/utils/bisect/bisect_step.py @@ -6,8 +6,8 @@ import subprocess -def run(launch_path, mpas_path, work_base, load_script, make_command, - setup_command, run_command): +def run(launch_path, e3sm_path, mpas_path, work_base, load_script, + make_command, setup_command, run_command): """ This function runs a single step in the bisection process. It is typically called through ``git bisect run`` within the ``utils/bisect/bisect.py`` but @@ -19,6 +19,8 @@ def run(launch_path, mpas_path, work_base, load_script, make_command, The path from which relative paths in the config file are defined, typically the root of the polaris branch where the config file resides and where ``utils/bisect/bisect.py`` was called. + e3sm_path : str + The relative or absolute path to the e3sm branch to build from. mpas_path : str The relative or absolute path to the mpas component to be built. work_base : str @@ -38,6 +40,7 @@ def run(launch_path, mpas_path, work_base, load_script, make_command, test case(s) """ + e3sm_path = to_abs(e3sm_path, launch_path) mpas_path = to_abs(mpas_path, launch_path) work_base = to_abs(work_base, launch_path) load_script = to_abs(load_script, launch_path) @@ -55,10 +58,12 @@ def run(launch_path, mpas_path, work_base, load_script, make_command, except FileExistsError: pass - os.chdir(mpas_path) commands = f'source {load_script} && ' \ + f'cd {e3sm_path} && ' \ + f'rm -rf * && ' \ + f'git reset --hard HEAD && ' \ f'git submodule update --init --recursive && ' \ - f'make clean >& {work_path}/clean.log && ' \ + f'cd {mpas_path} && ' \ f'{make_command} >& {work_path}/make.log && ' \ f'{setup_command} -p {mpas_path} -w {work_path} && ' \ f'cd {work_path} && ' \ @@ -112,7 +117,8 @@ def main(): launch_path = os.path.dirname(args.config_file) section = config['bisect'] - run(launch_path=launch_path, mpas_path=section['mpas_path'], + run(launch_path=launch_path, e3sm_path=section['e3sm_path'], + mpas_path=section['mpas_path'], work_base=section['work_base'], load_script=section['load_script'], make_command=section['make_command'], setup_command=section['setup_command'], diff --git a/utils/bisect/example.cfg b/utils/bisect/example.cfg index bcb6eb331..4c4a484bf 100644 --- a/utils/bisect/example.cfg +++ b/utils/bisect/example.cfg @@ -27,4 +27,4 @@ setup_command = polaris setup --copy_executable -n 39 -b /lcrc/group/e3sm/ac.xyl # polaris environment load_script = load_polaris_bisect_anvil_intel_impi.sh # the command to run polaris within the work directory -run_command = polaris run +run_command = polaris serial