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

[docs] Disable progress bar for jupyter notebook convertion #3017

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: build docs
run: |
cd docs
export DJL_DISABLE_PROGRESS_BAR=true
mkdocs build --site-dir ../../site
- name: Configure AWS Credentials
if: github.event_name != 'pull_request'
Expand Down
8 changes: 7 additions & 1 deletion api/src/main/java/ai/djl/training/util/ProgressBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ public final class ProgressBar implements Progress {
private long progress;
private int currentPercent;
private char progressChar = getProgressChar();
private boolean disableProgressBar;

/** Creates an instance of {@code ProgressBar} with a maximum value of 1. */
public ProgressBar() {
max = 1;
disableProgressBar =
Boolean.parseBoolean(Utils.getEnvOrSystemProperty("DJL_DISABLE_PROGRESS_BAR"))
|| Boolean.getBoolean("disableProgressBar");
}

/**
Expand All @@ -43,6 +47,7 @@ public ProgressBar() {
* @param max the maximum value
*/
public ProgressBar(String message, long max) {
this();
reset(message, max);
}

Expand All @@ -55,6 +60,7 @@ public ProgressBar(String message, long max) {
* @param trailingMessage the trailing message to be shown
*/
public ProgressBar(String message, long max, String trailingMessage) {
this();
reset(message, max);
this.trailingMessage = trailingMessage;
}
Expand Down Expand Up @@ -91,7 +97,7 @@ public void increment(long increment) {
@Override
@SuppressWarnings("PMD.SystemPrintln")
public void update(long progress, String additionalMessage) {
if (Boolean.getBoolean("disableProgressBar") || max <= 1) {
if (disableProgressBar || max <= 1) {
return;
}

Expand Down
Loading