Skip to content

Commit

Permalink
truncate commands/logs to screen width
Browse files Browse the repository at this point in the history
  • Loading branch information
joknarf committed Sep 7, 2024
1 parent 23bc8f0 commit 44c42e2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ssh_para/ssh_para.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def print_status(
addstr(self.stdscr, f" {tdelta(seconds=round(duration))}")

def print_job(self, line_num: int, jstatus, duration: float, avgjobdur: float):
"""print host runnin on thread and last out line"""
"""print host running on thread and last out line"""
th_id = str(jstatus.thread_id).zfill(2)
addstr(self.stdscr, line_num, 0, f" {th_id} ")
self.print_status(jstatus.status, duration, avgjobdur)
Expand All @@ -576,7 +576,7 @@ def print_job(self, line_num: int, jstatus, duration: float, avgjobdur: float):
f"{jstatus.shorthost:{self.maxhostlen}} {SYMBOL_RES} ",
curses.color_pair(self.COLOR_HOST),
)
addstrc(self.stdscr, jstatus.log)
addstrc(self.stdscr, jstatus.log[: curses.COLS - self.stdscr.getyx()[1]])

def display_curses(
self, status_id: Optional[int], total_dur: str, jobsdur, nbsshjobs
Expand Down Expand Up @@ -629,7 +629,8 @@ def display_curses(
f"ETA: {estimated}",
],
)
addstrc(self.stdscr, 1, 0, f" Dirlog: {self.pdirlog} Command: {self.command}")
addstr(self.stdscr, 1, 0, f" Dirlog: {self.pdirlog} Command: ")
addstrc(self.stdscr, self.command[: curses.COLS - self.stdscr.getyx()[1]])
addstrc(self.stdscr, 2, 0, "")
self.print_finished(line_num + (nbrun > 0))
if self.paused:
Expand Down Expand Up @@ -715,7 +716,9 @@ def print_finished(self, line_num: int) -> None:
f"{jstatus.shorthost:{self.maxhostlen}} {SYMBOL_RES} ",
curses.color_pair(self.COLOR_HOST),
)
addstrc(self.stdscr, jstatus.log)
addstrc(
self.stdscr, jstatus.log[: curses.COLS - self.stdscr.getyx()[1]]
)
line_num += inter
self.stdscr.clrtobot()

Expand Down

0 comments on commit 44c42e2

Please sign in to comment.