fix: report the real cluster error instead of "check LOG" - #114
Open
tabedzki wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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 rightjob_id_<n>.log.What changed
The error log is now parsed and the actual error is reported:
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.u19_pipeline/utils/file_utils.py(they only needre), so they are importable and testable without thepipelineextra.transfer_log_file()is factored intoget_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.user@host:path) rather than a local path that does not exist.error_exceptiongets that note too, instead of being blank.check_processed_pupillometry_sessions()reported no log at all (only the slurm state message). It now copiesErrorLog/job_id_<video stem>.logfrom spock and reports it the same way.Tests
tests/automatic_job/test_error_log_reporting.pycovers the summary (traceback, trailing noise after the error line, no error keyword, empty log, over-long line, the space-joined formget_error_log_strproduces) and the message building (path always present, 255-char cap, over-long path cropped from the left keeping the job id).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