Skip to content

Fail the run when an R statistics step fails or times out; draw PAC mosaics - #4

Merged
alexedmon1 merged 1 commit into
mainfrom
fix/r-step-failures
Sep 11, 2026
Merged

alexedmon1 merged 1 commit into
mainfrom
fix/r-step-failures

Conversation

@alexedmon1

Copy link
Copy Markdown
Owner

Summary

  • A failed or timed-out R statistics step now fails the run (RStepFailed, exit 1). A paradigm-wide run finishes its other modules first, then lists what failed.
  • No default R time limit. Limits were hard-coded at 3600 s, or 600 s for the electrode and evoked modules. r_timeout_sec in a module's config block sets one.
  • roi_cross_freq attempts PAC and AAC/PPC before failing, so one tier failing no longer costs the other its tables.
  • PAC mosaics are drawn. The call named columns the native table doesn't have, so none was ever drawn. The figures pass now draws them.

Why

On the FORGE treatment re-run (v0.7.0), four R steps were killed at exactly 3600 s, logged, and exited 0:

step arm(s) effect
roi_directed cartesian MC, shell MC, ROI-based region tier left at the pre-fix 8 categories (or never written)
roi_cross_freq AAC/PPC cartesian MC …_aac_region_hypotheses.csv left at 8 categories

Only a manual check of the outputs caught it. Run uncapped on an idle machine, the same steps got through their heavy edge tier in about 10 minutes. So the kills came from the limit combined with three arms running concurrently, which is exactly the situation a fixed limit can't anticipate.

Behaviour changes

  • Batch scripts that relied on exit 0 despite R failures will now see exit 1. That's the point, but worth knowing.
  • A missing Rscript still only logs, as before. The figures-only limit (300 s) is unchanged.
  • The three vertex modules lose their limit but still only log a failure; that's left for the vertex split.

Test plan

  • PYTHONPATH=src pytest tests: 230 passed (8 new)
  • After merge: tag v0.7.1, re-run roi_directed (3 arms) and roi_cross_freq (cartesian) summary steps, and confirm 10/10 categories

🤖 Generated with Claude Code

https://claude.ai/code/session_01RibM8Zep2YEjjUbc2LLkgj

On the FORGE treatment re-run, roi_directed (in all three source arms) and
roi_cross_freq's AAC/PPC tier were killed by a hard-coded one-hour R timeout.
Each module logged it and the command exited 0, so region tables from the
previous code version went on looking current. Only checking the outputs
found it.

  - R statistics steps have no default time limit. They were hard-coded to
    3600 s, or 600 s for the electrode and evoked modules; r_timeout_sec in a
    module's config block sets one.
  - A failed or timed-out step raises RStepFailed and the CLI exits 1. A run
    over a paradigm, or over every paradigm, finishes its other modules first
    and then lists what failed. A missing Rscript still only logs, as before.
  - roi_cross_freq attempts PAC and AAC/PPC before failing, so one tier failing
    does not cost the other its tables.
  - roi_cross_freq's PAC mosaics named legacy columns (hedges_g, region,
    contrast, freq_pair) that the native table does not have, so none was ever
    drawn. They now read effect_size / spatial / hypothesis / band, and the
    figures step draws them (summary() did only when figures were requested in
    the same run).

The three vertex modules lose their limit too but still only log a failure;
that is left for the vertex split.

Tests: 230 pass (8 new), covering the missing default, a configured limit, a
timeout and a failure each raising, both cross-frequency tiers attempted, the
PAC mosaic columns and figures pass, and the CLI finishing a batch before
exiting 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RibM8Zep2YEjjUbc2LLkgj
@alexedmon1
alexedmon1 merged commit 86ed73f into main Sep 11, 2026
2 checks passed
alexedmon1 added a commit that referenced this pull request Sep 11, 2026
A failed or timed-out R statistics step now fails the run, R steps have no
default time limit (r_timeout_sec sets one), and roi_cross_freq draws its PAC
mosaics (#4).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RibM8Zep2YEjjUbc2LLkgj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant