Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Adjust workload names (#772)
Browse files Browse the repository at this point in the history
* Adjust workload name in frontend

* Adjust workload name extraction

* Run linting

* Refactor comment

* Adjust benchmark names in e2e helper

* Rename regex obj
  • Loading branch information
Alexander-Dubrawski authored Nov 16, 2020
1 parent 0fff829 commit 27948e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
33 changes: 30 additions & 3 deletions hyrisecockpit/frontend/src/meta/workloads.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
import { isInTestMode } from "../../config";

function getDisplayWorkloadName(workloadType: string): string {
const workload_type_map: Record<string, string> = {
tpch: "TPC-H",
tpcds: "TPC-DS",
tpcc: "TPC-C",
job: "Join Order Benchmark",
};
return workload_type_map[workloadType];
}

export function getWorkloadName(
workloadType: string,
scaleFactor: string
): string {
return `${workloadType.toUpperCase()} SF ${scaleFactor}`;
return `${getDisplayWorkloadName(workloadType)} (SF ${scaleFactor})`;
}

// The following code is pretty complex. The workload selector component is working somehow
// with the workload name. So every time a workload is selected from the workload name (displayed name)
// the name and scale factor needs to be retrieved. If for example the *name: job, scalefactor: 1* is transformed to
// *Join Order Benchmark (SF 1)* we need to extract job *name: job, scalefactor: 1*. For that we are using regex.
// TODO: Re-factor display workload settings component to use objects (name, sf) instead of a string.
export function getWorkloadType(workloadName: string): string {
return workloadName.split(" ")[0].toLowerCase();
const workload_type_map: Record<string, string> = {
"TPC-H": "tpch",
"TPC-DS": "tpcds",
"TPC-C": "tpcc",
"Join Order Benchmark": "job",
};
const workload: string = workloadName.split(" (")[0];
return workload_type_map[workload];
}

export function getScaleFactor(workloadName: string): string {
return workloadName.split(" ")[2];
const regExtractScaleFactor = /\(([^)]+)\)/;
const matches = regExtractScaleFactor.exec(workloadName);
// @ts-ignore
return matches[1].split(" ")[1];
}

export function getTableName(table: string): string {
Expand Down
8 changes: 4 additions & 4 deletions hyrisecockpit/frontend/tests/e2e/setup/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export type DatabaseState = "workloadRunning";
export const benchmarks = ["tpch", "tpcds", "job", "tpcc"];

export const displayedBenchmark = {
tpch: "TPCH SF 1",
tpcds: "TPCDS SF 1",
tpcc: "TPCC SF 1",
job: "JOB SF 1",
tpch: "TPC-H (SF 1)",
tpcds: "TPC-DS (SF 1)",
tpcc: "TPC-C (SF 1)",
job: "Join Order Benchmark (SF 1)",
};

export const comparisonRequests: Request[] = [
Expand Down

0 comments on commit 27948e1

Please sign in to comment.