From e456c55ea9530dad25ec71eec943b16d19ed508c Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 16:56:09 -0400 Subject: [PATCH 01/61] add ci tests --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ tests/test_singularity_containers.py | 16 ++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 tests/test_singularity_containers.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..770685e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Full spikeinterface tests + +on: + pull_request: + branches: [master] + types: [synchronize, opened, reopened, ready_for_review] + +jobs: + build-and-test: + name: Test on (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # "macos-latest", "windows-latest" + os: ["ubuntu-latest", ] + steps: + - uses: actions/checkout@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + pip install spikeinterface + pip install spython + conda install -c conda-forge singularity + - name: Test singularity + run: | + pytest \ No newline at end of file diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py new file mode 100644 index 0000000..720b593 --- /dev/null +++ b/tests/test_singularity_containers.py @@ -0,0 +1,16 @@ +import spikeinterface.full as si +import spikeinterface.sorters as ss + +recording = si.toy_example(num_segments=1, num_channels=32, duration=120)[0] +recording2 = recording.save("test_recording") +# recording2 = si.load_extractor("test_recording11") + + +def test_spyking_circus(): + + ss.run_spykingcircus( + recording2, + output_folder="spyking_circus", + singularity_image="spikeinterface/spyking-circus-base:1.1.0", + verbose=True + ) \ No newline at end of file From ff7eaa7832f1ee625f68c499e0c1bcb17ce057ee Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Tue, 7 Jun 2022 16:59:49 -0400 Subject: [PATCH 02/61] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 770685e..b6dc8a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Full spikeinterface tests on: pull_request: - branches: [master] + branches: [main] types: [synchronize, opened, reopened, ready_for_review] jobs: @@ -25,4 +25,4 @@ jobs: conda install -c conda-forge singularity - name: Test singularity run: | - pytest \ No newline at end of file + pytest From cbb7e0628f1a9bdb9dde63e9038b13d2b08a0cfa Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Tue, 7 Jun 2022 17:02:01 -0400 Subject: [PATCH 03/61] Update test.yml --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6dc8a3..6adac6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: pip install spikeinterface pip install spython conda install -c conda-forge singularity + pip install pytest - name: Test singularity run: | pytest From 2ced1672a8b472bbfcd55029775c9fc6924c2d01 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:05:15 -0400 Subject: [PATCH 04/61] change import --- tests/test_singularity_containers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 720b593..cd7fcbb 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -1,7 +1,7 @@ -import spikeinterface.full as si +from spikeinterface.extractors import toy_example import spikeinterface.sorters as ss -recording = si.toy_example(num_segments=1, num_channels=32, duration=120)[0] +recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] recording2 = recording.save("test_recording") # recording2 = si.load_extractor("test_recording11") From 4b86595f7a416edd7f198f1c26f38754c94fdbfe Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:06:49 -0400 Subject: [PATCH 05/61] add pandas --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6adac6d..7a569e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: pip install spython conda install -c conda-forge singularity pip install pytest + pip install pandas - name: Test singularity run: | pytest From 87382603e1361064e711e9268413590cd7f60a91 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:08:21 -0400 Subject: [PATCH 06/61] add scipy --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a569e0..ecba60b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,7 @@ jobs: conda install -c conda-forge singularity pip install pytest pip install pandas + pip install scipy - name: Test singularity run: | pytest From cfaf3d502da817491666c513aaf53600527c73ca Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:10:03 -0400 Subject: [PATCH 07/61] add scikit-learn --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ecba60b..7e27361 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,9 +23,7 @@ jobs: pip install spikeinterface pip install spython conda install -c conda-forge singularity - pip install pytest - pip install pandas - pip install scipy + pip install pytest pandas scipy scikit-learn - name: Test singularity run: | pytest From 7cffbc9c422b75b01485635a400844d9da2bc06c Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:14:29 -0400 Subject: [PATCH 08/61] fix save --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index cd7fcbb..6b88398 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -2,7 +2,7 @@ import spikeinterface.sorters as ss recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] -recording2 = recording.save("test_recording") +recording2 = recording.save(folder="test_recording") # recording2 = si.load_extractor("test_recording11") From 1acfb8dfbf0a693fb7bc8927d0a231662b724442 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:18:02 -0400 Subject: [PATCH 09/61] install singularity --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e27361..75dd4bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,11 +18,13 @@ jobs: - uses: actions/checkout@v2 with: python-version: 3.8 + - uses: eWaterCycle/setup-singularity@v7 + with: + singularity-version: 3.8.3 - name: Install dependencies run: | pip install spikeinterface pip install spython - conda install -c conda-forge singularity pip install pytest pandas scipy scikit-learn - name: Test singularity run: | From 66707879ddfe1e0f5e8937c36ebc0d3f72b48ba0 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:28:48 -0400 Subject: [PATCH 10/61] pytest verbose --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75dd4bb..b9429ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,4 +28,4 @@ jobs: pip install pytest pandas scipy scikit-learn - name: Test singularity run: | - pytest + pytest -v From 92ca475e57b6ecd467b8614a6630129c91eb7f46 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:32:00 -0400 Subject: [PATCH 11/61] take away pandas --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9429ff..a8c67b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: run: | pip install spikeinterface pip install spython - pip install pytest pandas scipy scikit-learn + pip install pytest h5py # pandas scipy scikit-learn - name: Test singularity run: | pytest -v From 5dfd7ecbf70647774148ecbe9a50e479f13e5380 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:39:34 -0400 Subject: [PATCH 12/61] use generate_recording --- tests/test_singularity_containers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 6b88398..b2b07be 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -1,7 +1,15 @@ -from spikeinterface.extractors import toy_example +#from spikeinterface.extractors import toy_example import spikeinterface.sorters as ss +from spikeinterface.core.testing_tools import generate_recording -recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] +recording = generate_recording( + num_channels=32, + sampling_frequency=30000., # in Hz + durations=[120], #  in s for 2 segments + set_probe=True, + ndim=2, +) +#recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] recording2 = recording.save(folder="test_recording") # recording2 = si.load_extractor("test_recording11") From 07f315ddfa3b11688b0f8faafcb86d3e4d0f3892 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 17:41:39 -0400 Subject: [PATCH 13/61] use spikeinterface full --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8c67b9..2429bc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,9 +23,7 @@ jobs: singularity-version: 3.8.3 - name: Install dependencies run: | - pip install spikeinterface - pip install spython - pip install pytest h5py # pandas scipy scikit-learn + pip install spikeinterface[full] spython pytest - name: Test singularity run: | pytest -v From 255901eeedcfc7906df944d4fbb27d827a61a271 Mon Sep 17 00:00:00 2001 From: bendichter Date: Tue, 7 Jun 2022 18:01:52 -0400 Subject: [PATCH 14/61] add trideclous --- .github/workflows/test.yml | 2 +- tests/test_singularity_containers.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2429bc2..d4f1f75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: singularity-version: 3.8.3 - name: Install dependencies run: | - pip install spikeinterface[full] spython pytest + pip install spikeinterface[full] spython pytest tridesclous - name: Test singularity run: | pytest -v diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index b2b07be..13c194a 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -21,4 +21,13 @@ def test_spyking_circus(): output_folder="spyking_circus", singularity_image="spikeinterface/spyking-circus-base:1.1.0", verbose=True + ) + +def test_tridecluos(): + + ss.run_tridesclous( + recording2, + output_folder="tridesclous", + singularity_image="spikeinterface/tridesclous-base:1.6.5", + verbose=True ) \ No newline at end of file From 284c76cf85c510bb3efaf9a0f94794eacac5e319 Mon Sep 17 00:00:00 2001 From: bendichter Date: Wed, 8 Jun 2022 10:55:42 -0400 Subject: [PATCH 15/61] add ironclust --- tests/test_singularity_containers.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 13c194a..b2d1219 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -1,11 +1,10 @@ -#from spikeinterface.extractors import toy_example import spikeinterface.sorters as ss from spikeinterface.core.testing_tools import generate_recording recording = generate_recording( num_channels=32, sampling_frequency=30000., # in Hz - durations=[120], #  in s for 2 segments + durations=[120], set_probe=True, ndim=2, ) @@ -23,6 +22,7 @@ def test_spyking_circus(): verbose=True ) + def test_tridecluos(): ss.run_tridesclous( @@ -30,4 +30,14 @@ def test_tridecluos(): output_folder="tridesclous", singularity_image="spikeinterface/tridesclous-base:1.6.5", verbose=True + ) + + +def test_ironclust(): + + ss.run_tridesclous( + recording2, + output_folder="ironclust", + singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", + verbose=True ) \ No newline at end of file From b4ce94acb1159c3d6b33d639bf8ce61ca2bc3081 Mon Sep 17 00:00:00 2001 From: bendichter Date: Wed, 8 Jun 2022 10:57:08 -0400 Subject: [PATCH 16/61] fix runner --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index b2d1219..1120ec0 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -35,7 +35,7 @@ def test_tridecluos(): def test_ironclust(): - ss.run_tridesclous( + ss.run_ironclust( recording2, output_folder="ironclust", singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", From 66e08e9e65f1947652cbbd352c856835721b4406 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Mon, 13 Jun 2022 21:27:25 -0400 Subject: [PATCH 17/61] Update .github/workflows/test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4f1f75..9754dcf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,4 +26,4 @@ jobs: pip install spikeinterface[full] spython pytest tridesclous - name: Test singularity run: | - pytest -v + pytest -v tests/test_singularity_containers.py From 5ab7dc90cca3cfa1427cc4eb71a79e25898f5d99 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 15 Jun 2022 16:50:54 -0700 Subject: [PATCH 18/61] Add all tests --- .github/workflows/test.yml | 12 +++- tests/test_singularity_containers.py | 99 ++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9754dcf..4cc9f92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,17 @@ jobs: singularity-version: 3.8.3 - name: Install dependencies run: | - pip install spikeinterface[full] spython pytest tridesclous + sudo apt update + sudo apt install git + + # get SI form master + git clone https://github.com/SpikeInterface/spikeinterface.git + cd spikeinterface + pip install . + pip install -r requirements_full.txt + + cd .. + pip install spython pytest - name: Test singularity run: | pytest -v tests/test_singularity_containers.py diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 1120ec0..47fa84f 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -1,3 +1,5 @@ +import pytest + import spikeinterface.sorters as ss from spikeinterface.core.testing_tools import generate_recording @@ -8,11 +10,10 @@ set_probe=True, ndim=2, ) -#recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] -recording2 = recording.save(folder="test_recording") -# recording2 = si.load_extractor("test_recording11") +recording2 = recording.save(folder="test_recording") +# python-based def test_spyking_circus(): ss.run_spykingcircus( @@ -23,7 +24,7 @@ def test_spyking_circus(): ) -def test_tridecluos(): +def test_tridescluos(): ss.run_tridesclous( recording2, @@ -32,7 +33,25 @@ def test_tridecluos(): verbose=True ) +def test_klusta(): + + ss.run_klusta( + recording2, + output_folder="klusta", + singularity_image="spikeinterface/klusta-base:0.2.7", + verbose=True + ) + +def test_mountainsort4(): + + ss.run_mountainsort4( + recording2, + output_folder="mountainsort4", + singularity_image="spikeinterface/mountainsort4-base:1.0.0", + verbose=True + ) +# matlab-based def test_ironclust(): ss.run_ironclust( @@ -40,4 +59,76 @@ def test_ironclust(): output_folder="ironclust", singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", verbose=True + ) + + +def test_waveclus(): + + ss.run_waveclus( + recording2, + output_folder="waveclus", + singularity_image="spikeinterface/waveclus-compiled-base:0.1.0", + verbose=True + ) + + +def test_hdsort(): + + ss.run_hdsort( + recording2, + output_folder="hdsort", + singularity_image="spikeinterface/hdsort-compiled-base:0.1.0", + verbose=True + ) + + +def test_kilosort1(): + + ss.run_kilosort( + recording2, + output_folder="kilosort", + singularity_image="spikeinterface/kilosort-compiled-base:0.1.0", + verbose=True + ) + + +# gpu-required +pytest.mark.skip(reason="GPU required") +def test_kilosort2(): + + ss.run_kilosort2( + recording2, + output_folder="kilosort2", + singularity_image="spikeinterface/kilosort2-compiled-base:0.1.0", + verbose=True + ) + +pytest.mark.skip(reason="GPU required") +def test_kilosort1(): + + ss.run_kilosort2_5( + recording2, + output_folder="kilosort2_5", + singularity_image="spikeinterface/kilosort2_5-compiled-base:0.1.0", + verbose=True + ) + +pytest.mark.skip(reason="GPU required") +def test_kilosort3(): + + ss.run_kilosort3( + recording2, + output_folder="kilosort3", + singularity_image="spikeinterface/kilosort3-compiled-base:0.1.0", + verbose=True + ) + +pytest.mark.skip(reason="GPU required") +def test_pykilosort(): + + ss.run_pykilosort( + recording2, + output_folder="pykilosort", + singularity_image="spikeinterface/pykilosort-base:0.1.0", + verbose=True ) \ No newline at end of file From 28df6a58ab34777f672e2d781b1f391de4a14af8 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 15 Jun 2022 17:52:05 -0700 Subject: [PATCH 19/61] Some fixes --- ...{test.yml => test_containers_singularity.yml} | 4 ++-- tests/test_singularity_containers.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) rename .github/workflows/{test.yml => test_containers_singularity.yml} (91%) diff --git a/.github/workflows/test.yml b/.github/workflows/test_containers_singularity.yml similarity index 91% rename from .github/workflows/test.yml rename to .github/workflows/test_containers_singularity.yml index 4cc9f92..2163d80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -1,4 +1,4 @@ -name: Full spikeinterface tests +name: Test sorter images in singularity on: pull_request: @@ -33,7 +33,7 @@ jobs: pip install -r requirements_full.txt cd .. - pip install spython pytest + pip install spython pytest tridesclous - name: Test singularity run: | pytest -v tests/test_singularity_containers.py diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 47fa84f..4466c3b 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -14,6 +14,7 @@ recording2 = recording.save(folder="test_recording") # python-based +@pytest.mark.skip(reason="FAILING: investigate why") def test_spyking_circus(): ss.run_spykingcircus( @@ -41,7 +42,8 @@ def test_klusta(): singularity_image="spikeinterface/klusta-base:0.2.7", verbose=True ) - + +@pytest.mark.skip(reason="FAILING: investigate why") def test_mountainsort4(): ss.run_mountainsort4( @@ -58,6 +60,7 @@ def test_ironclust(): recording2, output_folder="ironclust", singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", + fGpu=False, verbose=True ) @@ -88,12 +91,13 @@ def test_kilosort1(): recording2, output_folder="kilosort", singularity_image="spikeinterface/kilosort-compiled-base:0.1.0", + useGPU=False, verbose=True ) # gpu-required -pytest.mark.skip(reason="GPU required") +@pytest.mark.skip(reason="GPU required") def test_kilosort2(): ss.run_kilosort2( @@ -103,8 +107,8 @@ def test_kilosort2(): verbose=True ) -pytest.mark.skip(reason="GPU required") -def test_kilosort1(): +@pytest.mark.skip(reason="GPU required") +def test_kilosort2_5(): ss.run_kilosort2_5( recording2, @@ -113,7 +117,7 @@ def test_kilosort1(): verbose=True ) -pytest.mark.skip(reason="GPU required") +@pytest.mark.skip(reason="GPU required") def test_kilosort3(): ss.run_kilosort3( @@ -123,7 +127,7 @@ def test_kilosort3(): verbose=True ) -pytest.mark.skip(reason="GPU required") +@pytest.mark.skip(reason="GPU required") def test_pykilosort(): ss.run_pykilosort( From 668e603665b3b1c190e1aac0c2c6484e50c9151f Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Wed, 15 Jun 2022 21:48:07 -0400 Subject: [PATCH 20/61] Update tests/test_singularity_containers.py --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 4466c3b..acf2dc6 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -14,7 +14,7 @@ recording2 = recording.save(folder="test_recording") # python-based -@pytest.mark.skip(reason="FAILING: investigate why") +@pytest.mark.xfail # FAILING: investigate why def test_spyking_circus(): ss.run_spykingcircus( From b17da9424c7a2c3a5b38a6300e7e4317132c1d23 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Wed, 15 Jun 2022 21:48:11 -0400 Subject: [PATCH 21/61] Update tests/test_singularity_containers.py --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index acf2dc6..23ae827 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -43,7 +43,7 @@ def test_klusta(): verbose=True ) -@pytest.mark.skip(reason="FAILING: investigate why") +@pytest.mark.xfail # FAILING: investigate why def test_mountainsort4(): ss.run_mountainsort4( From 42160040bc12fb0f96fc848e1190dc5efe8750c0 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Wed, 15 Jun 2022 21:52:26 -0400 Subject: [PATCH 22/61] Update tests/test_singularity_containers.py --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 23ae827..307d869 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -43,7 +43,7 @@ def test_klusta(): verbose=True ) -@pytest.mark.xfail # FAILING: investigate why +@pytest.mark.xfail(reason="FAILING: investigate why") def test_mountainsort4(): ss.run_mountainsort4( From 08631d97a61173a329e70e4f09d222dfdd2694fe Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Wed, 15 Jun 2022 21:52:47 -0400 Subject: [PATCH 23/61] Update tests/test_singularity_containers.py --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 307d869..be28192 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -14,7 +14,7 @@ recording2 = recording.save(folder="test_recording") # python-based -@pytest.mark.xfail # FAILING: investigate why +@pytest.mark.xfail(reason="FAILING: investigate why") def test_spyking_circus(): ss.run_spykingcircus( From 6210000233eda629fb20b3eaae39a75e10bd8696 Mon Sep 17 00:00:00 2001 From: bendichter Date: Wed, 15 Jun 2022 22:01:50 -0400 Subject: [PATCH 24/61] apply black formatting --- tests/test_singularity_containers.py | 78 ++++++++++------------------ 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index be28192..6515f49 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -5,7 +5,7 @@ recording = generate_recording( num_channels=32, - sampling_frequency=30000., # in Hz + sampling_frequency=30000.0, # in Hz durations=[120], set_probe=True, ndim=2, @@ -18,121 +18,97 @@ def test_spyking_circus(): ss.run_spykingcircus( - recording2, - output_folder="spyking_circus", - singularity_image="spikeinterface/spyking-circus-base:1.1.0", - verbose=True + recording2, output_folder="spyking_circus", singularity_image=True, verbose=True ) def test_tridescluos(): ss.run_tridesclous( - recording2, - output_folder="tridesclous", - singularity_image="spikeinterface/tridesclous-base:1.6.5", - verbose=True + recording2, output_folder="tridesclous", singularity_image=True, verbose=True ) + def test_klusta(): ss.run_klusta( - recording2, - output_folder="klusta", - singularity_image="spikeinterface/klusta-base:0.2.7", - verbose=True + recording2, output_folder="klusta", singularity_image=True, verbose=True ) + @pytest.mark.xfail(reason="FAILING: investigate why") def test_mountainsort4(): ss.run_mountainsort4( - recording2, - output_folder="mountainsort4", - singularity_image="spikeinterface/mountainsort4-base:1.0.0", - verbose=True + recording2, output_folder="mountainsort4", singularity_image=True, verbose=True ) + # matlab-based def test_ironclust(): ss.run_ironclust( recording2, output_folder="ironclust", - singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", + singularity_image=True, fGpu=False, - verbose=True + verbose=True, ) - + def test_waveclus(): ss.run_waveclus( - recording2, - output_folder="waveclus", - singularity_image="spikeinterface/waveclus-compiled-base:0.1.0", - verbose=True + recording2, output_folder="waveclus", singularity_image=True, verbose=True ) def test_hdsort(): ss.run_hdsort( - recording2, - output_folder="hdsort", - singularity_image="spikeinterface/hdsort-compiled-base:0.1.0", - verbose=True + recording2, output_folder="hdsort", singularity_image=True, verbose=True ) - - + + def test_kilosort1(): ss.run_kilosort( recording2, output_folder="kilosort", - singularity_image="spikeinterface/kilosort-compiled-base:0.1.0", + singularity_image=True, useGPU=False, - verbose=True + verbose=True, ) - + # gpu-required @pytest.mark.skip(reason="GPU required") def test_kilosort2(): ss.run_kilosort2( - recording2, - output_folder="kilosort2", - singularity_image="spikeinterface/kilosort2-compiled-base:0.1.0", - verbose=True + recording2, output_folder="kilosort2", singularity_image=True, verbose=True ) + @pytest.mark.skip(reason="GPU required") def test_kilosort2_5(): ss.run_kilosort2_5( - recording2, - output_folder="kilosort2_5", - singularity_image="spikeinterface/kilosort2_5-compiled-base:0.1.0", - verbose=True + recording2, output_folder="kilosort2_5", singularity_image=True, verbose=True ) + @pytest.mark.skip(reason="GPU required") def test_kilosort3(): ss.run_kilosort3( - recording2, - output_folder="kilosort3", - singularity_image="spikeinterface/kilosort3-compiled-base:0.1.0", - verbose=True + recording2, output_folder="kilosort3", singularity_image=True, verbose=True ) -@pytest.mark.skip(reason="GPU required") + +@pytest.mark.skip(reason="GPU required") def test_pykilosort(): ss.run_pykilosort( - recording2, - output_folder="pykilosort", - singularity_image="spikeinterface/pykilosort-base:0.1.0", - verbose=True - ) \ No newline at end of file + recording2, output_folder="pykilosort", singularity_image=True, verbose=True + ) From f241e18c80860686a5dd0386d4d21925e155041a Mon Sep 17 00:00:00 2001 From: bendichter Date: Wed, 15 Jun 2022 23:03:16 -0400 Subject: [PATCH 25/61] refactor tests --- tests/test_singularity_containers.py | 80 +++++++--------------------- 1 file changed, 18 insertions(+), 62 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 6515f49..059188e 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -13,102 +13,58 @@ recording2 = recording.save(folder="test_recording") -# python-based +kwargs = dict(recordin=recording2, verbose=True, singularity_image=True) + + @pytest.mark.xfail(reason="FAILING: investigate why") def test_spyking_circus(): + ss.run_spykingcircus(output_folder="spyking_circus", **kwargs) - ss.run_spykingcircus( - recording2, output_folder="spyking_circus", singularity_image=True, verbose=True - ) +@pytest.mark.xfail(reason="FAILING: investigate why") +def test_mountainsort4(): + ss.run_mountainsort4(output_folder="mountainsort4", **kwargs) -def test_tridescluos(): - ss.run_tridesclous( - recording2, output_folder="tridesclous", singularity_image=True, verbose=True - ) +def test_tridesclous(): + ss.run_tridesclous(output_folder="tridesclous", **kwargs) def test_klusta(): + ss.run_klusta(output_folder="klusta", **kwargs) - ss.run_klusta( - recording2, output_folder="klusta", singularity_image=True, verbose=True - ) - - -@pytest.mark.xfail(reason="FAILING: investigate why") -def test_mountainsort4(): - - ss.run_mountainsort4( - recording2, output_folder="mountainsort4", singularity_image=True, verbose=True - ) - -# matlab-based def test_ironclust(): - - ss.run_ironclust( - recording2, - output_folder="ironclust", - singularity_image=True, - fGpu=False, - verbose=True, - ) + ss.run_ironclust(output_folder="ironclust", fGpu=False, **kwargs) def test_waveclus(): - - ss.run_waveclus( - recording2, output_folder="waveclus", singularity_image=True, verbose=True - ) + ss.run_waveclus(output_folder="waveclus", **kwargs) def test_hdsort(): - - ss.run_hdsort( - recording2, output_folder="hdsort", singularity_image=True, verbose=True - ) + ss.run_hdsort(output_folder="hdsort", **kwargs) def test_kilosort1(): - - ss.run_kilosort( - recording2, - output_folder="kilosort", - singularity_image=True, - useGPU=False, - verbose=True, - ) + ss.run_kilosort(output_folder="kilosort", useGPU=False, **kwargs) -# gpu-required @pytest.mark.skip(reason="GPU required") def test_kilosort2(): - - ss.run_kilosort2( - recording2, output_folder="kilosort2", singularity_image=True, verbose=True - ) + ss.run_kilosort2(output_folder="kilosort2", **kwargs) @pytest.mark.skip(reason="GPU required") def test_kilosort2_5(): - - ss.run_kilosort2_5( - recording2, output_folder="kilosort2_5", singularity_image=True, verbose=True - ) + ss.run_kilosort2_5(output_folder="kilosort2_5", **kwargs) @pytest.mark.skip(reason="GPU required") def test_kilosort3(): - - ss.run_kilosort3( - recording2, output_folder="kilosort3", singularity_image=True, verbose=True - ) + ss.run_kilosort3(output_folder="kilosort3", **kwargs) @pytest.mark.skip(reason="GPU required") def test_pykilosort(): - - ss.run_pykilosort( - recording2, output_folder="pykilosort", singularity_image=True, verbose=True - ) + ss.run_pykilosort(output_folder="pykilosort", **kwargs) From a87692137b92bd45adeaf50e2710161dba15b20c Mon Sep 17 00:00:00 2001 From: bendichter Date: Wed, 15 Jun 2022 23:07:08 -0400 Subject: [PATCH 26/61] fix recording arg --- tests/test_singularity_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 059188e..3642f71 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -13,7 +13,7 @@ recording2 = recording.save(folder="test_recording") -kwargs = dict(recordin=recording2, verbose=True, singularity_image=True) +kwargs = dict(recording=recording2, verbose=True, singularity_image=True) @pytest.mark.xfail(reason="FAILING: investigate why") From b17afae6322663f9258cdba9d3f0de2c6d9e3661 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Thu, 16 Jun 2022 09:39:49 -0300 Subject: [PATCH 27/61] Added work_dir and recording fixtures --- tests/test_singularity_containers.py | 51 ++++++++++++++++++---------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 1120ec0..f8c1203 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -1,43 +1,60 @@ +import os +import shutil + +import pytest + import spikeinterface.sorters as ss from spikeinterface.core.testing_tools import generate_recording -recording = generate_recording( - num_channels=32, - sampling_frequency=30000., # in Hz - durations=[120], - set_probe=True, - ndim=2, -) -#recording = toy_example(num_segments=1, num_channels=32, duration=120)[0] -recording2 = recording.save(folder="test_recording") -# recording2 = si.load_extractor("test_recording11") +@pytest.fixture +def work_dir(request, tmpdir_factory): + tmpdir = tmpdir_factory.mktemp('work_dir') + os.chdir(tmpdir) + yield + os.chdir(request.config.invocation_dir) + shutil.rmtree(str(tmpdir)) + + +@pytest.fixture +def recording(work_dir): + + test_recording = generate_recording( + num_channels=32, + sampling_frequency=30000.0, # in Hz + durations=[120], + set_probe=True, + ndim=2, + ) + test_recording = test_recording.save(folder="test_recording") + return test_recording -def test_spyking_circus(): + +def test_spyking_circus(recording, work_dir): ss.run_spykingcircus( - recording2, + recording, output_folder="spyking_circus", singularity_image="spikeinterface/spyking-circus-base:1.1.0", verbose=True ) -def test_tridecluos(): +def test_tridecluos(recording): ss.run_tridesclous( - recording2, + recording, output_folder="tridesclous", singularity_image="spikeinterface/tridesclous-base:1.6.5", verbose=True ) -def test_ironclust(): +def test_ironclust(recording): ss.run_ironclust( - recording2, + recording, output_folder="ironclust", singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", verbose=True - ) \ No newline at end of file + ) From 31746b41a9a000dea9f9bcc0245f7050ad0a118c Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Thu, 16 Jun 2022 11:01:46 -0300 Subject: [PATCH 28/61] merge updates --- tests/test_singularity_containers.py | 81 ++++++++++------------------ 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 495c329..8709a17 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -9,7 +9,7 @@ @pytest.fixture def work_dir(request, tmpdir_factory): - tmpdir = tmpdir_factory.mktemp('work_dir') + tmpdir = tmpdir_factory.mktemp("work_dir") os.chdir(tmpdir) yield os.chdir(request.config.invocation_dir) @@ -17,7 +17,7 @@ def work_dir(request, tmpdir_factory): @pytest.fixture -def recording(work_dir): +def run_kwargs(work_dir): test_recording = generate_recording( num_channels=32, @@ -27,85 +27,58 @@ def recording(work_dir): ndim=2, ) test_recording = test_recording.save(folder="test_recording") - return test_recording + return dict(recording=test_recording, verbose=True, singularity_image=True) -def test_spyking_circus(recording, work_dir): - - ss.run_spykingcircus( - recording, - output_folder="spyking_circus", - singularity_image="spikeinterface/spyking-circus-base:1.1.0", - verbose=True - ) - @pytest.mark.xfail(reason="FAILING: investigate why") -def test_spyking_circus(): - ss.run_spykingcircus(output_folder="spyking_circus", **kwargs) +def test_spyking_circus(run_kwargs): + ss.run_spykingcircus(output_folder="spyking_circus", **run_kwargs) @pytest.mark.xfail(reason="FAILING: investigate why") -def test_mountainsort4(): - ss.run_mountainsort4(output_folder="mountainsort4", **kwargs) +def test_mountainsort4(run_kwargs): + ss.run_mountainsort4(output_folder="mountainsort4", **run_kwargs) -def test_tridesclous(): - ss.run_tridesclous(output_folder="tridesclous", **kwargs) +def test_tridesclous(run_kwargs): + ss.run_tridesclous(output_folder="tridesclous", **run_kwargs) -def test_tridecluos(recording): - - ss.run_tridesclous( - recording, - output_folder="tridesclous", - singularity_image="spikeinterface/tridesclous-base:1.6.5", - verbose=True - ) - - -def test_ironclust(recording): - - ss.run_ironclust( - recording, - output_folder="ironclust", - singularity_image="spikeinterface/ironclust-compiled-base:5.9.8", - verbose=True - ) -def test_klusta(): - ss.run_klusta(output_folder="klusta", **kwargs) +def test_klusta(run_kwargs): + ss.run_klusta(output_folder="klusta", **run_kwargs) -def test_ironclust(): - ss.run_ironclust(output_folder="ironclust", fGpu=False, **kwargs) +def test_ironclust(run_kwargs): + ss.run_ironclust(output_folder="ironclust", fGpu=False, **run_kwargs) -def test_waveclus(): - ss.run_waveclus(output_folder="waveclus", **kwargs) +def test_waveclus(run_kwargs): + ss.run_waveclus(output_folder="waveclus", **run_kwargs) -def test_hdsort(): - ss.run_hdsort(output_folder="hdsort", **kwargs) +def test_hdsort(run_kwargs): + ss.run_hdsort(output_folder="hdsort", **run_kwargs) -def test_kilosort1(): - ss.run_kilosort(output_folder="kilosort", useGPU=False, **kwargs) +def test_kilosort1(run_kwargs): + ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs) @pytest.mark.skip(reason="GPU required") -def test_kilosort2(): - ss.run_kilosort2(output_folder="kilosort2", **kwargs) +def test_kilosort2(run_kwargs): + ss.run_kilosort2(output_folder="kilosort2", **run_kwargs) @pytest.mark.skip(reason="GPU required") -def test_kilosort2_5(): - ss.run_kilosort2_5(output_folder="kilosort2_5", **kwargs) +def test_kilosort2_5(run_kwargs): + ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs) @pytest.mark.skip(reason="GPU required") -def test_kilosort3(): - ss.run_kilosort3(output_folder="kilosort3", **kwargs) +def test_kilosort3(run_kwargs): + ss.run_kilosort3(output_folder="kilosort3", **run_kwargs) @pytest.mark.skip(reason="GPU required") -def test_pykilosort(): - ss.run_pykilosort(output_folder="pykilosort", **kwargs) +def test_pykilosort(run_kwargs): + ss.run_pykilosort(output_folder="pykilosort", **run_kwargs) From e0a56cd4b70700c2de2f3b44287c7120e0986c65 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 09:19:39 -0300 Subject: [PATCH 29/61] Testing with toy data --- .gitignore | 1 + tests/test_singularity_containers.py | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 8709a17..464605f 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -3,8 +3,8 @@ import pytest +import spikeinterface.extractors as se import spikeinterface.sorters as ss -from spikeinterface.core.testing_tools import generate_recording @pytest.fixture @@ -18,19 +18,16 @@ def work_dir(request, tmpdir_factory): @pytest.fixture def run_kwargs(work_dir): - - test_recording = generate_recording( + test_recording, _ = se.toy_example( + duration=120, + seed=0, num_channels=32, - sampling_frequency=30000.0, # in Hz - durations=[120], - set_probe=True, - ndim=2, + num_segments=1 ) - test_recording = test_recording.save(folder="test_recording") + test_recording = test_recording.save(name='toy') return dict(recording=test_recording, verbose=True, singularity_image=True) -@pytest.mark.xfail(reason="FAILING: investigate why") def test_spyking_circus(run_kwargs): ss.run_spykingcircus(output_folder="spyking_circus", **run_kwargs) From 382f1018a58f261cd766a63acfd28a2970c9aabf Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 15:56:52 -0300 Subject: [PATCH 30/61] Added requirements_test.txt --- requirements_test.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements_test.txt diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..a46bd73 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,3 @@ +git+https://github.com/SpikeInterface/spikeinterface.git#egg=spikeinterface[full] +spython==0.2.1 +pytest==7.1.2 From 2d576ebc1b07ac41551ea57c40e594a7fd06f6bd Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 15:57:28 -0300 Subject: [PATCH 31/61] test workflow --- .../workflows/test_containers_singularity.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 2163d80..ed86764 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -1,8 +1,8 @@ name: Test sorter images in singularity on: - pull_request: - branches: [main] + push: + branches: [add_ci_tests] types: [synchronize, opened, reopened, ready_for_review] jobs: @@ -26,14 +26,7 @@ jobs: sudo apt update sudo apt install git - # get SI form master - git clone https://github.com/SpikeInterface/spikeinterface.git - cd spikeinterface - pip install . - pip install -r requirements_full.txt - - cd .. - pip install spython pytest tridesclous - - name: Test singularity - run: | - pytest -v tests/test_singularity_containers.py + pip install -r requirements_test.txt + # - name: Test singularity + # run: | + # pytest -v tests/test_singularity_containers.py From d78b114dd3ac760530ff7f96379ae51b2898144c Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 16:04:32 -0300 Subject: [PATCH 32/61] workflow --- .github/workflows/test_containers_singularity.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index ed86764..fd6fcd6 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -3,7 +3,6 @@ name: Test sorter images in singularity on: push: branches: [add_ci_tests] - types: [synchronize, opened, reopened, ready_for_review] jobs: build-and-test: From 3a685c72c59e9ca30805a3ae10a266ff49718916 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 16:11:27 -0300 Subject: [PATCH 33/61] Test images --- .github/workflows/test_containers_singularity.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index fd6fcd6..ebbd680 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -26,6 +26,7 @@ jobs: sudo apt install git pip install -r requirements_test.txt - # - name: Test singularity - # run: | - # pytest -v tests/test_singularity_containers.py + - name: Test tridesclous image + run: pytest -v tests/test_singularity_containers.py::test_tridesclous + - name: Test spyking-circus image + run: pytest -v tests/test_singularity_containers.py::test_spyking_circus From 8b6bd8793a56b039920e339575b0afd11012286c Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 17 Jun 2022 16:42:08 -0300 Subject: [PATCH 34/61] reduce duration, install tridesclous, print sorting --- .../workflows/test_containers_singularity.yml | 6 ++- tests/test_singularity_containers.py | 38 ++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index ebbd680..4fda9f2 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -27,6 +27,8 @@ jobs: pip install -r requirements_test.txt - name: Test tridesclous image - run: pytest -v tests/test_singularity_containers.py::test_tridesclous + run: | + pip install tridesclous + pytest -sv tests/test_singularity_containers.py::test_tridesclous - name: Test spyking-circus image - run: pytest -v tests/test_singularity_containers.py::test_spyking_circus + run: pytest -sv tests/test_singularity_containers.py::test_spyking_circus diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 464605f..42466bf 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -19,7 +19,7 @@ def work_dir(request, tmpdir_factory): @pytest.fixture def run_kwargs(work_dir): test_recording, _ = se.toy_example( - duration=120, + duration=30, seed=0, num_channels=32, num_segments=1 @@ -29,53 +29,65 @@ def run_kwargs(work_dir): def test_spyking_circus(run_kwargs): - ss.run_spykingcircus(output_folder="spyking_circus", **run_kwargs) + sorting = ss.run_spykingcircus(output_folder="spyking_circus", **run_kwargs) + print(sorting) @pytest.mark.xfail(reason="FAILING: investigate why") def test_mountainsort4(run_kwargs): - ss.run_mountainsort4(output_folder="mountainsort4", **run_kwargs) + sorting = ss.run_mountainsort4(output_folder="mountainsort4", **run_kwargs) + print(sorting) def test_tridesclous(run_kwargs): - ss.run_tridesclous(output_folder="tridesclous", **run_kwargs) + sorting = ss.run_tridesclous(output_folder="tridesclous", **run_kwargs) + print(sorting) def test_klusta(run_kwargs): - ss.run_klusta(output_folder="klusta", **run_kwargs) + sorting = ss.run_klusta(output_folder="klusta", **run_kwargs) + print(sorting) def test_ironclust(run_kwargs): - ss.run_ironclust(output_folder="ironclust", fGpu=False, **run_kwargs) + sorting = ss.run_ironclust(output_folder="ironclust", fGpu=False, **run_kwargs) + print(sorting) def test_waveclus(run_kwargs): - ss.run_waveclus(output_folder="waveclus", **run_kwargs) + sorting = ss.run_waveclus(output_folder="waveclus", **run_kwargs) + print(sorting) def test_hdsort(run_kwargs): - ss.run_hdsort(output_folder="hdsort", **run_kwargs) + sorting = ss.run_hdsort(output_folder="hdsort", **run_kwargs) + print(sorting) def test_kilosort1(run_kwargs): - ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs) + sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs) + print(sorting) @pytest.mark.skip(reason="GPU required") def test_kilosort2(run_kwargs): - ss.run_kilosort2(output_folder="kilosort2", **run_kwargs) + sorting = ss.run_kilosort2(output_folder="kilosort2", **run_kwargs) + print(sorting) @pytest.mark.skip(reason="GPU required") def test_kilosort2_5(run_kwargs): - ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs) + sorting = ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs) + print(sorting) @pytest.mark.skip(reason="GPU required") def test_kilosort3(run_kwargs): - ss.run_kilosort3(output_folder="kilosort3", **run_kwargs) + sorting = ss.run_kilosort3(output_folder="kilosort3", **run_kwargs) + print(sorting) @pytest.mark.skip(reason="GPU required") def test_pykilosort(run_kwargs): - ss.run_pykilosort(output_folder="pykilosort", **run_kwargs) + sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs) + print(sorting) From 54d30df02b1792ece51acc1db898260e5b5f5b6a Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 11:50:41 -0300 Subject: [PATCH 35/61] add workflow_dispatch --- .github/workflows/test_containers_singularity.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 4fda9f2..199020a 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -1,6 +1,7 @@ name: Test sorter images in singularity on: + workflow_dispatch: push: branches: [add_ci_tests] From e82368063ea1e42973a3e09d7461bc11192230b5 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 11:56:47 -0300 Subject: [PATCH 36/61] test manual --- .github/workflows/test_containers_singularity.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 199020a..599ff85 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -2,8 +2,6 @@ name: Test sorter images in singularity on: workflow_dispatch: - push: - branches: [add_ci_tests] jobs: build-and-test: From 7b582b451cdbb8751cd8731aac1a2998684b211f Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 13:58:29 -0300 Subject: [PATCH 37/61] Build job --- .../workflows/test_containers_singularity.yml | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 599ff85..7142541 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -4,7 +4,34 @@ on: workflow_dispatch: jobs: - build-and-test: + docker-build-images: + name: Docker build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # "macos-latest", "windows-latest" + os: ["ubuntu-latest", ] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Build Tridesclous Docker image + run: | + cd tridesclous + ./build.sh + cd .. + mkdir -p output/docker_images + docker save spikeinterface/tridesclous-base:latest > output/docker_images/tridesclous-image.tar + + - name: Temporarily save Docker Image + uses: actions/upload-artifact@v2 + with: + name: docker-artifact + path: output/docker_images + retention_days: 1 + + test-images: name: Test on (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: @@ -19,15 +46,22 @@ jobs: - uses: eWaterCycle/setup-singularity@v7 with: singularity-version: 3.8.3 + - name: Retrieve saved Docker image + uses: actions/download-artifact@v2 + with: + name: docker-artifact + path: output/docker_images - name: Install dependencies run: | sudo apt update sudo apt install git pip install -r requirements_test.txt + - name: Docker Load + run: docker load < output/docker_images/tridesclous-image.tar - name: Test tridesclous image run: | pip install tridesclous pytest -sv tests/test_singularity_containers.py::test_tridesclous - - name: Test spyking-circus image - run: pytest -sv tests/test_singularity_containers.py::test_spyking_circus + # - name: Test spyking-circus image + # run: pytest -sv tests/test_singularity_containers.py::test_spyking_circus From e8c8c64b5bb0b0ace75b185c3f1896d50a7884ed Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 13:58:59 -0300 Subject: [PATCH 38/61] job dep --- .github/workflows/test_containers_singularity.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 7142541..7bfb2d8 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -34,6 +34,7 @@ jobs: test-images: name: Test on (${{ matrix.os }}) runs-on: ${{ matrix.os }} + needs: docker-build-images strategy: fail-fast: false matrix: From dbd81fd75b0a14def93ab17032b4e7c62de18960 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 14:00:58 -0300 Subject: [PATCH 39/61] fix perm denied --- .github/workflows/test_containers_singularity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 7bfb2d8..34c76f1 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -19,7 +19,7 @@ jobs: - name: Build Tridesclous Docker image run: | cd tridesclous - ./build.sh + bash build.sh cd .. mkdir -p output/docker_images docker save spikeinterface/tridesclous-base:latest > output/docker_images/tridesclous-image.tar From f09d5e79c01f8d92117ff76d444a11a4ee0fb2bc Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 14:06:53 -0300 Subject: [PATCH 40/61] fix retention-days --- .github/workflows/test_containers_singularity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 34c76f1..7aa9869 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -29,7 +29,7 @@ jobs: with: name: docker-artifact path: output/docker_images - retention_days: 1 + retention-days: 1 test-images: name: Test on (${{ matrix.os }}) From c82b4d7db316ed32b795ecc44305e199da91ad60 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sat, 18 Jun 2022 20:18:57 -0300 Subject: [PATCH 41/61] Update requirements --- requirements_test.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index a46bd73..d397859 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,4 @@ -git+https://github.com/SpikeInterface/spikeinterface.git#egg=spikeinterface[full] +git+https://github.com/Tauffer-Consulting/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] +docker==5.0.3 spython==0.2.1 pytest==7.1.2 From 34a2963605eccc448dd333526b83f69c2c0e0f90 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sun, 19 Jun 2022 08:21:34 -0300 Subject: [PATCH 42/61] change req - temp --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index d397859..9616e45 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,4 @@ -git+https://github.com/Tauffer-Consulting/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] +git+https://github.com/chyumin/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] docker==5.0.3 spython==0.2.1 pytest==7.1.2 From 1d7b9d857b18675365adbf703de4a030d7ad7b6f Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sun, 19 Jun 2022 09:39:50 -0300 Subject: [PATCH 43/61] remove matrix for build --- .github/workflows/test_containers_singularity.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 7aa9869..87f1878 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -6,12 +6,7 @@ on: jobs: docker-build-images: name: Docker build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # "macos-latest", "windows-latest" - os: ["ubuntu-latest", ] + runs-on: "ubuntu-latest" steps: - name: Checkout uses: actions/checkout@v2 From c7a125db02ea28faf3cc2ec1d039655d18a0712b Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Sun, 19 Jun 2022 10:36:22 -0300 Subject: [PATCH 44/61] Add test changed_files fix --- .github/workflows/test_changed_files.yml | 24 +++++++++++++++++++ .../workflows/test_containers_singularity.yml | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test_changed_files.yml diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml new file mode 100644 index 0000000..73afbe5 --- /dev/null +++ b/.github/workflows/test_changed_files.yml @@ -0,0 +1,24 @@ +name: CI/CD Test + +on: + pull_request: + branches: [main] + types: [synchronize, opened, reopened, ready_for_review] + +jobs: + test: + name: Test changed-files + runs-on: "ubuntu-latest" + steps: + - name: Checkount + uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v23 + + - name: List all changed files + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 87f1878..0651efc 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -9,7 +9,7 @@ jobs: runs-on: "ubuntu-latest" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build Tridesclous Docker image run: | @@ -36,7 +36,7 @@ jobs: # "macos-latest", "windows-latest" os: ["ubuntu-latest", ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: python-version: 3.8 - uses: eWaterCycle/setup-singularity@v7 From 3c3fbf8a90c2b39b94a69a57190c129aa42cf080 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 06:18:46 -0300 Subject: [PATCH 45/61] test set-matrix job --- .github/workflows/test_changed_files.yml | 30 ++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml index 73afbe5..751b43e 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/test_changed_files.yml @@ -6,9 +6,11 @@ on: types: [synchronize, opened, reopened, ready_for_review] jobs: - test: - name: Test changed-files - runs-on: "ubuntu-latest" + set-matrix-job: + name: Set jobs by changed Dockerfile + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - name: Checkount uses: actions/checkout@v3 @@ -17,8 +19,22 @@ jobs: id: changed-files uses: tj-actions/changed-files@v23 - - name: List all changed files + - name: Set jobs' matrix + id: set-matrix run: | - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - echo "$file was changed" - done + filtered='' + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if [[ "$file" == *"Dockerfile"* ]]; then + parsed=${file%*/Dockerfile*} + filtered="${filtered} ${parsed}" + fi + done + echo "::set-output name=matrix::${filtered}" + test: + needs: set-matrix-job + runs-on: "ubuntu-latest" + strategy: + matrix: + sorter: ${{ needs.set-matrix-job.outputs.matrix }} + steps: + - run: echo ${{ matrix.sorter }} From 211d3bf3677c69350c9f4060720eb104e68fd90b Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 06:36:55 -0300 Subject: [PATCH 46/61] udpate --- .github/workflows/test_changed_files.yml | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml index 751b43e..465bb44 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/test_changed_files.yml @@ -10,7 +10,7 @@ jobs: name: Set jobs by changed Dockerfile runs-on: ubuntu-latest outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + sorters: ${{ steps.set-matrix.outputs.sorters }} steps: - name: Checkount uses: actions/checkout@v3 @@ -22,19 +22,26 @@ jobs: - name: Set jobs' matrix id: set-matrix run: | - filtered='' - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - if [[ "$file" == *"Dockerfile"* ]]; then - parsed=${file%*/Dockerfile*} - filtered="${filtered} ${parsed}" - fi - done - echo "::set-output name=matrix::${filtered}" + sorters="[" + for file in /Dockerfilesabc/Dockerfiles def/Dockerfiles huea; do + if [[ "$file" == *"Dockerfile"* ]]; then + # Removing /Dockerfile from string + parsed=${file%*/Dockerfile*} + + # Appending to sorters Array + sorters+="\"${parsed}\", " + fi + done + sorters=${sorters%*, *} + sorters+="]" + echo $sorters + + echo "::set-output name=sorters::${sorters}" test: needs: set-matrix-job runs-on: "ubuntu-latest" strategy: matrix: - sorter: ${{ needs.set-matrix-job.outputs.matrix }} + sorter: ${{ fromJSON(needs.set-matrix-job.outputs.matrix) }} steps: - run: echo ${{ matrix.sorter }} From 557768ad3ff3cc29e72dc2db4282baf6ad34d2ee Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 07:37:15 -0300 Subject: [PATCH 47/61] use action files filter --- .github/workflows/test_changed_files.yml | 73 +++++++++++++++++------- spykingcircus/Dockerfile | 2 + tests/test_singularity_containers.py | 6 +- tridesclous/Dockerfile | 2 + 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml index 465bb44..cc28f49 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/test_changed_files.yml @@ -6,42 +6,73 @@ on: types: [synchronize, opened, reopened, ready_for_review] jobs: - set-matrix-job: - name: Set jobs by changed Dockerfile - runs-on: ubuntu-latest + prepare-matrix-jobs: + name: Prepare Build and Test Jobs + runs-on: "ubuntu-latest" outputs: - sorters: ${{ steps.set-matrix.outputs.sorters }} + has_changed_files: ${{ steps.changed-files.outputs.any_changed }} + sorters: ${{ steps.get-changed-sorters.outputs.sorters }} steps: - - name: Checkount + - name: Checkout uses: actions/checkout@v3 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v23 + with: + files: | + */Dockerfile - - name: Set jobs' matrix - id: set-matrix + - name: Prepare jobs matrix + id: get-changed-sorters run: | + # sorters variable will be a JSON-like array sorters="[" - for file in /Dockerfilesabc/Dockerfiles def/Dockerfiles huea; do - if [[ "$file" == *"Dockerfile"* ]]; then - # Removing /Dockerfile from string - parsed=${file%*/Dockerfile*} - - # Appending to sorters Array - sorters+="\"${parsed}\", " - fi + + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + # Removing /Dockerfile from string + parsed=${file%*/Dockerfile*} + + # Appending to final string + sorters+="\"${parsed}\", " done sorters=${sorters%*, *} sorters+="]" - echo $sorters + echo ${sorters} echo "::set-output name=sorters::${sorters}" - test: - needs: set-matrix-job - runs-on: "ubuntu-latest" + + build-and-test-image: + name: build (${{ matrix.sorter }}) + if: needs.prepare-matrix-jobs.outputs.has_changed_files == 'true' + needs: prepare-matrix-jobs + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - sorter: ${{ fromJSON(needs.set-matrix-job.outputs.matrix) }} + # "macos-latest", "windows-latest" + os: ["ubuntu-latest", ] + sorter: ${{ fromJSON(needs.prepare-matrix-jobs.outputs.sorters) }} steps: - - run: echo ${{ matrix.sorter }} + - name: Checkout + uses: actions/checkout@v3 + with: + python-version: 3.8 + + - name: Build ${{ matrix.sorter }} Docker image + run: | + cd ${{ matrix.sorter }} + bash build.sh + cd .. + + - uses: eWaterCycle/setup-singularity@v7 + with: + singularity-version: 3.8.3 + + - name: Install dependencies & Test ${{ matrix.sorter }} image + run: | + if [[ ${{ matrix.sorter }} == 'tridesclous' ]] + pip install tridesclous + fi + pip install -r requirements_test.txt + pytest -sv tests/test_singularity_containers.py::test_${{ matrix.sorter }} diff --git a/spykingcircus/Dockerfile b/spykingcircus/Dockerfile index 27e2b1e..eafe1b0 100644 --- a/spykingcircus/Dockerfile +++ b/spykingcircus/Dockerfile @@ -14,3 +14,5 @@ RUN apt-get update && apt-get install -y packagekit-gtk3-module libcanberra-gtk- RUN pip install scikit-build RUN pip install cmake>=3.18 RUN pip install spyking-circus==1.1.0 + +# test \ No newline at end of file diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 42466bf..dea7e0f 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -21,15 +21,15 @@ def run_kwargs(work_dir): test_recording, _ = se.toy_example( duration=30, seed=0, - num_channels=32, + num_channels=64, num_segments=1 ) test_recording = test_recording.save(name='toy') return dict(recording=test_recording, verbose=True, singularity_image=True) -def test_spyking_circus(run_kwargs): - sorting = ss.run_spykingcircus(output_folder="spyking_circus", **run_kwargs) +def test_spykingcircus(run_kwargs): + sorting = ss.run_spykingcircus(output_folder="spykingcircus", **run_kwargs) print(sorting) diff --git a/tridesclous/Dockerfile b/tridesclous/Dockerfile index 03a3016..4992867 100644 --- a/tridesclous/Dockerfile +++ b/tridesclous/Dockerfile @@ -20,3 +20,5 @@ RUN pip install h5py RUN pip install loky packaging RUN pip install tridesclous==1.6.5 + +# test \ No newline at end of file From 81185d679f30717496930c075c21bb28f3e52bdf Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 10:33:56 -0300 Subject: [PATCH 48/61] Remove build --- .../workflows/test_containers_singularity.yml | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 0651efc..fc246c1 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -4,32 +4,9 @@ on: workflow_dispatch: jobs: - docker-build-images: - name: Docker build - runs-on: "ubuntu-latest" - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build Tridesclous Docker image - run: | - cd tridesclous - bash build.sh - cd .. - mkdir -p output/docker_images - docker save spikeinterface/tridesclous-base:latest > output/docker_images/tridesclous-image.tar - - - name: Temporarily save Docker Image - uses: actions/upload-artifact@v2 - with: - name: docker-artifact - path: output/docker_images - retention-days: 1 - test-images: name: Test on (${{ matrix.os }}) runs-on: ${{ matrix.os }} - needs: docker-build-images strategy: fail-fast: false matrix: @@ -39,25 +16,16 @@ jobs: - uses: actions/checkout@v3 with: python-version: 3.8 + - uses: eWaterCycle/setup-singularity@v7 with: singularity-version: 3.8.3 - - name: Retrieve saved Docker image - uses: actions/download-artifact@v2 - with: - name: docker-artifact - path: output/docker_images + - name: Install dependencies run: | - sudo apt update - sudo apt install git - + pip install tridesclous pip install -r requirements_test.txt - - name: Docker Load - run: docker load < output/docker_images/tridesclous-image.tar - name: Test tridesclous image run: | pip install tridesclous - pytest -sv tests/test_singularity_containers.py::test_tridesclous - # - name: Test spyking-circus image - # run: pytest -sv tests/test_singularity_containers.py::test_spyking_circus + pytest -sv tests/test_singularity_containers.pytest_tridesclous From d3df31678523969ac8531511ad272a5e30fe863a Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 10:50:34 -0300 Subject: [PATCH 49/61] rename and small fix --- .github/workflows/test_changed_files.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml index cc28f49..1965f3c 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/test_changed_files.yml @@ -43,7 +43,7 @@ jobs: echo "::set-output name=sorters::${sorters}" build-and-test-image: - name: build (${{ matrix.sorter }}) + name: Build and Test (${{ matrix.sorter }}) if: needs.prepare-matrix-jobs.outputs.has_changed_files == 'true' needs: prepare-matrix-jobs runs-on: ${{ matrix.os }} @@ -71,7 +71,7 @@ jobs: - name: Install dependencies & Test ${{ matrix.sorter }} image run: | - if [[ ${{ matrix.sorter }} == 'tridesclous' ]] + if [[ ${{ matrix.sorter }} == 'tridesclous' ]]; then pip install tridesclous fi pip install -r requirements_test.txt From 6f01fd31e8d25bc4db3b36b8966dc551ef3fcba9 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 10:53:31 -0300 Subject: [PATCH 50/61] fix pytest run --- .github/workflows/test_containers_singularity.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index fc246c1..3f9ff9e 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -25,7 +25,8 @@ jobs: run: | pip install tridesclous pip install -r requirements_test.txt + - name: Test tridesclous image run: | pip install tridesclous - pytest -sv tests/test_singularity_containers.pytest_tridesclous + pytest -sv tests/test_singularity_containers.py From a42c007a02ed814fea3d009221be0c7c67d47900 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 11:01:15 -0300 Subject: [PATCH 51/61] update requirement --- requirements_test.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 9616e45..74deb06 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,5 @@ -git+https://github.com/chyumin/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] +git+https://github.com/Tauffer-Consulting/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] docker==5.0.3 spython==0.2.1 pytest==7.1.2 + From 0329be3ee0c3fbf9d692e80aedfdf366510f0300 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 11:06:23 -0300 Subject: [PATCH 52/61] Start push image step --- .github/workflows/test_changed_files.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/test_changed_files.yml index 1965f3c..19266c8 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/test_changed_files.yml @@ -76,3 +76,10 @@ jobs: fi pip install -r requirements_test.txt pytest -sv tests/test_singularity_containers.py::test_${{ matrix.sorter }} + + - name: Push image + run: | + echo TO BE DONE + # cd ${{ matrix.sorter }} + # bash push.sh + # cd .. From 1c1459969c645e7a5617d2379ee4f456608d9b08 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 11:19:54 -0300 Subject: [PATCH 53/61] Renames --- .../{test_changed_files.yml => build_test_push_images.yml} | 2 +- .github/workflows/test_containers_singularity.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{test_changed_files.yml => build_test_push_images.yml} (99%) diff --git a/.github/workflows/test_changed_files.yml b/.github/workflows/build_test_push_images.yml similarity index 99% rename from .github/workflows/test_changed_files.yml rename to .github/workflows/build_test_push_images.yml index 19266c8..9efc5a1 100644 --- a/.github/workflows/test_changed_files.yml +++ b/.github/workflows/build_test_push_images.yml @@ -1,4 +1,4 @@ -name: CI/CD Test +name: CI/CD on: pull_request: diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 3f9ff9e..19cac5d 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -26,7 +26,7 @@ jobs: pip install tridesclous pip install -r requirements_test.txt - - name: Test tridesclous image + - name: Run test singularity containers run: | pip install tridesclous pytest -sv tests/test_singularity_containers.py From c919e6c416145def363f5f493c802cbdb263d9d7 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 12:03:04 -0300 Subject: [PATCH 54/61] only ci-tests --- .github/workflows/build_test_push_images.yml | 85 ------------------- .../workflows/test_containers_singularity.yml | 3 + spykingcircus/Dockerfile | 2 - tridesclous/Dockerfile | 2 - 4 files changed, 3 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/build_test_push_images.yml diff --git a/.github/workflows/build_test_push_images.yml b/.github/workflows/build_test_push_images.yml deleted file mode 100644 index 9efc5a1..0000000 --- a/.github/workflows/build_test_push_images.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: CI/CD - -on: - pull_request: - branches: [main] - types: [synchronize, opened, reopened, ready_for_review] - -jobs: - prepare-matrix-jobs: - name: Prepare Build and Test Jobs - runs-on: "ubuntu-latest" - outputs: - has_changed_files: ${{ steps.changed-files.outputs.any_changed }} - sorters: ${{ steps.get-changed-sorters.outputs.sorters }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v23 - with: - files: | - */Dockerfile - - - name: Prepare jobs matrix - id: get-changed-sorters - run: | - # sorters variable will be a JSON-like array - sorters="[" - - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - # Removing /Dockerfile from string - parsed=${file%*/Dockerfile*} - - # Appending to final string - sorters+="\"${parsed}\", " - done - sorters=${sorters%*, *} - sorters+="]" - - echo ${sorters} - echo "::set-output name=sorters::${sorters}" - - build-and-test-image: - name: Build and Test (${{ matrix.sorter }}) - if: needs.prepare-matrix-jobs.outputs.has_changed_files == 'true' - needs: prepare-matrix-jobs - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # "macos-latest", "windows-latest" - os: ["ubuntu-latest", ] - sorter: ${{ fromJSON(needs.prepare-matrix-jobs.outputs.sorters) }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - python-version: 3.8 - - - name: Build ${{ matrix.sorter }} Docker image - run: | - cd ${{ matrix.sorter }} - bash build.sh - cd .. - - - uses: eWaterCycle/setup-singularity@v7 - with: - singularity-version: 3.8.3 - - - name: Install dependencies & Test ${{ matrix.sorter }} image - run: | - if [[ ${{ matrix.sorter }} == 'tridesclous' ]]; then - pip install tridesclous - fi - pip install -r requirements_test.txt - pytest -sv tests/test_singularity_containers.py::test_${{ matrix.sorter }} - - - name: Push image - run: | - echo TO BE DONE - # cd ${{ matrix.sorter }} - # bash push.sh - # cd .. diff --git a/.github/workflows/test_containers_singularity.yml b/.github/workflows/test_containers_singularity.yml index 19cac5d..cdc2545 100644 --- a/.github/workflows/test_containers_singularity.yml +++ b/.github/workflows/test_containers_singularity.yml @@ -2,6 +2,9 @@ name: Test sorter images in singularity on: workflow_dispatch: + pull_request: + branches: [main] + types: [synchronize, opened, reopened, ready_for_review] jobs: test-images: diff --git a/spykingcircus/Dockerfile b/spykingcircus/Dockerfile index eafe1b0..27e2b1e 100644 --- a/spykingcircus/Dockerfile +++ b/spykingcircus/Dockerfile @@ -14,5 +14,3 @@ RUN apt-get update && apt-get install -y packagekit-gtk3-module libcanberra-gtk- RUN pip install scikit-build RUN pip install cmake>=3.18 RUN pip install spyking-circus==1.1.0 - -# test \ No newline at end of file diff --git a/tridesclous/Dockerfile b/tridesclous/Dockerfile index 4992867..03a3016 100644 --- a/tridesclous/Dockerfile +++ b/tridesclous/Dockerfile @@ -20,5 +20,3 @@ RUN pip install h5py RUN pip install loky packaging RUN pip install tridesclous==1.6.5 - -# test \ No newline at end of file From 92c2cbee655158a8dfa61d21b65862d33540386f Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Mon, 20 Jun 2022 15:08:41 -0300 Subject: [PATCH 55/61] skip ks1 --- tests/test_singularity_containers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index dea7e0f..ca61b0e 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -64,6 +64,7 @@ def test_hdsort(run_kwargs): print(sorting) +@pytest.mark.skip(reason='Image for KiloSort 1 not implemented yet') def test_kilosort1(run_kwargs): sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs) print(sorting) From c01b98509a4c698789e0c9703b29be49d4b79769 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Wed, 22 Jun 2022 08:48:56 -0300 Subject: [PATCH 56/61] Remove mountainsort4 skip test --- tests/test_singularity_containers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index ca61b0e..b955a48 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -33,7 +33,6 @@ def test_spykingcircus(run_kwargs): print(sorting) -@pytest.mark.xfail(reason="FAILING: investigate why") def test_mountainsort4(run_kwargs): sorting = ss.run_mountainsort4(output_folder="mountainsort4", **run_kwargs) print(sorting) From cc85c3ccae6bae207c819972b6cd38141572b2ed Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Thu, 23 Jun 2022 08:51:03 -0300 Subject: [PATCH 57/61] blankline --- requirements_test.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 74deb06..d397859 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,4 +2,3 @@ git+https://github.com/Tauffer-Consulting/spikeinterface.git@singularity-image-c docker==5.0.3 spython==0.2.1 pytest==7.1.2 - From 99f1eb9a363db6494c432950276aab63c54e211b Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 24 Jun 2022 09:34:48 -0300 Subject: [PATCH 58/61] remove skip ks1 --- tests/test_singularity_containers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index b955a48..8e55f25 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -63,7 +63,6 @@ def test_hdsort(run_kwargs): print(sorting) -@pytest.mark.skip(reason='Image for KiloSort 1 not implemented yet') def test_kilosort1(run_kwargs): sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs) print(sorting) From 7e8c260eee55ce7efac9a84f5ddcb860abeffae5 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 24 Jun 2022 09:43:02 -0300 Subject: [PATCH 59/61] change source to main --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index d397859..4470a8d 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,4 @@ -git+https://github.com/Tauffer-Consulting/spikeinterface.git@singularity-image-check#egg=spikeinterface[full] +git+https://github.com/SpikeInterface/spikeinterface.git#egg=spikeinterface[full] docker==5.0.3 spython==0.2.1 pytest==7.1.2 From ebc7781be13528149f4f9a83557594797e9a6173 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 24 Jun 2022 17:11:46 -0300 Subject: [PATCH 60/61] Earlier tests cleanup to save space --- tests/test_singularity_containers.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 8e55f25..132585a 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -7,13 +7,20 @@ import spikeinterface.sorters as ss -@pytest.fixture -def work_dir(request, tmpdir_factory): - tmpdir = tmpdir_factory.mktemp("work_dir") - os.chdir(tmpdir) +@pytest.fixture(autouse=True) +def work_dir(request, tmp_path): + """ + This fixture, along with "run_kwargs" creates one folder per + test function using built-in tmp_path pytest fixture + + The tmp_path will be the working directory for the test function + + At the end of the each test function, a clean up will be done + """ + os.chdir(tmp_path) yield os.chdir(request.config.invocation_dir) - shutil.rmtree(str(tmpdir)) + shutil.rmtree(str(tmp_path)) @pytest.fixture From 5556fa9c92c1ab9ab294485b6e7b130ae2188869 Mon Sep 17 00:00:00 2001 From: Chuang Yu Min Date: Fri, 24 Jun 2022 20:19:38 -0300 Subject: [PATCH 61/61] disabling singularity cache for tests --- tests/test_singularity_containers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_singularity_containers.py b/tests/test_singularity_containers.py index 132585a..ba94222 100644 --- a/tests/test_singularity_containers.py +++ b/tests/test_singularity_containers.py @@ -6,6 +6,8 @@ import spikeinterface.extractors as se import spikeinterface.sorters as ss +os.environ['SINGULARITY_DISABLE_CACHE'] = 'true' + @pytest.fixture(autouse=True) def work_dir(request, tmp_path):