Commit 3b133772 authored by Dion Häfner's avatar Dion Häfner

🐛

parent e603be4a
......@@ -60,7 +60,11 @@ class LoggingProgressBar:
rate, rate_unit = time.format_time(rate_in_seconds_per_year)
eta, eta_unit = time.format_time((self._total - self._time) * rate_in_seconds)
percentage = 100 * (self._time - self._start_time) / (self._total - self._start_time)
if self._start_time < self._total:
percentage = 100 * (self._time - self._start_time) / (self._total - self._start_time)
else:
percentage = 100
logger.info(
BAR_FORMAT,
......@@ -96,12 +100,18 @@ class FancyProgressBar:
def format_dict(other):
report_time = time.convert_time(self._time, 'seconds', self._time_unit)
total_time = time.convert_time(self._total, 'seconds', self._time_unit)
percentage = 100 * (self._time - self._start_time) / (self._total - self._start_time)
if self._start_time < self._total:
percentage = 100 * (self._time - self._start_time) / (self._total - self._start_time)
else:
percentage = 100
d = super().format_dict
if d['elapsed'] > 0:
rate_in_seconds = d['elapsed'] / (self._time - self._start_time)
if self._time > self._start_time:
rate_in_seconds = d['elapsed'] / (self._time - self._start_time)
else:
rate_in_seconds = 0
rate_in_seconds_per_year = rate_in_seconds / time.convert_time(1, 'seconds', 'years')
rate, rate_unit = time.format_time(rate_in_seconds_per_year)
eta, eta_unit = time.format_time((self._total - self._time) * rate_in_seconds)
......
......@@ -17,6 +17,8 @@ class DistributedVerosState(VerosState):
"""Gather given variables from parent state object"""
from .distributed import gather
for arr in arrays:
if not hasattr(self._vs, arr):
continue
self._gathered.add(arr)
logger.trace(' Gathering {}', arr)
gathered_arr = gather(
......@@ -30,6 +32,8 @@ class DistributedVerosState(VerosState):
"""Sync all changes with parent state object"""
from .distributed import scatter
for arr in sorted(self._gathered):
if not hasattr(self._vs, arr):
continue
logger.trace(' Scattering {}', arr)
getattr(self._vs, arr)[...] = scatter(
self._vs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment