diff --git a/src/dvsim/scheduler.py b/src/dvsim/scheduler.py index c2519799..c7c0e5e2 100644 --- a/src/dvsim/scheduler.py +++ b/src/dvsim/scheduler.py @@ -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. diff --git a/src/dvsim/utils/status_printer.py b/src/dvsim/utils/status_printer.py index 84f22dfb..db8f5ca7 100644 --- a/src/dvsim/utils/status_printer.py +++ b/src/dvsim/utils/status_printer.py @@ -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. @@ -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 @@ -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.""" @@ -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: @@ -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: