Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bisect utility #206

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions polaris/model_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 11 additions & 5 deletions utils/bisect/bisect_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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} && ' \
Expand Down Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion utils/bisect/example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading