Skip to content

Commit

Permalink
make prerun script delete old mod directories before copy because the…
Browse files Browse the repository at this point in the history
…y aren't overwriting
  • Loading branch information
teopb committed Dec 14, 2023
1 parent 3af8a8f commit a21b6cf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions MPAS_true_failure_testing/pre_run_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def main(argv):
print(f"Creating directories for {test_name} test")

init_copy_folder = f"{init_copy_dir}/{test_name}"

if os.path.exists(init_copy_folder):
try:
shutil.rmtree(init_copy_folder)
except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror))

command = f"cp -aTf {init_dir}/ {init_copy_folder}"
os.system(command)

Expand Down Expand Up @@ -96,6 +103,13 @@ def main(argv):
for order in neg_test_orders:
# create initial conditions copy directories (helpful if initial directory restart files are absolute symlinks for size)
init_copy_folder = f"{init_copy_dir}/{var_name}_perturb_neg{order}"

if os.path.exists(init_copy_folder):
try:
shutil.rmtree(init_copy_folder)
except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror))

command = f"cp -af {init_dir}/ {init_copy_folder}"
os.system(command)

Expand Down Expand Up @@ -128,6 +142,13 @@ def main(argv):
for order in pos_test_orders:
# create initial conditions copy directories (helpful if initial directory restart files are absolute symlinks for size)
init_copy_folder = f"{init_copy_dir}/{var_name}_perturb_{order}"

if os.path.exists(init_copy_folder):
try:
shutil.rmtree(init_copy_folder)
except OSError as e:
print("Error: %s - %s." % (e.filename, e.strerror))

command = f"cp -af {init_dir}/ {init_copy_folder}"
os.system(command)

Expand Down

0 comments on commit a21b6cf

Please sign in to comment.