diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b26f936..46357f4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,6 +2,7 @@ name: CI on: push: + pull_request: schedule: - cron: '0 12 * * 1' diff --git a/colmena/proxy.py b/colmena/proxy.py index ea9266a..b57085a 100644 --- a/colmena/proxy.py +++ b/colmena/proxy.py @@ -1,7 +1,7 @@ """Utilities for interacting with ProxyStore""" import logging import warnings -from typing import Dict +from typing import Any, Dict, Union, List, Optional import proxystore from proxystore.proxy import extract @@ -10,8 +10,6 @@ from proxystore.store.base import Store from proxystore.store.utils import resolve_async, get_key -from typing import Any, Dict, Union, List, Optional - proxystore_version = tuple(int(v) for v in proxystore.__version__.split('.')) if proxystore_version >= (0, 7, 0): # In ProxyStore v0.7 and later, the Store config is a pydantic model. diff --git a/colmena/task_server/tests/test_retry.py b/colmena/task_server/tests/test_retry.py index 2f7ed91..8e49504 100644 --- a/colmena/task_server/tests/test_retry.py +++ b/colmena/task_server/tests/test_retry.py @@ -10,6 +10,7 @@ # Make global state for the retry task RETRY_COUNT = 0 + def retry_task(success_idx: int) -> bool: """Task that will succeed (return True) every `success_idx` times.""" global RETRY_COUNT @@ -18,17 +19,19 @@ def retry_task(success_idx: int) -> bool: if RETRY_COUNT < success_idx: RETRY_COUNT += 1 raise ValueError('Retry') - + # Reset the retry count RETRY_COUNT = 0 return True + @fixture def reset_retry_count(): """Reset the retry count before each test.""" global RETRY_COUNT RETRY_COUNT = 0 + @fixture() def config(tmpdir): """Make the Parsl configuration.""" @@ -40,8 +43,9 @@ def config(tmpdir): run_dir=str(tmpdir / 'run'), ) + @fixture -def server_and_queue(config) -> Generator[Tuple[ParslTaskServer, ColmenaQueues], None, None]: +def server_and_queue(config) -> Generator[Tuple[ParslTaskServer, ColmenaQueues], None, None]: queues = PipeQueues() server = ParslTaskServer([retry_task], queues, config) yield server, queues @@ -73,11 +77,12 @@ def test_retry_policy_max_retries_zero(server_and_queue, reset_retry_count): assert not result.success assert 'Retry' in str(result.failure_info.exception) + @mark.timeout(10) @mark.parametrize(('success_idx', 'max_retries'), [(0, 0), (1, 1), (4, 10)]) def test_retry_policy_max_retries(server_and_queue, reset_retry_count, success_idx: int, max_retries: int): """Test the retry policy. - + This test checks the following cases: - A task that always succeeds (success_idx=0, max_retries=0) - A task that succeeds after one retry (success_idx=1, max_retries=1)