Skip to content

Commit

Permalink
added buildUrls to hunter table
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank Reddy Boyapally <sboyapal@redhat.com>
  • Loading branch information
shashank-boyapally committed Mar 26, 2024
1 parent d282e7e commit 1cc6b70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
29 changes: 9 additions & 20 deletions orion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from functools import reduce
import logging
import os
from tabulate import tabulate
import pyshorteners

import click
Expand Down Expand Up @@ -58,12 +57,14 @@ def orion(config, debug, output, hunter_analyze):
else:
logger.error("ES_SERVER environment variable/config variable not set")
sys.exit(1)

shortener = pyshorteners.Shortener()
for test in data["tests"]:
metadata = get_metadata(test, logger)
logger.info("The test %s has started", test["name"])
match = Matcher(index="perf_scale_ci", level=level, ES_URL=ES_URL)
uuids = match.get_uuid_by_metadata(metadata)
runs = match.get_uuid_by_metadata(metadata)
uuids = [run["uuid"] for run in runs]
buildUrls = {run["uuid"]: run["buildUrl"] for run in runs}
if len(uuids) == 0:
print("No UUID present for given metadata")
sys.exit()
Expand All @@ -86,28 +87,16 @@ def orion(config, debug, output, hunter_analyze):
lambda left, right: pd.merge(left, right, on="uuid", how="inner"),
dataframe_list,
)

merged_df["buildUrl"] = merged_df["uuid"].apply(
lambda uuid: shortener.tinyurl.short(buildUrls[uuid]) #pylint: disable = cell-var-from-loop
)
match.save_results(
merged_df, csv_file_path=output.split(".")[0] + "-" + test["name"] + ".csv"
)

if hunter_analyze:
change_points = run_hunter_analyze(merged_df, test)
change_uuids = []
for changepoint in change_points:
if changepoint.prev_attributes["uuid"] not in change_uuids:
change_uuids.append(changepoint.prev_attributes["uuid"])
if changepoint.attributes["uuid"] not in change_uuids:
change_uuids.append(changepoint.attributes["uuid"])
change_runs = [
(run, match.get_metadata_by_uuid(run)["buildUrl"])
for run in change_uuids
]
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)
_ = run_hunter_analyze(merged_df, test)


if __name__ == "__main__":
Expand Down
7 changes: 4 additions & 3 deletions utils/orion_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ def run_hunter_analyze(merged_df,test):
merged_df["timestamp"] = merged_df["timestamp"].astype(int) // 10**9
metrics = {column: Metric(1, 1.0)
for column in merged_df.columns
if column not in ["uuid","timestamp"]}
if column not in ["uuid","timestamp","buildUrl"]}
data = {column: merged_df[column]
for column in merged_df.columns
if column not in ["uuid","timestamp"]}
attributes={column: merged_df[column] for column in merged_df.columns if column in ["uuid"]}
if column not in ["uuid","timestamp","buildUrl"]}
attributes={column: merged_df[column]
for column in merged_df.columns if column in ["uuid","buildUrl"]}
series=Series(
test_name=test["name"],
branch=None,
Expand Down

0 comments on commit 1cc6b70

Please # to comment.