From 4aec168f176939be43f5f751c90363b39ec6cf3a Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Tue, 15 Jun 2021 08:02:10 -0700 Subject: [PATCH] Fix workflow error that's been awhile. (#656) * Tweaks to help debugging locally * explicit * Workaround https://github.com/dask/distributed/issues/4565 As we only intend to use distributed with a single MPI rank configuration, the test coverage is sufficient after this workaround. * reenable osx as we have a workaround for the dask error. * renable compilers * typo. * more syntax error. * add erfa, required by astropy. * pyerfa * bound pyerfa version to 1.7.1 * use stock pyerfa as the mislinking to numpy 1.21 is fixed. * do not run every minute. * pyerfa must be there? * bump numpy to 1.20 * '1.20' --- .github/workflows/main.yaml | 27 ++++++++++++--------------- nbodykit/tests/test_distributed.py | 15 ++++++++------- requirements.txt | 1 + 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b3f47dbc..62c7232b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -5,7 +5,7 @@ name: main on: schedule: - - cron: '* * * * 5' # Runs on every Friday. + - cron: '0 0 * * 5' # Runs on every Friday. push: branches: [ '*', $default-branch ] tags: ['[0-9]*'] # anything looks like a version. @@ -25,13 +25,11 @@ jobs: strategy: fail-fast: false matrix: - # Disable os-latest as we run into a dask error for now. - # os: [ ubuntu-latest, macos-latest ] - os: [ ubuntu-latest ] - numpy-version: [ 1.18 ] + os: [ ubuntu-latest, macos-latest ] + numpy-version: [ '1.20' ] python-version: [ 3.8 ] include: - - {deploy: true, os: ubuntu-latest, numpy-version: 1.18, python-version: 3.8 } + - {deploy: true, os: ubuntu-latest, numpy-version: '1.20', python-version: 3.8 } steps: - name: Checkout source code @@ -70,16 +68,15 @@ jobs: pip install coveralls # install nbodykit itself pip install .[extras] + conda list --explicit -# - name: Install Compilers For OSX -# if: ${{ runner.os == "macOS" }} -# run: | -# conda install -q -y clang_osx-64 clangxx_osx-64 gfortran_osx-64 - -# - name: Install Compilers For Linux -# if: ${{ runner.os == "Linux" }} -# run: | -# conda install -q -y gcc_linux-64 gxx_linux-64 gfortran_linux-64 + - name: Install Compilers + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + conda install -q -y clang_osx-64 clangxx_osx-64 gfortran_osx-64 + else + conda install -q -y gcc_linux-64 gxx_linux-64 gfortran_linux-64 + fi - name: Python Unit tests run: | diff --git a/nbodykit/tests/test_distributed.py b/nbodykit/tests/test_distributed.py index ac3b66af..7d632b18 100644 --- a/nbodykit/tests/test_distributed.py +++ b/nbodykit/tests/test_distributed.py @@ -5,9 +5,13 @@ import pytest def setup(): - from distributed import LocalCluster, Client - cluster = LocalCluster(n_workers=1, threads_per_worker=1, processes=False) - use_distributed(Client(cluster)) + # only initializes the local cluster this on the root rank. + # all unit tests in this file must be protected by MPITest([1]). + from mpi4py import MPI + if MPI.COMM_WORLD.rank == 0: + from distributed import LocalCluster, Client + cluster = LocalCluster(n_workers=1, threads_per_worker=1, processes=False) + use_distributed(Client(cluster)) def teardown(): from mpi4py import MPI @@ -19,13 +23,10 @@ def test_pickle(comm): cat = UniformCatalog(1e-3, 512, comm=comm) ss = pickle.dumps(cat) cat2 = pickle.loads(ss) - + assert_array_equal(cat['Position'], cat2['Position']) -import distributed -@pytest.mark.xfail(distributed.__version__ in ['2021.03.0',], - reason="https://github.com/dask/distributed/issues/4565") @MPITest([1]) def test_save(comm): cat = UniformCatalog(1e-3, 512, comm=comm) diff --git a/requirements.txt b/requirements.txt index 73716c48..8f335644 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ numpy scipy astropy +pyerfa mpi4py six runtests