Skip to content

Improve TeeStream robustness#3588

Merged
blnicho merged 10 commits intoPyomo:mainfrom
jsiirola:tee-close-errors
May 1, 2025
Merged

Improve TeeStream robustness#3588
blnicho merged 10 commits intoPyomo:mainfrom
jsiirola:tee-close-errors

Conversation

@jsiirola
Copy link
Copy Markdown
Member

Fixes #3587 .

Summary/Motivation:

Recent testing and issues (e.g., #3587) have highlighted some ongoing fragility in the TeeStream / capture_output machinery. This PR addresses some of those errors, in particular:

Changes proposed in this PR:

  • explicitly close all file descriptors we open (work around Python bug with os.fdopen?)
  • avoid exceptions when TeeStream is closed multiple times
  • improve test coverage

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

blnicho
blnicho previously approved these changes Apr 30, 2025
@blnicho blnicho dismissed their stale review April 30, 2025 20:36

Looks like I reviewed this while tests are still being debugged. I'll review again once everything is passing.

self.flush()


class _fd_closer(object):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

snark

@blnicho blnicho merged commit 32591c1 into Pyomo:main May 1, 2025
88 of 91 checks passed
@jsiirola jsiirola deleted the tee-close-errors branch June 13, 2025 18:47
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.

OSError with HiGHS when solving and updating model params multiple times

3 participants