feat: enhance error handling from terminal output for MAPDL launch - #3969
Merged
Conversation
Contributor
|
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Contributor
Reviewer's GuideThis PR improves the MAPDL launch workflow by capturing and persisting full terminal output (stdout and stderr), refactoring how output is collected, and providing user-friendly error handling with new exception types. Sequence Diagram: Retrieving Full Stdout/Stderr in
|
| Change | Details | Files |
|---|---|---|
| Enhance error message composition with stderr |
|
launcher.py |
| Refactor standard‐output retrieval to return aggregated text |
|
launcher.py |
| Introduce QueueWithPermanentStorage to preserve all output |
|
launcher.py |
| Add handle_launch_exception for custom launch errors |
|
launcher.py |
| Define specialized exceptions for MPI and license issues |
|
errors.py |
| Fix typo and improve server-alive check stability |
|
launcher.py |
Assessment against linked issues
| Issue | Objective | Addressed | Explanation |
|---|---|---|---|
| #3963 | Catch and report license errors from the MAPDL process terminal when no licenses are available. | ✅ |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summaryon the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Contributor
There was a problem hiding this comment.
Hey @germa89 - I've reviewed your changes - here's some feedback:
- QueueWithPermanentStorage only overrides get(), but _get_std_output uses get_nowait(), so storage_text will always be empty—either override get_nowait or record items on put to ensure you capture everything.
- The helper _get_std_output now returns a single string instead of a List[str] yet its name, signature, and docstring weren’t updated—please revise those or rename the function for clarity.
- There’s duplicated logic building the stderr/stdout error message in check_mapdl_launch—consider extracting that into a shared helper to ensure consistent formatting.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
… instance management
…ge formatting for MAPDL launch
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
…prove error handling
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3969 +/- ##
==========================================
+ Coverage 88.25% 89.11% +0.85%
==========================================
Files 187 187
Lines 14935 14968 +33
==========================================
+ Hits 13181 13338 +157
+ Misses 1754 1630 -124 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@pyansys-ci-bot LGTM. |
germa89
enabled auto-merge (squash)
June 2, 2025 15:02
Closed
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.

Description
As the title. Now we also consider the stderr output before raising an error.
Implemented class
QueueWithPermanentStoragewhich allows for checking the full output for both stdout and stderr.Issue linked
Close #3963
Checklist
draftif it is not ready to be reviewed yet.feat: adding new MAPDL command)Summary by Sourcery
Enhance MAPDL launch error handling by capturing and persisting both stdout and stderr outputs and mapping common launch failures to user-friendly exceptions.
New Features:
Bug Fixes:
Enhancements:
Documentation: