Skip to content

Commit

Permalink
Fix issue #1241 - make sr3 status display more compact (#1290)
Browse files Browse the repository at this point in the history
* Fix #1241 - make sr3 status display more compact

* Fix bug where 3 unlabeled dashes were being printed

* Adjust printing alignment

* Fix "Rates" header positioning

* Fix dashes

* adjusting missing data dash placement

---------

Co-authored-by: Peter Silva <[email protected]>
  • Loading branch information
mshak2 and petersilva authored Nov 8, 2024
1 parent 0de07a2 commit fd0edb2
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,8 +2566,8 @@ def status(self):
flowNameWidth=self.cumulative_stats['flowNameWidth']
latestTransferWidth=self.cumulative_stats['latestTransferWidth']

lfmt = f"%-{flowNameWidth}s %-11s %7s %10s %19s %14s %38s "
line = lfmt % ("Component/Config", "Processes", "Connection", "Lag", "", "Rates", "" )
lfmt = f"%-{flowNameWidth}s %-49s %s"
line = lfmt % ("Component/Config", "Processes", "Rates" )

if self.options.displayFull:
line += "%10s %-40s %17s %33s %40s" % ("", "Counters (per housekeeping)", "", "Data Counters", "" )
Expand All @@ -2579,9 +2579,9 @@ def status(self):
try:
print(line)

lfmt = f"%-{flowNameWidth}s %-5s %5s %5s %4s %4s %5s %8s %8s %{latestTransferWidth}s %5s %10s %10s %10s %10s "
line = lfmt % ("", "State", "Run", "Retry", "msg", "data", "Que", "LagMax", "LagAvg", "Last", "%rej", "pubsub", "messages", "RxData", "TxData" )
underline = lfmt % ("", "-----", "---", "-----", "---", "----", "---", "------", "------", "----", "----", "------", "--------", "------", "------" )
lfmt = f"%-{flowNameWidth}s %-5s %5s %5s %4s %7s %{latestTransferWidth + 1}s %7s %9s %9s "
line = lfmt % ("", "State", "Run", "Retry", "Que", "Lag", "Last", "%rej", "messages", "Data" )
underline = lfmt % ("", "-----", "---", "-----", "---", "---", "----", "----", "--------", "----" )

if self.options.displayFull:
line += "%10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %8s " % \
Expand Down Expand Up @@ -2648,14 +2648,12 @@ def status(self):

if 'metrics' in self.states[c][cfg]:
m=self.states[c][cfg]['metrics']
lfmt = f"%5d %3d%% %3d%% %5d %8s %8s %{latestTransferWidth}s %4.1f%% %8s/s %8s/s %8s/s %8s/s "
line += lfmt % ( m['retry'], m['connectPercent'], m['byteConnectPercent'], \
m['messagesQueued'], durationToString(m['lagMax']), durationToString(m['lagMean']), m['latestTransfer'], m['rejectPercent'],\
naturalSize(m['byteRate']).replace("Bytes","B"), \
lfmt = f"%4d %4d %8s %{latestTransferWidth + 1}s %6.1f%% %6s/s %8s/s "
line += lfmt % ( m['retry'], \
m['messagesQueued'], durationToString(m['lagMean']), m['latestTransfer'], m['rejectPercent'],\
naturalSize(m['msgRate']).replace("B","m").replace("mytes","m"), \
naturalSize(m['transferRxByteRate']).replace("Bytes","B"), \
naturalSize(m['transferTxByteRate']).replace("Bytes","B")
)
naturalSize(m['transferRxByteRate'] + m['transferTxByteRate']).replace("Bytes","B"))


if self.options.displayFull :
line += "%10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %7.2fs " % ( \
Expand All @@ -2673,7 +2671,7 @@ def status(self):
naturalSize(m["transferTxFiles"]).replace("B","F").replace("Fytes","f"), \
m["time_base"] )
else:
line += "%10s %10s %9s %5s %5s %10s %8s " % ( "-", "-", "-", "-", "-", "-", "-" )
line += "%4s %4s %7s %6s %7s %7s %11s " % ( "-", "-", "-", "-", "-", "-", "-" )
if self.options.displayFull:
line += "%8s %7s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s" % \
( "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-" )
Expand All @@ -2690,8 +2688,8 @@ def status(self):
ru['user_cpu'], ru['system_cpu'] \
)
else:
line += "%10s %10s %10s" % ( "-", "-", "-" )
if self.options.displayFull:
line += "%10s %10s %10s" % ( "-", "-", "-" )
line += "%10s %10s" % ( "-", "-" )
try:
print(line)
Expand Down

0 comments on commit fd0edb2

Please sign in to comment.