Skip to content

Commit

Permalink
Add time/date to run script, improve test scripts. Closes mom-ocean#139.
Browse files Browse the repository at this point in the history
  • Loading branch information
nichannah committed Apr 3, 2016
1 parent 5daf891 commit 0812003
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions exp/MOM_run.csh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ if ( $debug ) then
set runCommand = "$mpirunCommand --debug $npes $executable >fms.out"
endif

echo "About to run experiment $name with model $type. The command is: $runCommand"
echo "About to run experiment $name with model $type at `date`. The command is: $runCommand"

if ( $valid_npes ) then
echo "ERROR: This experiment is designed to run on $valid_npes pes. Please specify --npes $valid_npes "
Expand Down Expand Up @@ -324,7 +324,7 @@ end
unset echo

echo end_of_run
echo "NOTE: Natural end-of-script for experiment $name with model $type."
echo "NOTE: Natural end-of-script for experiment $name with model $type at `date`"

exit 0

10 changes: 8 additions & 2 deletions test/model_test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,18 @@ def run(self, model_type, exp, walltime='01:00:00', ncpus='32',
return (ret, stdout, stderr)


def build(self, model_type):
def build(self, model_type, unit_testing=True):

os.chdir(self.exp_dir)

if unit_testing:
unit_testing = '--unit_testing'
else:
unit_testing =''

platform = self.get_platform()
build_cmd = plat.build_cmd.format(type=model_type, platform=platform)
build_cmd = plat.build_cmd.format(type=model_type, platform=platform,
unit_testing=unit_testing)
# Build the model.
ret = sp.call(shlex.split(build_cmd))

Expand Down
2 changes: 1 addition & 1 deletion test/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
./MOM_run.csh --platform nci --type {type} --experiment {exp} {npes} {valgrind}
"""

build_cmd = " ./MOM_compile.csh --platform {platform} --type {type} --unit_testing"
build_cmd = " ./MOM_compile.csh --platform {platform} --type {type} {unit_testing}"
2 changes: 1 addition & 1 deletion test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def check_run(self, key, qsub=False):
sys.stdout.flush()

assert(r == 0)
assert('NOTE: Natural end-of-script for experiment {} with model {}.'.format(key, tests[key][0][0]) in so)
assert('NOTE: Natural end-of-script for experiment {} with model {}'.format(key, tests[key][0][0]) in so)

def test_experiments(self):
for k in tests.keys():
Expand Down
2 changes: 1 addition & 1 deletion test/test_run_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check_run_output(self, key):
with open(output_filename) as f:
s = f.read()

assert('NOTE: Natural end-of-script for experiment {} with model {}.'.format(key, experiments[key][0][0]) in s)
assert('NOTE: Natural end-of-script for experiment {} with model {}'.format(key, experiments[key][0][0]) in s)

def test_experiments(self):
for k in experiments.keys():
Expand Down
2 changes: 1 addition & 1 deletion test/test_run_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
super(TestRunSetup, self).__init__()

def check_build(self, model):
ret = self.build(model)
ret = self.build(model, unit_testing=False)
assert(ret == 0)

def check_download_data(self, experiment):
Expand Down

0 comments on commit 0812003

Please sign in to comment.