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

Minor fixes to full_wlm tests #283

Merged
merged 3 commits into from
May 9, 2023
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
2 changes: 1 addition & 1 deletion smartsim/_core/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_interface(self) -> List[str]: # pragma: no cover
@property
def test_account(self) -> str: # pragma: no cover
# no account by default
return os.environ.get("SMARTSIM_TEST_ACCOUNT", "")
return os.environ.get("SMARTSIM_TEST_ACCOUNT", None)


@lru_cache(maxsize=128, typed=False)
Expand Down
3 changes: 2 additions & 1 deletion smartsim/settings/lsfSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ def set_project(self, project):
:param time: project name
:type time: str
"""
self.project = project
if project:
self.project = project

def set_account(self, account):
"""Set the project
Expand Down
15 changes: 6 additions & 9 deletions tests/full_wlm/test_generic_batch_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ def test_batch_model(fileutils, wlmutils):

script = fileutils.get_test_conf_path("sleep.py")
batch_settings = exp.create_batch_settings(nodes=1, time="00:01:00")
if wlmutils.get_test_launcher() == "lsf":
batch_settings.set_account(wlmutils.get_test_account())

batch_settings.set_account(wlmutils.get_test_account())
if wlmutils.get_test_launcher() == "cobalt":
batch_settings.set_account(wlmutils.get_test_account())
batch_settings.set_queue("debug-flat-quad")
run_settings = wlmutils.get_run_settings("python", f"{script} --time=5")
model = exp.create_model(
Expand All @@ -74,10 +73,9 @@ def test_batch_ensemble(fileutils, wlmutils):
M2 = exp.create_model("m2", path=test_dir, run_settings=settings)

batch = exp.create_batch_settings(nodes=1, time="00:01:00")
if wlmutils.get_test_launcher() == "lsf":
batch.set_account(wlmutils.get_test_account())

batch.set_account(wlmutils.get_test_account())
if wlmutils.get_test_launcher() == "cobalt":
batch.set_account(wlmutils.get_test_account())
batch.set_queue("debug-flat-quad")
ensemble = exp.create_ensemble("batch-ens", batch_settings=batch)
ensemble.add_model(M1)
Expand All @@ -98,14 +96,13 @@ def test_batch_ensemble_replicas(fileutils, wlmutils):
settings = wlmutils.get_run_settings("python", f"{script} --time=5")

batch = exp.create_batch_settings(nodes=1, time="00:01:00")
if wlmutils.get_test_launcher() == "lsf":
batch.set_account(wlmutils.get_test_account())

batch.set_account(wlmutils.get_test_account())
if wlmutils.get_test_launcher() == "cobalt":
# As Cobalt won't allow us to run two
# jobs in the same debug queue, we need
# to make sure the previous test's one is over
sleep(30)
batch.set_account(wlmutils.get_test_account())
batch.set_queue("debug-flat-quad")
ensemble = exp.create_ensemble(
"batch-ens-replicas", batch_settings=batch, run_settings=settings, replicas=2
Expand Down
45 changes: 21 additions & 24 deletions tests/full_wlm/test_generic_orc_launch_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def test_launch_orc_auto_batch(fileutils, wlmutils):
# batch = False to launch on existing allocation
network_interface = wlmutils.get_test_interface()
orc = exp.create_database(
6780, batch=True, interface=network_interface, single_cmd=False
wlmutils.get_test_port(), batch=True, interface=network_interface, single_cmd=False
)
if wlmutils.get_test_launcher() == "lsf":
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_walltime("00:02")

orc.batch_settings.set_account(wlmutils.get_test_account())

orc.batch_settings.set_walltime("00:02:00")
if wlmutils.get_test_launcher() == "cobalt":
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_queue("debug-flat-quad")
orc.batch_settings.set_walltime("00:02:00")

orc.set_path(test_dir)

exp.start(orc, block=True)
Expand Down Expand Up @@ -83,19 +83,18 @@ def test_launch_cluster_orc_batch_single(fileutils, wlmutils):
# batch = False to launch on existing allocation
network_interface = wlmutils.get_test_interface()
orc = exp.create_database(
6780, db_nodes=3, batch=True, interface=network_interface, single_cmd=True
wlmutils.get_test_port(), db_nodes=3, batch=True, interface=network_interface, single_cmd=True
)
if wlmutils.get_test_launcher() == "lsf":
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_walltime("00:02")

orc.batch_settings.set_account(wlmutils.get_test_account())

orc.batch_settings.set_walltime("00:02:00")
if wlmutils.get_test_launcher() == "cobalt":
# As Cobalt won't allow us to run two
# jobs in the same debug queue, we need
# to make sure the previous test's one is over
time.sleep(120)
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_queue("debug-flat-quad")
orc.batch_settings.set_walltime("00:02:00")
orc.set_path(test_dir)

exp.start(orc, block=True)
Expand Down Expand Up @@ -123,19 +122,18 @@ def test_launch_cluster_orc_batch_multi(fileutils, wlmutils):
# batch = False to launch on existing allocation
network_interface = wlmutils.get_test_interface()
orc = exp.create_database(
6780, db_nodes=3, batch=True, interface=network_interface, single_cmd=False
wlmutils.get_test_port(), db_nodes=3, batch=True, interface=network_interface, single_cmd=False
)
if wlmutils.get_test_launcher() == "lsf":
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_walltime("00:03")

orc.batch_settings.set_account(wlmutils.get_test_account())

orc.batch_settings.set_walltime("00:03:00")
if wlmutils.get_test_launcher() == "cobalt":
# As Cobalt won't allow us to run two
# jobs in the same debug queue, we need
# to make sure the previous test's one is over
time.sleep(120)
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_queue("debug-flat-quad")
orc.batch_settings.set_walltime("00:03:00")
orc.set_path(test_dir)

exp.start(orc, block=True)
Expand All @@ -160,19 +158,18 @@ def test_launch_cluster_orc_reconnect(fileutils, wlmutils):

# batch = False to launch on existing allocation
network_interface = wlmutils.get_test_interface()
orc = exp.create_database(6780, db_nodes=3, batch=True, interface=network_interface)
orc = exp.create_database(wlmutils.get_test_port(), db_nodes=3, batch=True, interface=network_interface)
orc.set_path(test_dir)
if wlmutils.get_test_launcher() == "lsf":
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_walltime("00:03")

orc.batch_settings.set_account(wlmutils.get_test_account())

orc.batch_settings.set_walltime("00:03:00")
if wlmutils.get_test_launcher() == "cobalt":
# As Cobalt won't allow us to run two
# jobs in the same debug queue, we need
# to make sure the previous test's one is over
time.sleep(120)
orc.batch_settings.set_account(wlmutils.get_test_account())
orc.batch_settings.set_queue("debug-flat-quad")
orc.batch_settings.set_walltime("00:03:00")

exp.start(orc, block=True)

Expand Down
10 changes: 6 additions & 4 deletions tests/full_wlm/test_slurm_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@
pytestmark = pytest.mark.skip(reason="Test is only for Slurm WLM systems")


def test_get_release_allocation():
def test_get_release_allocation(wlmutils):
"""test slurm interface for obtaining allocations"""
alloc = slurm.get_allocation(nodes=1, time="00:05:00")
account = wlmutils.get_test_account()
alloc = slurm.get_allocation(nodes=1, time="00:05:00", account=account)
time.sleep(5) # give slurm a rest
slurm.release_allocation(alloc)


def test_get_release_allocation_w_options():
def test_get_release_allocation_w_options(wlmutils):
"""test slurm interface for obtaining allocations"""
options = {"ntasks-per-node": 1}
alloc = slurm.get_allocation(nodes=1, time="00:05:00", options=options)
account = wlmutils.get_test_account()
alloc = slurm.get_allocation(nodes=1, time="00:05:00", options=options, account=account)
time.sleep(5) # give slurm a rest
slurm.release_allocation(alloc)

Expand Down