feat: always save log file on error#142
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automatic temporary log-file creation to inference runs and ensures the log is preserved when inference fails, improving debuggability without requiring users to explicitly pass a log_file.
Changes:
InferenceSetupnow always attaches a log file handler; whenlog_fileis not provided it creates a temporarybrats_*.log, deletes it on success, and preserves it (printing its path to stderr) on error.- Adds/updates unit tests to verify temp-log cleanup on success and preservation on failure.
- Improves container error visibility by printing container output to stderr and updating the raised exception message.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/utils/test_data_handling.py | Adds tests asserting temp-log cleanup on success and preservation on error. |
| brats/utils/data_handling.py | Implements automatic temp-log creation and conditional cleanup/preservation in InferenceSetup. |
| brats/core/docker.py | Prints container failure output to stderr and updates the exception guidance message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PaulaTBz
approved these changes
May 12, 2026
Collaborator
PaulaTBz
left a comment
There was a problem hiding this comment.
this feature exactly tackles the problem of the related issue and provides robust logging that requires no action from the user, which makes it very convenient in the case of failure and greatly improves logging
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.
Addressing #139