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

io: allow setting progress=False in solver to disable stdout even for larger models #375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maurerle
Copy link
Contributor

@maurerle maurerle commented Nov 7, 2024

This was unnecessary when solving a lot of problems programatically.

The log param of the solve function does have three states:

  • None: log tqdm to stdout if model is > 10k constraints
  • True: always creates tqdm for model
  • False: never creates tqdm for model

For better usage, the log param is renamed to progress on all occurrences

Copy link
Member

@lkstrp lkstrp left a comment

Choose a reason for hiding this comment

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

Looks good, thank you @maurerle
A few minor things left on types and docstrings.

linopy/io.py Outdated Show resolved Hide resolved
linopy/io.py Outdated Show resolved Hide resolved
linopy/io.py Outdated Show resolved Hide resolved
linopy/model.py Outdated Show resolved Hide resolved
@maurerle maurerle force-pushed the allow_suppress_stdout branch 3 times, most recently from b1e17cf to 303585a Compare November 7, 2024 13:27
@maurerle maurerle requested a review from lkstrp November 7, 2024 13:28
@maurerle maurerle changed the title allow setting stdout=False in solver to disable stdout even for larger models allow setting progress=False in solver to disable stdout even for larger models Nov 11, 2024
@maurerle
Copy link
Contributor Author

Looks good from my side now, @lkstrp can you take another look please? :)

@maurerle maurerle changed the title allow setting progress=False in solver to disable stdout even for larger models io: allow setting progress=False in solver to disable stdout even for larger models Nov 11, 2024
Copy link
Member

@lkstrp lkstrp left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!
Two last things:

  • Release note is missing
  • We can deprecate log instead of removing it. So accept both log and progress, and throw a DeprecationWarning when log is passed. There is a decorator for this somewhere, I can add it if you don't mind. It may be unnecessary, but I think it's better practice.

@maurerle
Copy link
Contributor Author

If you add the remarks yourself, that would be great!
You should be able to push to my branch

From my point of view, the deprecation is not really necessary as there did not exist a public api to set log before anyway.

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.

2 participants