Skip to content

fix: report the real cluster error instead of "check LOG" - #114

Open
tabedzki wants to merge 1 commit into
masterfrom
claude/vr-rigs-error-propagation-af1276
Open

fix: report the real cluster error instead of "check LOG"#114
tabedzki wants to merge 1 commit into
masterfrom
claude/vr-rigs-error-propagation-af1276

Conversation

@tabedzki

@tabedzki tabedzki commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖

Problem

When a slurm job failed, both the recording-process pipeline and the pupillometry pipeline set the error message to An error occured in processing (check LOG). The slack notification therefore said nothing about what went wrong, and the log it referred to was never named — finding the failure meant manually locating the right job_id_<n>.log.

What changed

The error log is now parsed and the actual error is reported:

error message : Job failed - MemoryError: Unable to allocate 30.0 GiB for an array (LOG: /logs/job_id_1234.log)
  • summarize_error_log() picks the most informative line of the log: the last line matching an error pattern (*Error/*Exception, failed, no such file, out of memory, time limit, …), falling back to the last line. Python/MATLAB tracebacks end with the exception; Kilosort writes plain messages to stderr and keeps logging afterwards, so the last line alone is not enough.
  • build_error_message() assembles <slurm status> - <error from log> (LOG: <path>), sized to fit the 255-char DB column with the path intact.
  • Both live in u19_pipeline/utils/file_utils.py (they only need re), so they are importable and testable without the pipeline extra.
  • The log-path logic inside transfer_log_file() is factored into get_log_file_local_path() / get_log_file_cluster_path(), so the reported path is always the same file that was transferred. No behavior change there.
  • If the log could not be copied from the cluster or is empty, the message says so and points at the log on the cluster (user@host:path) rather than a local path that does not exist. error_exception gets that note too, instead of being blank.
  • check_processed_pupillometry_sessions() reported no log at all (only the slurm state message). It now copies ErrorLog/job_id_<video stem>.log from spock and reports it the same way.

Tests

tests/automatic_job/test_error_log_reporting.py covers the summary (traceback, trailing noise after the error line, no error keyword, empty log, over-long line, the space-joined form get_error_log_str produces) and the message building (path always present, 255-char cap, over-long path cropped from the left keeping the job id).

uv run pytest tests/automatic_job -q

10 passed. The pipeline paths themselves (scp of the log, slurm status) were not exercised — that needs DB and cluster access.

Assisted-by: ClaudeCode:claude-opus-5

🤖 Generated with Claude Code

When a slurm job failed, the pipeline set the error message to
"An error occured in processing (check LOG)", which forced a manual
hunt through the cluster logs to find out what actually went wrong.

The error log is now parsed and the most informative line (the
exception of a traceback, or the last line matching an error pattern)
is reported in the DB record and in the slack notification, together
with the path of the log it came from. If the log cannot be copied
from the cluster or is empty, the message says so and points at the
log path on the cluster (user@host:path) instead.

- add summarize_error_log() and build_error_message() to file_utils,
  the message is sized to fit the 255 char DB column while keeping
  the log path intact
- factor the log path logic of transfer_log_file() into
  get_log_file_local_path() / get_log_file_cluster_path() so the
  reported path always matches the transferred file
- the pupillometry job check reported no log at all; it now copies
  the spock error log over and reports it the same way
- add unit tests for the log summary and message building

Assisted-by: ClaudeCode:claude-opus-5

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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