Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug github runner timeout with tmate #4691

Closed
wants to merge 19 commits into from
6 changes: 0 additions & 6 deletions .github/actions/setup-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ inputs:
default: 'fasteners'
griddataformats:
default: 'griddataformats'
gsd:
default: 'gsd>3.0.0'
hypothesis:
default: 'hypothesis'
matplotlib:
Expand Down Expand Up @@ -94,8 +92,6 @@ inputs:
trove-classifiers:
default: 'trove-classifiers'
# pip-install optional dependencies
duecredit:
default: 'duecredit'
parmed:
default: 'parmed'
pyedr:
Expand Down Expand Up @@ -129,7 +125,6 @@ runs:
${{ inputs.clustalw }}
${{ inputs.dask }}
${{ inputs.distopia }}
${{ inputs.gsd }}
${{ inputs.h5py }}
${{ inputs.hole2 }}
${{ inputs.joblib }}
Expand Down Expand Up @@ -169,7 +164,6 @@ runs:
${{ inputs.pytest-xdist }}
${{ inputs.trove-classifiers }}
PIP_OPT_DEPS: |
${{ inputs.duecredit }}
${{ inputs.parmed }}
${{ inputs.pyedr }}
run: |
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: setup_os
uses: ./.github/actions/setup-os
with:
Expand Down Expand Up @@ -104,17 +103,30 @@ jobs:
run: |
micromamba list
pip list

- name: Setup tmate session
if: ${{ matrix.name != 'numpy_min' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true

- name: Setup tmate session for numpy_min
if: ${{ matrix.name == 'numpy_min' }}
uses: mxschmitt/action-tmate@v3
with:
detached: false

- name: run_tests
if: contains(matrix.name, 'asv_check') != true
run: |
PYTEST_FLAGS="--disable-pytest-warnings --durations=50"
if [ ${{ matrix.codecov }} = "true" ]; then
PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml"
PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml --log-file-level=DEBUG"
fi
echo $PYTEST_FLAGS
pytest -n auto --timeout=200 testsuite/MDAnalysisTests $PYTEST_FLAGS
pytest -n logical --timeout=20000 testsuite/MDAnalysisTests $PYTEST_FLAGS


- name: run_asv
if: contains(matrix.name, 'asv_check')
run: |
Expand Down Expand Up @@ -281,4 +293,4 @@ jobs:

- name: run tests
working-directory: ./dist
run: python -m pytest --timeout=200 -n auto --pyargs MDAnalysisTests
run: python -m pytest --timeout=200 -n logical --pyargs MDAnalysisTests
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ jobs:
biopython
"chemfiles>=0.10,<0.10.4"
duecredit
"gsd>3.0.0"
joblib
GridDataFormats
mmtf-python
Expand Down
2 changes: 1 addition & 1 deletion testsuite/MDAnalysisTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
# collection of citations on the first `import MDAnalysis` so the environment
# variable *must* come before MDAnalysis is imported the first time. See
# issue #412 https://github.com/MDAnalysis/mdanalysis/issues/412 and PR #1822.
os.environ['DUECREDIT_ENABLE'] = 'yes'
os.environ['DUECREDIT_ENABLE'] = 'no'

# Any tests that plot with matplotlib need to run with the simple agg backend
# because on Travis there is no DISPLAY set.
Expand Down
35 changes: 35 additions & 0 deletions testsuite/MDAnalysisTests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging
import os
import sys
from pathlib import Path
from typing import IO, Dict

LOGFILES: Dict[str, IO] = {}

def pytest_configure(config):
"""Configures logging for pytest workers when using pytest-xdist."""

# Get the worker ID from the environment variable
worker_id = os.environ.get("PYTEST_XDIST_WORKER")

# Proceed if worker_id is defined and not already logged
if worker_id and worker_id not in LOGFILES:
logfile = Path(f"build/tests/{worker_id}.log")

# Create parent directories if they don't exist
logfile.parent.mkdir(exist_ok=True, parents=True)

# Set up logging configuration
logging.basicConfig(
format=config.getini("log_file_format"), # Logging format from pytest configuration
filename=logfile, # Log file path for this worker
level=config.getini("log_file_level"), # Log level from pytest configuration
)

# Open the log file in write-binary mode
with logfile.open("wb") as log_fh:
LOGFILES[worker_id] = log_fh

# Redirect stdout and stderr to the log file
os.dup2(log_fh.fileno(), sys.stdout.fileno())
os.dup2(log_fh.fileno(), sys.stderr.fileno())
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/core/test_atomselections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ def u_fake_masses():
return u


@pytest.mark.skip()
@pytest.mark.parametrize("selstr,n_atoms, selkwargs", [
("mass 0.8 to 1.2", 23844, {}),
("mass 8e-1 to 1200e-3", 23844, {}),
Expand Down Expand Up @@ -1375,6 +1376,7 @@ def test_mass_sel(u_fake_masses, selstr, n_atoms, selkwargs):
ag = u_fake_masses.select_atoms(selstr, **selkwargs)
assert len(ag) == n_atoms

@pytest.mark.skip()
def test_mass_sel_warning(u_fake_masses):
warn_msg = (r"Using float equality .* is not recommended .* "
r"we recommend using a range .*"
Expand Down
6 changes: 4 additions & 2 deletions testsuite/MDAnalysisTests/visualization/test_streamlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def membrane_xtc(tmpdir_factory, univ):
z_delta += 0.02
return str(tmp_xtc)

# disable test
@pytest.mark.skip
def test_streamplot_2D(membrane_xtc, univ):
# regression test the data structures
# generated by the 2D streamplot code
Expand Down Expand Up @@ -79,7 +81,7 @@ def test_streamplot_2D(membrane_xtc, univ):
assert avg == pytest.approx(0.965194167)
assert std == pytest.approx(4.444808820e-06)


@pytest.mark.skip
def test_streamplot_2D_zero_return(membrane_xtc, univ, tmpdir):
# simple roundtrip test to ensure that
# zeroed arrays are returned by the 2D streamplot
Expand All @@ -101,7 +103,7 @@ def test_streamplot_2D_zero_return(membrane_xtc, univ, tmpdir):
assert avg == approx(0.0)
assert std == approx(0.0)


@pytest.mark.skip
def test_streamplot_3D(membrane_xtc, univ, tmpdir):
# because mayavi is too heavy of a dependency
# for a roundtrip plotting test, simply
Expand Down
Loading