From a1a3145fa2c3ca33e587b5729ae40cbf1063b1b4 Mon Sep 17 00:00:00 2001 From: Logan Ward Date: Mon, 31 Jul 2023 15:39:37 -0400 Subject: [PATCH] Test OSX Support (#110) * Test on MacOS First step is to see if it runs * Only start redis on Linux Not supported on OSX * Fix if statement Two problems: 1) they call ubuntu-latest "Linux" and 2) we don't need the expression part * Update the if again Following the example from here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-contexts * Skip Redis tests on OSX * Do not need the module-level scope * Test for connection to redis, not CLI Redis can still be accessible not on the Path * Test using Python 3.8 * Update Python requirements * Write Parsl logs and proxies to different directories --- .github/workflows/CI.yml | 11 +++++++---- colmena/queue/tests/test_queues.py | 16 +++++++++++++++- colmena/task_server/tests/test_parsl.py | 12 ++++++------ pyproject.toml | 2 +- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ac43c1a..68982c4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,21 +4,24 @@ on: [push] jobs: build-linux: - runs-on: ubuntu-latest strategy: - max-parallel: 5 - + matrix: + os: [ubuntu-latest, macos-latest] + max-parallel: 5 + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 with: - python-version: 3.7 # Start with the earliest version + python-version: 3.8 # Start with the earliest version - name: Install dependencies run: | pip install -U pip setuptools pip install -e.[globus,test] - name: Start Redis + if: ${{ runner.os == 'Linux' }} uses: supercharge/redis-github-action@1.4.0 - name: Lint with flake8 run: | diff --git a/colmena/queue/tests/test_queues.py b/colmena/queue/tests/test_queues.py index 8e6413f..1fccba6 100644 --- a/colmena/queue/tests/test_queues.py +++ b/colmena/queue/tests/test_queues.py @@ -2,14 +2,28 @@ from multiprocessing import Pool from pytest import fixture, raises, mark +from redis import Redis, ConnectionError from colmena.exceptions import TimeoutException, KillSignalException from colmena.queue.base import ColmenaQueues from colmena.queue.python import PipeQueues from colmena.queue.redis import RedisQueues +# Determine which classes to test -@fixture(params=[PipeQueues, RedisQueues]) +has_redis = True +try: + client = Redis() + client.ping() +except ConnectionError: + has_redis = False + +to_test = [PipeQueues] +if has_redis: + to_test.append(RedisQueues) + + +@fixture(params=to_test) def queue(request) -> ColmenaQueues: return request.param(['a', 'b']) diff --git a/colmena/task_server/tests/test_parsl.py b/colmena/task_server/tests/test_parsl.py index ab24c3f..c128335 100644 --- a/colmena/task_server/tests/test_parsl.py +++ b/colmena/task_server/tests/test_parsl.py @@ -3,9 +3,9 @@ from parsl import HighThroughputExecutor from parsl.config import Config +from proxystore.connectors.file import FileConnector from pytest import fixture, mark -from proxystore.connectors.redis import RedisConnector from proxystore.store import Store from proxystore.store import register_store from proxystore.store import unregister_store @@ -39,17 +39,17 @@ def count_nodes(x, _resources: ResourceRequirements): def config(tmpdir): return Config( executors=[ - HighThroughputExecutor(max_workers=1, address='localhost') + HighThroughputExecutor(max_workers=1) ], strategy=None, - run_dir=str(tmpdir), + run_dir=str(tmpdir / 'run'), ) # Make a proxy store for larger objects -@fixture(scope='module') -def store(): - connector = RedisConnector(hostname='localhost', port=6379) +@fixture() +def store(tmpdir): + connector = FileConnector(store_dir=str(tmpdir / 'proxy-store')) with Store('store', connector=connector, metrics=True) as store: register_store(store) yield store diff --git a/pyproject.toml b/pyproject.toml index 191b72d..21f7d14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [ ] description = 'colmena: Intelligent Steerable Pipelines on HPC' readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.8" license = { file = "LICENSE.txt" } keywords = ["HPC", "AI", "Workflows"] classifiers = [