Skip to content

Commit 5c45d32

Browse files
committed
Bypass styxcache for template subprocess, dump full stderr on failure
Two diagnostic improvements after another silent lta_convert exit-1: - styxcache's tee handlers route container stdout/stderr into an internal gzip buffer that's discarded on exception, so the failing niwrap call under cache leaves no diagnostic trail reaching our captured subprocess stderr. Thread a bypass_cache kwarg through _run_rbc and set it on longitudinal_template_output so we get raw podman stderr passthrough. The anat fixture still caches (keeps the ~90 min speedup) so the tradeoff is tiny. - Drop the stderr tail truncation. 4000 chars was losing the middle of the captured stream between "Executed first iteration" and the traceback — exactly where container stderr would be if it existed. Full dump on failure is a few KB at most, cheap.
1 parent 0bc2517 commit 5c45d32

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

tests/integration/longitudinal/conftest.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import annotations
99

10+
import os
1011
import shutil
1112
import subprocess
1213
from pathlib import Path
@@ -34,25 +35,35 @@ def _rbc_exe() -> str:
3435

3536

3637
def _run_rbc(
37-
args: Sequence[str], *, timeout: int = 7200
38+
args: Sequence[str], *, timeout: int = 7200, bypass_cache: bool = False
3839
) -> subprocess.CompletedProcess[str]:
3940
"""Invoke ``rbc`` with ``-vv`` so container output reaches the subprocess.
4041
4142
Without ``-vv`` the styx runner logger stays at WARNING and
42-
container-side failure output (e.g. lta_convert exiting non-zero with
43-
its own error text) never makes it into the captured stderr, which
43+
container-side output never makes it into the captured stderr, which
4444
leaves the test with only a bare ``returncode=1`` to diagnose from.
45+
46+
Set ``bypass_cache=True`` to run with ``RBC_STYXCACHE_DIR`` cleared.
47+
styxcache's tee handlers swallow container stderr into an internal
48+
gzip that's discarded on exception, so a failing niwrap call under
49+
cache leaves no diagnostic trail; bypassing cache restores raw
50+
podman stderr passthrough.
4551
"""
52+
env = os.environ.copy()
53+
if bypass_cache:
54+
env.pop("RBC_STYXCACHE_DIR", None)
55+
4656
result = subprocess.run( # noqa: S603
4757
[_rbc_exe(), *args, "-vv"],
4858
capture_output=True,
4959
text=True,
5060
timeout=timeout,
61+
env=env,
5162
)
5263
assert result.returncode == 0, (
5364
f"rbc {args[0]} exited with code {result.returncode}\n"
54-
f"--- stdout ---\n{result.stdout[-4000:]}\n"
55-
f"--- stderr ---\n{result.stderr[-4000:]}"
65+
f"--- stdout ---\n{result.stdout}\n"
66+
f"--- stderr ---\n{result.stderr}"
5667
)
5768
return result
5869

@@ -147,5 +158,9 @@ def longitudinal_template_output(
147158
"--participant-label",
148159
_SUB,
149160
],
161+
# Template generation is still returning silent non-zero on the
162+
# nightly; cache-bypass here gives us raw container stderr on
163+
# failure without losing the anat fixture's cache benefit.
164+
bypass_cache=True,
150165
)
151166
return ds000114_anat_derivatives

0 commit comments

Comments
 (0)