Skip to content

Commit

Permalink
Update progress logging logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayP13 committed Dec 24, 2023
1 parent 8859ee1 commit f2f1701
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .cluster/_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ device-requirements-files-exist() {
install-device-requirements() {
if [ -f "$1.txt" ]; then
:
python3 -m pip install --upgrade pip
pip3 install -r src/requirements.txt -r "$1.txt" -r src/requirements-test.txt
# python3 -m pip install --upgrade pip
# pip3 install -r src/requirements.txt -r "$1.txt" -r src/requirements-test.txt
fi
if [ -f "$1.sh" ]; then
chmod +x ./"$1".sh
Expand Down
6 changes: 5 additions & 1 deletion src/steps/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__( # noqa: C901
self.__progress: None | float = None
self.__progress_rows: None | int = None
self.__progress_logging_rows: bool = False
self.__progress_logged: bool = False
self.progress_interval: None | int = progress_interval
self.progress_start = time()
self.progress_last = time()
Expand Down Expand Up @@ -684,13 +685,15 @@ def progress(self, value: float):
value = max(min(value, 1.0), prev_progress)
should_log = False
if (
self.progress_interval is not None
(self.__progress_logged or value < 1.0)
and self.progress_interval is not None
and (time() - self.progress_last) > self.progress_interval
and value > prev_progress
and (not self.__progress_logging_rows or value < 1.0)
):
should_log = True
self.progress_last = time()
self.__progress_logged = True
self.__progress = value
if should_log:
eta = progress_eta(self.__progress, self.progress_start)
Expand Down Expand Up @@ -719,6 +722,7 @@ def _set_progress_rows(self, value: int):
should_log = True
self.__progress_logging_rows = True
self.progress_last = time()
self.__progress_logged = True
self.__progress_rows = value
if should_log:
logger.info(
Expand Down

0 comments on commit f2f1701

Please sign in to comment.