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

Refactor progress bars #1272

Merged
merged 2 commits into from
Jan 9, 2024
Merged

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Jan 8, 2024

tqdm progress bars are used in a couple of places. They don't play so well in non-interactive jobs, testing, ... . They also cause trouble with nbspinx (#1246, #1271).
Progress bars can be disabled for specific tasks, but not globally (or at least not very conveniently).
Since recently, tqdm can be controlled via environment variables (e.g., disabling all progress bars or changing update frequency). However, this works by changing the argument defaults, so it only works if we don't pass explicit disable=.... Therefore, this PR introduces some wrapper that checks whether the user explicitly enabled/disabled progress bars. If not, we go with the tqdm default, which means showing all progress bars unless globally disabled. An additional enabled argument is added for convenience.

tqdm progress bars are used in a couple of places. They don't play so well in
non-interactive jobs, testing, ... . They also cause trouble with nbspinx
(ICB-DCM#1246, ICB-DCM#1271).
Progress bars can be disabled for specific tasks, but not globally (or at
least not very conveniently).
Since recently, tqdm can be controlled via environment variables (e.g.,
disabling all progress bars or changing update frequency). However,
this works by changing the argument defaults, so it only works if we don't
pass explicit `disable=...`. Therefore, this PR introduces some wrapper that
checks whether the user explicitly enabled/disabled progress bars. If not,
we go with the tqdm default, which means showing all progress bars unless
globally disabled. An additional `enabled` argument is added for convenience.
@dweindl dweindl marked this pull request as ready for review January 8, 2024 18:29
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6366ecf) 84.60% compared to head (98c287f) 84.59%.

Files Patch % Lines
pypesto/engine/mpi_pool.py 0.00% 1 Missing ⚠️
pypesto/util.py 90.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1272      +/-   ##
===========================================
- Coverage    84.60%   84.59%   -0.02%     
===========================================
  Files          148      148              
  Lines        12112    12122      +10     
===========================================
+ Hits         10247    10254       +7     
- Misses        1865     1868       +3     

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

@dweindl dweindl self-assigned this Jan 8, 2024
Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

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

👍

pypesto/util.py Outdated Show resolved Hide resolved
Co-authored-by: Dilan Pathirana <59329744+dilpath@users.noreply.github.com>
dweindl added a commit to dweindl/pyPESTO that referenced this pull request Jan 9, 2024
A subset of ICB-DCM#1246.

After ICB-DCM#1272.

Co-authored-by: Doresic <domagoj.doresic@gmail.com>
Copy link
Contributor

@vwiela vwiela 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 to me.

@dweindl dweindl merged commit e389257 into ICB-DCM:develop Jan 9, 2024
18 checks passed
@dweindl dweindl deleted the refactor_progressbar branch January 9, 2024 08:49
dweindl added a commit to dweindl/pyPESTO that referenced this pull request Jan 9, 2024
A subset of ICB-DCM#1246.

After ICB-DCM#1272.

Co-authored-by: Doresic <domagoj.doresic@gmail.com>
This was referenced Jan 30, 2024
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.

4 participants