From b7764a7b0552d4ad18801c80dd590da37ecd77c7 Mon Sep 17 00:00:00 2001 From: Will <32901547+WBSemple@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:33:47 +0100 Subject: [PATCH] use workloads instead of buckets in replay selector --- tools/ReplayAnalysis/api/app.py | 8 ++++---- tools/ReplayAnalysis/api/utils.py | 2 +- tools/ReplayAnalysis/gui/src/pages/home.js | 24 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/ReplayAnalysis/api/app.py b/tools/ReplayAnalysis/api/app.py index 989345ec3..4dce3cc78 100644 --- a/tools/ReplayAnalysis/api/app.py +++ b/tools/ReplayAnalysis/api/app.py @@ -171,15 +171,15 @@ def search_s3(): boto3_session = boto3.Session() if request.method == "GET": - bucket = request.args.get("uri") - bucket, data = list_replays(bucket, session=boto3_session) - if bucket is None: + uri = request.args.get("uri") + workload, data = list_replays(uri, session=boto3_session) + if workload is None: if data is ClientError: return jsonify({"success": False, "message": data.__str__()}), 403 else: return jsonify({"success": False, "message": data.__str__()}), 404 - return jsonify({"success": True, "bucket": bucket, "replays": data}), 201 + return jsonify({"success": True, "workload": workload, "replays": data}), 201 @app.route("/submit_replays", methods=["GET", "POST"]) diff --git a/tools/ReplayAnalysis/api/utils.py b/tools/ReplayAnalysis/api/utils.py index f7b5d8247..bd67f5c20 100644 --- a/tools/ReplayAnalysis/api/utils.py +++ b/tools/ReplayAnalysis/api/utils.py @@ -81,7 +81,7 @@ def list_replays(bucket_url, session): print(f"Unable to access replay. {e}") # use tabulate lib to format output - return bucket.get("bucket_name"), table + return table[0]["workload"], table def remove_comments(string): diff --git a/tools/ReplayAnalysis/gui/src/pages/home.js b/tools/ReplayAnalysis/gui/src/pages/home.js index 0e20cfbf4..6b72d2fe6 100644 --- a/tools/ReplayAnalysis/gui/src/pages/home.js +++ b/tools/ReplayAnalysis/gui/src/pages/home.js @@ -10,8 +10,8 @@ export const HomePage = () => { const [resource, setResource] = useState(''); const [replays, setReplays] = useState([]) - const [buckets, setBuckets] = useState([]) - const [bucketLabels, setBucketLabels] = useState([]) + const [workloads, setWorkloads] = useState([]) + const [workloadLabels, setWorkloadLabels] = useState([]) const [searching, setSearching] = useState(false) const [profiles, setProfiles] = useState([]) const [valid, setValid] = useState(true) @@ -36,10 +36,10 @@ export const HomePage = () => { if (!response.success) { setValid(false) } else { - if (!buckets.includes(response.bucket)) { + if (!workloads.includes(response.workload)) { setReplays(replays => [...replays, ...response.replays]); - setBuckets(buckets => [...buckets, response.bucket]); - setBucketLabels(buckets => [...buckets, {label: response.bucket}]); + setWorkloads(workloads => [...workloads, response.workload]); + setWorkloadLabels(workloads => [...workloads, {label: response.workload}]); } } @@ -63,13 +63,13 @@ export const HomePage = () => { * @param {number} itemIndex Total data set of query frequency values. */ function removeBucket(itemIndex) { - let bucket = bucketLabels[itemIndex].label - setBucketLabels([...bucketLabels.slice(0, itemIndex), - ...bucketLabels.slice(itemIndex + 1)]); - setBuckets([...buckets.slice(0, itemIndex), - ...buckets.slice(itemIndex + 1)]); + let workload = workloadLabels[itemIndex].label + setWorkloadLabels([...workloadLabels.slice(0, itemIndex), + ...workloadLabels.slice(itemIndex + 1)]); + setWorkloads([...workloads.slice(0, itemIndex), + ...workloads.slice(itemIndex + 1)]); let result = replays.filter((data) => { - return data.bucket.search(bucket) === -1; + return data.workload !== workload; }); setReplays(result); } @@ -115,7 +115,7 @@ export const HomePage = () => { onDismiss={({detail: {itemIndex}}) => { removeBucket(itemIndex) }} - items={bucketLabels}> + items={workloadLabels}>