示例#1
0
 def render(self, task):
     speed = task.speed
     if speed is None:
         return Text(f"0{self.unit}/s", style="progress.remaining")
     self.avg_speed = ema(speed, self.avg_speed, self.smoothing)
     return Text(f"{self.avg_speed:>3.2f}{self.unit}/s",
                 style="progress.remaining")
示例#2
0
 def render(self, task):
     remaining = task.time_remaining
     if remaining is None:
         return Text("--m:--s<--m:--s", style="progress.remaining")
     self.avg_elapsed_seconds = ema(task.elapsed, self.avg_elapsed_seconds,
                                    self.smoothing)
     self.avg_remaining_seconds = ema(remaining, self.avg_remaining_seconds,
                                      self.smoothing)
     elapsed_delta = self.format_seconds(self.avg_elapsed_seconds)
     remaining_delta = self.format_seconds(self.avg_remaining_seconds)
     return Text(f"{elapsed_delta}<{remaining_delta}",
                 style="progress.remaining")
示例#3
0
 def render(self, task):
     """Show data transfer speed."""
     speed = task.speed
     if speed is None:
         return Text(f"? {self.unit}/s", style="progress.data.speed")
     if self.unit_scale:
         unit, suffix = filesize.pick_unit_and_suffix(
             speed,
             ["", "K", "M", "G", "T", "P", "E", "Z", "Y"],
             self.unit_divisor,
         )
     else:
         unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1)
     precision = 0 if unit == 1 else 1
     return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s",
                 style="progress.data.speed")
示例#4
0
 def render(self, task):
     items = []
     items.append(f"{self.time_elapsed(task)}<{self.time_estimated(task)}")
     if task.speed is not None:
         items.append(f"{task.speed:>.2f}it/s")
     items.append(self.bar_dict(task.fields))
     return Text("[%s]" % ", ".join(items))
示例#5
0
 def render(self, task):
     """Calculate common unit for completed and total."""
     completed = int(task.completed)
     total = int(task.total)
     if self.unit_scale:
         unit, suffix = filesize.pick_unit_and_suffix(
             total,
             ["", "K", "M", "G", "T", "P", "E", "Z", "Y"],
             self.unit_divisor,
         )
     else:
         unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1)
     precision = 0 if unit == 1 else 1
     return Text(
         f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}",
         style="progress.download")
示例#6
0
文件: util.py 项目: ssl-hep/coffea
 def render(self, task: Any) -> Text:
     """Show data transfer speed."""
     speed = task.finished_speed or task.speed
     if speed is None:
         return Text("?", style="progress.data.speed")
     return Text(f"{speed:{self.fmt}}", style="progress.data.speed")
示例#7
0
 def render(self, task):
     return Text(f"已处理 {int(task.completed)} / 共 {int(task.total)} 个文件",
                 style="progress.download")
 def render(self, task: "Task") -> Text:
     """Show data transfer speed."""
     speed = task.speed
     if speed is None:
         return Text("?", style="progress.data.speed")
     return Text(f"{speed:2.2f} it/s", style="progress.data.speed")