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

Attempting to fix seemingly random failures on CI #224

Merged
merged 15 commits into from
Jan 11, 2024
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
4 changes: 2 additions & 2 deletions alchemiscale/interface/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def get_scoped_key(self, obj: GufeTokenizable, scope: Scope) -> ScopedKey:
"Scope for a ScopedKey must be specific; it cannot contain wildcards."
)

def check_exists(self, scoped_key: Scope) -> bool:
def check_exists(self, scoped_key: ScopedKey) -> bool:
"""Returns ``True`` if the given ScopedKey represents an object in the database."""
return self._get_resource("/exists/{scoped_key}")
return self._get_resource(f"/exists/{scoped_key}")

def create_network(
self,
Expand Down
6 changes: 3 additions & 3 deletions alchemiscale/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def protocoldagresults(tmpdir_factory, transformation):
return pdrs


@fixture(scope="module")
@fixture
def network_tyk2_failure(network_tyk2):
transformation = list(network_tyk2.edges)[0]

Expand All @@ -316,12 +316,12 @@ def network_tyk2_failure(network_tyk2):
)


@fixture(scope="module")
@fixture
def transformation_failure(network_tyk2_failure):
return [t for t in network_tyk2_failure.edges if t.name == "broken"][0]


@fixture(scope="module")
@fixture
def protocoldagresults_failure(tmpdir_factory, transformation_failure):
pdrs = []
for i in range(3):
Expand Down
53 changes: 40 additions & 13 deletions alchemiscale/tests/integration/interface/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,13 +1211,30 @@ def test_get_transformation_and_network_failures(

# select the transformation we want to compute
an = network_tyk2_failure
user_client.create_network(an, scope_test)
transformation = [
t for t in list(an.edges) if isinstance(t.protocol, BrokenProtocol)
][0]
network_sk = user_client.create_network(an, scope_test)

network_sk = user_client.get_scoped_key(an, scope_test)
transformation_sk = user_client.get_scoped_key(transformation, scope_test)
# seeing what appears to be random race condition in CI; adding this
# ensures full AlchemicalNetwork present before we proceed
while True:
try:
an_ = user_client.get_network(network_sk)

if an_ != an:
raise Exception("Network out doesn't exactly match network in yet")
else:
break
except:
sleep(0.1)

tf_sks = user_client.get_network_transformations(network_sk)

# select the transformation we want to compute
for tf_sk in tf_sks:
tf = user_client.get_transformation(tf_sk)
if tf.name == "broken":
transformation_sk = tf_sk
transformation = tf
break

# user client : create tasks for the transformation
tasks = user_client.create_tasks(transformation_sk, count=2)
Expand Down Expand Up @@ -1333,21 +1350,31 @@ def test_get_task_failures(

# select the transformation we want to compute
an = network_tyk2_failure
an_sk = user_client.create_network(an, scope_test)
transformation = [
t for t in list(an.edges) if isinstance(t.protocol, BrokenProtocol)
][0]
network_sk = user_client.create_network(an, scope_test)

tf_sks = user_client.get_network_transformations(an_sk)
# seeing what appears to be random race condition in CI; adding this
# ensures full AlchemicalNetwork present before we proceed
while True:
try:
an_ = user_client.get_network(network_sk)

if an_ != an:
raise Exception("Network out doesn't exactly match network in yet")
else:
break
except:
sleep(0.1)

tf_sks = user_client.get_network_transformations(network_sk)

# select the transformation we want to compute
for tf_sk in tf_sks:
tf = user_client.get_transformation(tf_sk)
if tf.name == "broken":
transformation_sk = tf_sk
transformation = tf
break

network_sk = an_sk

# user client : create tasks for the transformation
tasks = user_client.create_tasks(transformation_sk, count=2)

Expand Down
Loading