Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/dvsim/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def __init__(

# Print status periodically using an external status printer.
self._status_printer = get_status_printer(interactive)
self._status_printer.print_header(
msg="Q: queued, D: dispatched, P: passed, F: failed, K: killed, T: total",
)
self._status_printer.print_header()

# Sets of items, split up by their current state. The sets are
# disjoint and their union equals the keys of self.item_status.
Expand Down
17 changes: 11 additions & 6 deletions src/dvsim/utils/status_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

from dvsim.logging import log

DEFAULT_HEADER = "Q: queued, D: dispatched, P: passed, F: failed, K: killed, T: total"
"""The default header to use for printing the status."""


class StatusPrinter:
"""Dummy Status Printer class for interactive mode.
Expand All @@ -23,7 +26,7 @@ class StatusPrinter:
def __init__(self) -> None:
"""Initialise."""

def print_header(self, msg: str) -> None:
def print_header(self) -> None:
"""Initialize / print the header bar.

The header bar contains an introductory message such as the legend of
Expand Down Expand Up @@ -84,13 +87,13 @@ def __init__(self) -> None:
# than in the Scheduler class.
self.target_done = {}

def print_header(self, msg: str) -> None:
def print_header(self) -> None:
"""Initialize / print the header bar.

The header bar contains an introductory message such as the legend of
what Q, D, ... mean.
"""
log.info(self.header_fmt.format(hms="", target="legend", msg=msg))
log.info(self.header_fmt.format(hms="", target="legend", msg=DEFAULT_HEADER))

def init_target(self, target: str, msg: str) -> None:
"""Initialize the status bar for each target."""
Expand Down Expand Up @@ -161,12 +164,12 @@ def __init__(self) -> None:
self.status_header = None
self.status_target = {}

def print_header(self, msg) -> None:
def print_header(self) -> None:
self.status_header = self.manager.status_bar(
status_format=self.header_fmt,
hms="",
target="legend",
msg="Q: queued, D: dispatched, P: passed, F: failed, K: killed, T: total",
msg=DEFAULT_HEADER,
)

def init_target(self, target, msg) -> None:
Expand Down Expand Up @@ -195,9 +198,11 @@ def update_target(self, target, hms, msg, perc, running) -> None:

def exit(self) -> None:
"""Do cleanup activities before exiting."""
self.status_header.close()
if self.status_header is not None:
self.status_header.close()
for target in self.status_target:
self.status_target[target].close()
self.manager.stop()


def get_status_printer(interactive: bool) -> StatusPrinter:
Expand Down
Loading