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

Flake8 fixes from previous PRs #143

Merged
merged 2 commits into from
Sep 3, 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
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
push:
pull_request:
schedule:
- cron: '0 12 * * 1'

Expand Down
4 changes: 1 addition & 3 deletions colmena/proxy.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
11 changes: 8 additions & 3 deletions colmena/task_server/tests/test_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading