From 00ca8bd3cd1d7f2013e78e0e1d25844fbf676191 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Wed, 17 Aug 2022 09:15:45 +0100 Subject: [PATCH 1/2] fixes #4920 Signed-off-by: Wenqi Li --- tests/test_video_datasets.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/test_video_datasets.py b/tests/test_video_datasets.py index 78a1215e09..ac9e151f63 100644 --- a/tests/test_video_datasets.py +++ b/tests/test_video_datasets.py @@ -11,7 +11,6 @@ import os import unittest -from contextlib import nullcontext from typing import Type, Union import torch @@ -49,15 +48,11 @@ def test_no_opencv_raises(self): @unittest.skipUnless(has_cv2, "OpenCV required.") def test_multiprocessing(self): - for multiprocessing in (True, False): - for num_workers in (0, 2): - # we only expect an error if num_workers > 0 and not using - # multiprocessing - expect_raise = num_workers == 2 and not multiprocessing - ds = self.get_ds(max_num_frames=100, multiprocessing=multiprocessing) - dl = DataLoader(ds, num_workers=num_workers, batch_size=2) - with self.assertRaises((TypeError, RuntimeError)) if expect_raise else nullcontext(): - _ = next(iter(dl)) + for num_workers in (0, 2): + multiprocessing = num_workers > 0 + ds = self.get_ds(max_num_frames=100, multiprocessing=multiprocessing) + dl = DataLoader(ds, num_workers=num_workers, batch_size=2) + _ = next(iter(dl)) @unittest.skipUnless(has_cv2, "OpenCV required.") def test_multiple_sources(self, should_match: bool = True): From 97b906463d73d1e3b4ef540b850e9b228988e189 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Wed, 17 Aug 2022 09:18:42 +0100 Subject: [PATCH 2/2] workaround #4917 Signed-off-by: Wenqi Li --- .github/workflows/cron.yml | 6 +++--- .github/workflows/pythonapp-gpu.yml | 2 +- .github/workflows/setupapp.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index b143b26ce0..e95adedcbc 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -50,7 +50,7 @@ jobs: python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))' BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report - coverage xml + coverage xml --ignore-errors if pgrep python; then pkill python; fi - name: Upload coverage uses: codecov/codecov-action@v1 @@ -93,7 +93,7 @@ jobs: python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))' BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report - coverage xml + coverage xml --ignore-errors if pgrep python; then pkill python; fi - name: Upload coverage uses: codecov/codecov-action@v1 @@ -192,7 +192,7 @@ jobs: ngc --version BUILD_MONAI=1 ./runtests.sh --build --coverage --pytype --unittests --disttests # unit tests with pytype checks, coverage report BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report - coverage xml + coverage xml --ignore-errors if pgrep python; then pkill python; fi - name: Upload coverage uses: codecov/codecov-action@v1 diff --git a/.github/workflows/pythonapp-gpu.yml b/.github/workflows/pythonapp-gpu.yml index 8a78a49f0c..e9a60408fb 100644 --- a/.github/workflows/pythonapp-gpu.yml +++ b/.github/workflows/pythonapp-gpu.yml @@ -142,7 +142,7 @@ jobs: # test the clang-format tool downloading once coverage run -m tests.clang_format_utils fi - coverage xml + coverage xml --ignore-errors if pgrep python; then pkill python; fi shell: bash - name: Upload coverage diff --git a/.github/workflows/setupapp.yml b/.github/workflows/setupapp.yml index 4a2a46cfc1..ee3f275c64 100644 --- a/.github/workflows/setupapp.yml +++ b/.github/workflows/setupapp.yml @@ -61,7 +61,7 @@ jobs: python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))' BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report - coverage xml + coverage xml --ignore-errors if pgrep python; then pkill python; fi shell: bash - name: Upload coverage @@ -105,7 +105,7 @@ jobs: python -m pip list python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' BUILD_MONAI=1 ./runtests.sh --build --quick --unittests --disttests - coverage xml + coverage xml --ignore-errors - name: Upload coverage uses: codecov/codecov-action@v1 with: