Skip to content

Commit

Permalink
python scrip for running tests locally
Browse files Browse the repository at this point in the history
  • Loading branch information
jmills-ncar committed Jul 27, 2018
1 parent dc6c985 commit b1cfad9
Show file tree
Hide file tree
Showing 21 changed files with 662 additions and 1,335 deletions.
44 changes: 30 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def pytest_addoption(parser):
"--config",
required=True,
action='store',
help=("List of model configurations to test, options are 'NWM'," +
"'Gridded',and 'Reach'")
help=("List of model configurations to test, options include all configs listed in "
"hydro_namelist.json keys")
)

parser.addoption(
Expand All @@ -67,6 +67,13 @@ def pytest_addoption(parser):
help='Scheduler to use for testing, options are PBSCheyenne or do not specify for no '
'scheduler')

parser.addoption(
'--nnodes',
default='2',
required=False,
action='store',
help='Number of nodes to use for testing if running on scheduler'
)
parser.addoption(
'--account',
default='NRAL0017',
Expand All @@ -75,9 +82,10 @@ def pytest_addoption(parser):
help='Account number to use if using a scheduler.')

def _make_sim(domain_dir,
source_dir,
source_dir,
configuration,
ncores,
nnodes,
scheduler,
account):
# model
Expand All @@ -102,7 +110,11 @@ def _make_sim(domain_dir,
sim.add(job)

if scheduler is not None and scheduler == 'pbscheyenne':
sim.add(schedulers.PBSCheyenne(account=account,nproc=int(ncores)))
sim.add(schedulers.PBSCheyenne(account=account,nproc=int(ncores),nnodes = int(nnodes)))

if configuration == 'nwm_channel-only':
# Update the forcing here to be taken from the nwm_ana run dir
sim.domain

return sim

Expand All @@ -113,15 +125,17 @@ def candidate_sim(request):
candidate_dir = request.config.getoption("--candidate_dir")
configuration = request.config.getoption("--config")
ncores = request.config.getoption("--ncores")
nnodes = request.config.getoption("--nnodes")
scheduler = str(request.config.getoption("--scheduler")).lower()
account = request.config.getoption("--account")

candidate_sim = _make_sim(domain_dir = domain_dir,
source_dir= candidate_dir,
configuration=configuration,
ncores = ncores,
scheduler = scheduler,
account = account)
source_dir= candidate_dir,
configuration=configuration,
ncores = ncores,
nnodes = nnodes,
scheduler = scheduler,
account = account)

return candidate_sim

Expand All @@ -132,15 +146,17 @@ def reference_sim(request):
reference_dir = request.config.getoption("--reference_dir")
configuration = request.config.getoption("--config")
ncores = request.config.getoption("--ncores")
nnodes = request.config.getoption("--nnodes")
scheduler = str(request.config.getoption("--scheduler")).lower()
account = request.config.getoption("--account")

reference_sim = _make_sim(domain_dir = domain_dir,
source_dir= reference_dir,
configuration=configuration,
ncores = ncores,
scheduler = scheduler,
account = account)
source_dir= reference_dir,
configuration=configuration,
ncores = ncores,
nnodes = nnodes,
scheduler = scheduler,
account = account)

return reference_sim

Expand Down
Loading

0 comments on commit b1cfad9

Please sign in to comment.