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

Resolve buffering issues in TeeStream and capture_output #3449

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jsiirola
Copy link
Member

Fixes #3084, fixes #3031, fixes #2845.

Summary/Motivation:

The HiGHS interface exposed some issues in the logic in TeeStream and capture_output where the two could end up fighting with each other. This PR should resolve all issues with console log management that we have been seeing with HiGHS.

Changes proposed in this PR:

  • Ensure that flushing a TeeStream handle is propagated through tho the target output streams
  • Allow passing a TeeStream to capture_output to prevent ending up with nested TeeStream instances
  • TeeStream should dup all target file descriptors so that subsequent context managers (like capture_output) don't commandeer them (causing a weird circular reference loop)
  • Update how capture_output handles redirection (do not let redirect_fd update the sys.stdout / sys.stderr streams)
  • Add tests for buffered and unbuffered output through TeeStream (and capture_output)
  • Update all solver interfaces to standardize how we use capture_output / TeeStream for managing the console output.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant