Skip to content

Commit

Permalink
interpret sigterm as sigint
Browse files Browse the repository at this point in the history
  • Loading branch information
leej3 committed May 22, 2024
1 parent c8de5eb commit 57dfb63
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gpu-hvd-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
set -xe
bash tests/run_gpu_tests.sh 2 hvd
CUDA_VISIBLE_DEVICES="" pytest --cov ignite --cov-append --cov-report term-missing --cov-report xml -vvv tests/ignite/ignite/ -m distributed -k hvd
CUDA_VISIBLE_DEVICES="" pytest --cov ignite --cov-append --cov-report term-missing --cov-report xml -vvv tests/ignite -m distributed -k hvd
EOF
)
Expand Down
16 changes: 16 additions & 0 deletions tests/ignite/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import functools
import os
import shutil
import signal
import sys
import tempfile
import threading
import time
from pathlib import Path

Expand Down Expand Up @@ -34,6 +36,20 @@ def pytest_addoption(parser):
)


@pytest.fixture(scope="session", autouse=True)
def term_handler():
# This allows the pytest session to be terminated upon retries on CI. It may
# be worth using this fixture solely in that context. For a discussion on
# whether sigterm should be ignored see:
# https://github.com/pytest-dev/pytest/issues/5243
if threading.current_thread() is threading.main_thread() and hasattr(signal, "SIGTERM"):
orig = signal.signal(signal.SIGTERM, signal.getsignal(signal.SIGINT))
yield
signal.signal(signal.SIGTERM, orig)
else:
yield # Just pass through if SIGTERM isn't supported or we are not in the main thread


@pytest.fixture(
params=[
"cpu",
Expand Down
4 changes: 2 additions & 2 deletions tests/run_gpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ "${skip_distrib_tests}" -eq "1" ]; then
fi

run_tests \
--core_args "-vvv -m distributed tests" \
--core_args "-vvv -m distributed tests/ignite" \
--cache_dir ".gpu-distrib" \
--skip_distrib_tests 0 \
--use_coverage 1 \
Expand All @@ -37,7 +37,7 @@ run_tests \

if [ ${ngpus} -gt 1 ]; then
run_tests \
--core_args "-vvv -m distributed tests" \
--core_args "-vvv -m distributed tests/ignite" \
--world_size "${ngpus}" \
--cache_dir ".gpu-distrib-multi" \
--skip_distrib_tests 0 \
Expand Down
4 changes: 2 additions & 2 deletions tests/run_tpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -xeu
use_last_failed=${USE_LAST_FAILED:-0}

run_tests \
--core_args "-vvv -m tpu tests" \
--core_args "-vvv -m tpu tests/ignite" \
--cache_dir ".tpu" \
--use_coverage 1 \
--use_last_failed ${use_last_failed}
Expand All @@ -13,7 +13,7 @@ run_tests \
if [ -z ${NUM_TPU_WORKERS+x} ]; then
export NUM_TPU_WORKERS=1
run_tests \
--core_args "-vvv -m tpu tests" \
--core_args "-vvv -m tpu tests/ignite" \
--cache_dir ".tpu-multi" \
--use_coverage 1 \
--use_last_failed ${use_last_failed}
Expand Down

0 comments on commit 57dfb63

Please sign in to comment.