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 475be56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
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

0 comments on commit 475be56

Please sign in to comment.