Skip to content

Commit

Permalink
progress: limit maximum running bars
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Mar 28, 2020
1 parent acdc876 commit c442e05
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dvc/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Tqdm(tqdm):
BYTES_DEFAULTS = dict(
unit="B", unit_scale=True, unit_divisor=1024, miniters=1
)
MAX_BARS = 20 # maximum parallel bars to display

def __init__(
self,
Expand Down Expand Up @@ -152,3 +153,13 @@ def format_dict(self):
d["ncols_desc"] = 1
d["prefix"] = ""
return d

def display(self, msg=None, pos=None):
if pos is None:
pos = abs(getattr(self, "pos", self.MAX_BARS))
if pos < self.MAX_BARS:
super().display(msg=msg, pos=pos)

def clear(self, nolock=False):
if abs(getattr(self, "pos", self.MAX_BARS)) < self.MAX_BARS:
super().clear(nolock=nolock)

0 comments on commit c442e05

Please sign in to comment.