Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flush streams and files before/after optimization #403

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Conversation

ewu63
Copy link
Collaborator

@ewu63 ewu63 commented May 29, 2024

Purpose

The idea is that,

  1. we flush stdout and stderr before calling the optimizer, in case prints from the runscript are buffered
  2. we flush the output files (which could also be streams) after the end of the optimization, so that stuff printed in the runscript after do not get mixed.

I know we can and should do this for all optimizers, I actually tried to refactor some stuff into "pre-optimization" and "post-optimization" functions shared across all optimizers. But, I stumbled across #402 which means I couldn't actually verify what I was doing with the dummyConstraint was not introducing bugs. We can come back to it after that stuff is all cleaned up.

Expected time until merged

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@ewu63 ewu63 marked this pull request as ready for review May 29, 2024 23:38
@ewu63 ewu63 requested a review from a team as a code owner May 29, 2024 23:38
@ewu63 ewu63 requested review from lamkina and sseraj May 29, 2024 23:38
Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.33%. Comparing base (4ed7ce9) to head (d38db51).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pyoptsparse/pySNOPT/pySNOPT.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #403      +/-   ##
==========================================
+ Coverage   74.15%   74.33%   +0.17%     
==========================================
  Files          22       22              
  Lines        3297     3300       +3     
==========================================
+ Hits         2445     2453       +8     
+ Misses        852      847       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ewu63
Copy link
Collaborator Author

ewu63 commented Jun 4, 2024

@sseraj @lamkina

Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

LGTM, I will take a look at the other PR, let's talk offline

@marcomangano marcomangano merged commit 7a33d77 into main Jun 5, 2024
13 checks passed
@marcomangano marcomangano deleted the flush-stdout branch June 5, 2024 15:56
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.

3 participants