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

add tqdm disabling option #689

Merged
merged 3 commits into from
Aug 26, 2024
Merged

add tqdm disabling option #689

merged 3 commits into from
Aug 26, 2024

Conversation

maxwest-uw
Copy link
Collaborator

resolves #688

also adds the progress bar to the lazy work unit reprojection changes (which weren't merged at the time of the original pr 😅 )

Copy link
Member

@DinoBektesevic DinoBektesevic left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround. This all looks fine to me, but I do have one request.

Can you make a global var in top-level init something like:

PROGRESS_BAR=True

and then make

disable_progress=kbmod.PROGRESS_BAR

so that I can

import kbmod
kbmod.PROGRESS_BARS = False

and turn them all off at once.

Bonus points if you set the default value as:

PROGRESS_BARS = bool(os.environ.get("KB_PROGRESS_BARS", True)

so that I can also set the KB_PROGRESS_BARS env to a falsy value in the running scripts instead of having to repeat it in every task after import.

EDIT: this last request won't work because env will return a string. You can still do something like:

$ ~: export KB_PROGRESS_BARS=1 or 0
# in python
>>> bool(int(os.environ.get("KB_PROGRESS_BARS", 1))

or just an if a = os.environ.get("KB_PROGRESS_BARS", False); PROGRESS_BARS = a if a else True

@maxwest-uw
Copy link
Collaborator Author

part one of your request (being able to set PROGRESS_BAR at runtime) doesn't seem to work, as the downstream import in WorkUnit only ever seems to load what it was initially

@DinoBektesevic
Copy link
Member

Importing it will make a copy of the variable and then keep it in the module's global namespace. You have to get your values from where they're defined. I rejiggered the global variable access and removed some unused imports. This seems to work fine for me now, perhaps double check.

@maxwest-uw
Copy link
Collaborator Author

looks good to me (can I say that on my on pr? 😭 )

@DinoBektesevic
Copy link
Member

Merge it then :D

@maxwest-uw maxwest-uw merged commit a8e9663 into main Aug 26, 2024
2 checks passed
@maxwest-uw maxwest-uw deleted the issue/688 branch August 26, 2024 19:36
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.

progress bars should be optional
2 participants