Skip to content

Commit

Permalink
add print timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus1806 committed Dec 2, 2024
1 parent c7fdbe4 commit dc7923c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sisyphus/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ def file_caching(path):
PRINT_ERROR_LINES = 40
#: Print message for held jobs
PRINT_HOLD = True
#: Print State Overview even though no updates happened
PRINT_STALE_STATE_OVERVIEW_PERIOD = None

#: Log for finished outputs.
FINISHED_LOG = "log/finished.log"
Expand Down
8 changes: 7 additions & 1 deletion sisyphus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ def run(self):
return

last_state_overview = self.state_overview
time_last_update = time.time()
while self.continue_manager_loop():
finished_results_cache.write_to_file()
# Don't to anything while the manager is paused
Expand All @@ -602,11 +603,16 @@ def run(self):

if self.auto_print_stat_overview:
self.update_state_overview()
if last_state_overview != self.state_overview:
if last_state_overview != self.state_overview or (
gs.PRINT_STALE_STATE_OVERVIEW_PERIOD is not None
and time.time() - time_last_update > gs.PRINT_STALE_STATE_OVERVIEW_PERIOD
):
if self.ui:
time_last_update = time.time()
self.ui.update_job_view(self.get_job_states())
self.ui.update_state_overview(" ".join(sorted(self.state_overview)))
else:
time_last_update = time.time()
self.print_state_overview()
last_state_overview = self.state_overview

Expand Down

0 comments on commit dc7923c

Please sign in to comment.