juncevich commented on code in PR #7139: URL: https://github.com/apache/ozone/pull/7139#discussion_r1766340768
########## hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerBalancerStatusSubcommand.java: ########## @@ -159,20 +166,46 @@ private String getPrettyIterationStatusInfo(ContainerBalancerTaskIterationStatus "%-50s %s%n" + "%-50s %s%n" + "%-50s %s%n" + + "%-50s %s%n" + "%-50s %n%s" + "%-50s %n%s", "Key", "Value", "Iteration number", iterationNumber, + "Iteration duration", getPrettyIterationStatusInfo(iterationDuration), "Iteration result", iterationResult.isEmpty() ? "IN_PROGRESS" : iterationResult, - "Size scheduled to move", sizeScheduledForMove, - "Moved data size", dataSizeMovedGB, + "Size scheduled to move", getPrettySize(sizeScheduledForMove), + "Moved data size", getPrettySize(dataSizeMoved), "Scheduled to move containers", containerMovesScheduled, "Already moved containers", containerMovesCompleted, "Failed to move containers", containerMovesFailed, "Failed to move containers by timeout", containerMovesTimeout, "Entered data to nodes", enteringDataNodeList, "Exited data from nodes", leavingDataNodeList); } + + private String getPrettyIterationStatusInfo(long duration) { + String prettyDuration; + if (duration >= 0 && duration < 60) { + prettyDuration = duration + "s"; + } else if (duration >= 60 && duration < 3600) { + prettyDuration = (duration / 60 + "m " + duration % 60 + "s"); + } else if (duration >= 3600) { + prettyDuration = (duration / 60 / 60 + "h " + duration / 60 % 60 + "m " + duration % 60 + "s"); + } else { + throw new IllegalStateException("Incorrect duration exception" + duration); + } + return prettyDuration; + } + + public static String getPrettySize(long sizeInBytes) { + if (sizeInBytes / OzoneConsts.GB > 0) { + return sizeInBytes / OzoneConsts.GB + " Gb" + sizeInBytes % OzoneConsts.GB / OzoneConsts.MB + " Mb"; Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org