Skip to content

Commit

Permalink
Minor test cleanups and doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yadudoc committed Mar 26, 2024
1 parent f71b084 commit 97c525b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from globus_compute_endpoint.engines.globus_compute import GlobusComputeEngine
from parsl.executors.errors import BadStateException
from parsl.providers import SlurmProvider
from tests.utils import double


def test_provider_fail_at_init(tmp_path):
Expand All @@ -13,7 +14,6 @@ def test_provider_fail_at_init(tmp_path):
init_blocks = 1
"""

gce = None
with mock.patch(
"parsl.providers.SlurmProvider.status_polling_interval",
new_callable=mock.PropertyMock,
Expand All @@ -22,7 +22,7 @@ def test_provider_fail_at_init(tmp_path):
gce = GlobusComputeEngine(provider=SlurmProvider(init_blocks=1))
gce.start(endpoint_id=uuid.uuid4(), run_dir=tmp_path)

assert gce.bad_state_is_set is False
assert gce.bad_state_is_set is False, "Executor should be clean at test-start"

def double(x):
return x * 2
Expand All @@ -31,11 +31,13 @@ def double(x):

with pytest.raises(BadStateException):
future.result()

assert gce.bad_state_is_set is True, "Executor should be in failed state"
exception_str = str(future.exception())
# There are Mac/Linux variations in the exception_str
# that the following tests work around
assert "127" in exception_str
assert "sbatch"
assert "sbatch" in exception_str
assert "Could not read job ID from submit command standard output" in exception_str
assert "not found" in exception_str
gce.shutdown()
Expand All @@ -47,7 +49,6 @@ def test_provider_fail_at_scaling(tmp_path):
This is a slow test because the pollers run at 5s intervals
"""

gce = None
with mock.patch(
"parsl.providers.SlurmProvider.status_polling_interval",
new_callable=mock.PropertyMock,
Expand All @@ -58,9 +59,6 @@ def test_provider_fail_at_scaling(tmp_path):

assert gce.bad_state_is_set is False

def double(x):
return x * 2

future = gce.executor.submit(double, {}, 5)

with pytest.raises(BadStateException):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

@pytest.fixture
def gc_engine_bad_submit_command(tmp_path):
"""This config is setup to fail *SILENTLY* meaning
the block will fail with exit_code:0 so the provider
will not track it is a failure.
"""
ep_id = uuid.uuid4()
engine = GlobusComputeEngine(
address="127.0.0.1",
Expand Down

0 comments on commit 97c525b

Please sign in to comment.