|
@@ -56,6 +56,7 @@ class Renderer:
|
|
|
|
|
|
def render_info_dict(self, info_dict):
|
|
|
line_blocks = []
|
|
|
+ line_len = -1
|
|
|
|
|
|
for node_dict in info_dict:
|
|
|
if self.node_names is None or node_dict["name"] in self.node_names:
|
|
@@ -63,8 +64,14 @@ class Renderer:
|
|
|
|
|
|
if lines:
|
|
|
line_blocks.append(lines)
|
|
|
-
|
|
|
- first_line = build_line("=", len(lines[-1]))
|
|
|
+
|
|
|
+ if len(lines[-1]) > line_len:
|
|
|
+ line_len = len(lines[-1])
|
|
|
+
|
|
|
+ if line_len > -1:
|
|
|
+ first_line = build_line("=", line_len)
|
|
|
+ else: # No gpus found with current settings.
|
|
|
+ return "--- No available GPUs found ---"
|
|
|
|
|
|
final_lines = []
|
|
|
|
|
@@ -141,8 +148,6 @@ class Renderer:
|
|
|
pad_line = build_line("-", line_len)
|
|
|
pad_line_empty = build_line(" ", line_len)
|
|
|
|
|
|
- if self.gpu_outer_spacings:
|
|
|
- lines.append(pad_line_empty)
|
|
|
lines.append(build_line("=", line_len))
|
|
|
|
|
|
if self.gpu_outer_spacings:
|
|
@@ -188,13 +193,13 @@ class Renderer:
|
|
|
|
|
|
if self.display_users:
|
|
|
lines.append(self.get_rendered_users_line(gpu_dict["running_processes"], len(line_meta)))
|
|
|
+
|
|
|
+ if self.gpu_outer_spacings:
|
|
|
+ lines.append(empty_line)
|
|
|
else:
|
|
|
if self.gpu_inner_spacings:
|
|
|
lines.append(empty_line)
|
|
|
|
|
|
- if self.gpu_outer_spacings:
|
|
|
- lines = [empty_line] + lines
|
|
|
-
|
|
|
return lines
|
|
|
|
|
|
def get_rendered_users_line(self, processes_list, line_len):
|