From d282e7e93e869851fda495153836c6da5c2dad9b Mon Sep 17 00:00:00 2001 From: Shashank Reddy Boyapally Date: Mon, 25 Mar 2024 16:15:51 -0400 Subject: [PATCH] added tabulate Signed-off-by: Shashank Reddy Boyapally --- orion.py | 19 ++++++++++--------- requirements.txt | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/orion.py b/orion.py index 1bae46d..b9964d7 100644 --- a/orion.py +++ b/orion.py @@ -7,6 +7,8 @@ from functools import reduce import logging import os +from tabulate import tabulate +import pyshorteners import click import pandas as pd @@ -66,10 +68,10 @@ def orion(config, debug, output, hunter_analyze): print("No UUID present for given metadata") sys.exit() - if metadata["benchmark.keyword"] == "k8s-netperf" : + if metadata["benchmark.keyword"] == "k8s-netperf": index = "k8s-netperf" ids = uuids - elif metadata["benchmark.keyword"] == "ingress-perf" : + elif metadata["benchmark.keyword"] == "ingress-perf": index = "ingress-performance" ids = uuids else: @@ -100,13 +102,12 @@ def orion(config, debug, output, hunter_analyze): (run, match.get_metadata_by_uuid(run)["buildUrl"]) for run in change_uuids ] - print("\n") - print( - "\n\n".join( - f"{run}=======>\033]8;;{buildUrl}\033\\click here for build URL\033]8;;\033\\" - for run, buildUrl in change_runs - ) - ) + shortener = pyshorteners.Shortener() + data = [ + (item1, shortener.tinyurl.short(item2)) for item1, item2 in change_runs + ] + table = tabulate(data, headers=["uuid", "buildUrl"], tablefmt="grid") + logger.info("\n%s",table) if __name__ == "__main__": diff --git a/requirements.txt b/requirements.txt index e298835..cd52982 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ PyYAML==6.0.1 six==1.16.0 tzdata==2023.4 urllib3==1.26.18 +pyshorteners==1.0.1 \ No newline at end of file