Skip to content

Commit 03c69d9

Browse files
committed
Set FSLOUTPUTTYPE in container env, drop styxcache bypass workaround
The nightly surfaced a real latent bug once we got container stderr flowing: lta_convert's FSL output path exits non-zero with "ERROR: trying to convert FreeSurfer registration matrix to FSL, but FSLOUTPUTTYPE variable is not set." The default env dict only injected ITK threads, ANTs seed, and SURFER_SIDEDOOR; nothing set the FSL output type, which FreeSurfer (and FSL) reads to decide what filesystem format to emit. Adding FSLOUTPUTTYPE=NIFTI_GZ is idiomatic FSL default behavior and is ignored by non-FSL tools, so applying it globally is safe. Also: - Bump styx-runtime-py packages: styxpodman 0.1.1->0.2.0 (carries the fix from styx-api/styx-runtime-py#9 that surfaces container stderr through the cache wrapper on failure), plus siblings. - Drop the bypass_cache kwarg and RBC_STYXCACHE_DIR clearing from the template fixture. With the new styxpodman, the raw tool stderr now reaches the parent subprocess even through the cache wrapper, so the workaround is obsolete and we can keep the cache speedup on this invocation too.
1 parent 65cbc97 commit 03c69d9

3 files changed

Lines changed: 21 additions & 34 deletions

File tree

src/rbc/orchestration/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
_DEFAULT_ENV_VARS = {
2525
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS": "1",
2626
"ANTS_RANDOM_SEED": CPAC_ANTS_SEED,
27+
# Required by any FreeSurfer tool that emits FSL-format output
28+
# (e.g. lta_convert --outfsl): without it FS exits non-zero with
29+
# "FSLOUTPUTTYPE variable is not set". Harmless for tools that
30+
# ignore it. NIFTI_GZ matches FSL's conventional default.
31+
"FSLOUTPUTTYPE": "NIFTI_GZ",
2732
}
2833

2934

tests/integration/longitudinal/conftest.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from __future__ import annotations
99

10-
import os
1110
import shutil
1211
import subprocess
1312
from pathlib import Path
@@ -35,30 +34,19 @@ def _rbc_exe() -> str:
3534

3635

3736
def _run_rbc(
38-
args: Sequence[str], *, timeout: int = 7200, bypass_cache: bool = False
37+
args: Sequence[str], *, timeout: int = 7200
3938
) -> subprocess.CompletedProcess[str]:
4039
"""Invoke ``rbc`` with ``-vv`` so container output reaches the subprocess.
4140
4241
Without ``-vv`` the styx runner logger stays at WARNING and
4342
container-side output never makes it into the captured stderr, which
4443
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.
5144
"""
52-
env = os.environ.copy()
53-
if bypass_cache:
54-
env.pop("RBC_STYXCACHE_DIR", None)
55-
5645
result = subprocess.run( # noqa: S603
5746
[_rbc_exe(), *args, "-vv"],
5847
capture_output=True,
5948
text=True,
6049
timeout=timeout,
61-
env=env,
6250
)
6351
assert result.returncode == 0, (
6452
f"rbc {args[0]} exited with code {result.returncode}\n"
@@ -158,11 +146,5 @@ def longitudinal_template_output(
158146
"--participant-label",
159147
_SUB,
160148
],
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-
# TODO: drop once styx-api/styx-runtime-py#9 lands and surfaces
165-
# container stderr through the cache wrapper.
166-
bypass_cache=True,
167149
)
168150
return ds000114_anat_derivatives

uv.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)