Skip to content

Commit

Permalink
use workloads instead of buckets in replay selector
Browse files Browse the repository at this point in the history
  • Loading branch information
WBSemple committed Oct 18, 2024
1 parent 354b7ed commit b7764a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions tools/ReplayAnalysis/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion tools/ReplayAnalysis/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
24 changes: 12 additions & 12 deletions tools/ReplayAnalysis/gui/src/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}]);
}
}

Expand All @@ -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);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ export const HomePage = () => {
onDismiss={({detail: {itemIndex}}) => {
removeBucket(itemIndex)
}}
items={bucketLabels}>
items={workloadLabels}>

</TokenGroup>

Expand Down

0 comments on commit b7764a7

Please sign in to comment.