Skip to content

Optimize WARNING_QUIT fatal-exit output#7413

Closed
Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:develop
Closed

Optimize WARNING_QUIT fatal-exit output#7413
Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:develop

Conversation

@Growl1234
Copy link
Copy Markdown

This PR makes WARNING_QUIT output better match its behavior.

WARNING_QUIT exits with a non-zero status, so the screen banner is changed from NOTICE to ERROR. It also no longer prints TIME STATISTICS after the fatal message, keeping the actual error easier to find in failed runs.

Normal QUIT() behavior is unchanged.

Copilot AI review requested due to automatic review settings May 30, 2026 19:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates error-exit handling to present failures as ERROR (instead of NOTICE) and adjusts WARNING_QUIT to skip timer/statistics output on error exits.

Changes:

  • Refactors common quit logic into a new quit_impl(ret, print_timer) helper.
  • Changes quit banner text from NOTICE to ERROR and updates multiple tests accordingly.
  • Updates unit tests to assert error visibility and absence of timer output for WARNING_QUIT.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
source/source_basis/module_pw/test/test-other.cpp Updates expected quit output substring to ERROR.
source/source_base/tool_quit.cpp Introduces quit_impl, changes quit banners to !ERROR!, and skips timer output for WARNING_QUIT.
source/source_base/test/tool_quit_test.cpp Updates expectations to look for ERROR and ensure timer stats are not printed on error exits.
source/source_base/test/tool_check_test.cpp Updates expected quit output substring to ERROR.
source/source_base/test/math_chebyshev_test.cpp Updates expected quit output substring to ERROR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/source_base/tool_quit.cpp Outdated
Comment thread source/source_base/tool_quit.cpp Outdated
std::string g_quit_out_dir;
std::string g_quit_calculation;

[[noreturn]] void quit_impl(const int ret, const bool print_timer)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recommend keeping the C++ syntax simple: just use void and avoid adding new syntax elements.


std::cout << " ---------------------------------------------------------" << std::endl;
std::cout << " !NOTICE! " << std::endl;
std::cout << " !ERROR! " << std::endl;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not always an error. We intentionally set the log level to NOTICE.

@mohanchen
Copy link
Copy Markdown
Collaborator

We prefer not to change NOTICE to ERROR. Psychologically speaking, ERROR is treated as a fault indicator, which may lead users to assume the problem stems from their own operations and create negative psychological implications.

@mohanchen
Copy link
Copy Markdown
Collaborator

We output timing data specifically to help find related errors.

@mohanchen mohanchen added the Questions Raise your quesiton! We will answer it. label May 31, 2026
@mohanchen
Copy link
Copy Markdown
Collaborator

This change targets core code. We have thought it through carefully. For similar questions, please raise an issue first.

@mohanchen mohanchen closed this May 31, 2026
@Growl1234
Copy link
Copy Markdown
Author

Growl1234 commented May 31, 2026

Thanks for the clarification. I now understand that the NOTICE banner design choices.

However, I still have doubt whether timing data is the best way to help users locate the cause of a WARNING_QUIT. The timing table is quite bulky and may weaken the visibility of the actual notice message. If the purpose is diagnostics, source-location information and a routine calling stack would be more direct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Questions Raise your quesiton! We will answer it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants