@rubensworks/process-sparql-benchmark-results 1.3.5 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/psbr.js +4 -1
- package/bin/psbr.js.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/lib/TemplateUtils.js +23 -10
- package/lib/TemplateUtils.js.map +1 -1
- package/lib/cli/CliHelpers.js +27 -14
- package/lib/cli/CliHelpers.js.map +1 -1
- package/lib/cli/CliRunner.d.ts +1 -1
- package/lib/cli/CliRunner.js +5 -5
- package/lib/cli/CliRunner.js.map +1 -1
- package/lib/cli/ITaskContext.js.map +1 -1
- package/lib/cli/commands/CommandCsv.d.ts +1 -1
- package/lib/cli/commands/CommandCsv.js +7 -5
- package/lib/cli/commands/CommandCsv.js.map +1 -1
- package/lib/cli/commands/CommandStats.d.ts +1 -1
- package/lib/cli/commands/CommandStats.js +7 -5
- package/lib/cli/commands/CommandStats.js.map +1 -1
- package/lib/cli/commands/CommandTex.d.ts +1 -1
- package/lib/cli/commands/CommandTex.js +7 -5
- package/lib/cli/commands/CommandTex.js.map +1 -1
- package/lib/cli/commands/csv/CommandBsbm.d.ts +2 -2
- package/lib/cli/commands/csv/CommandBsbm.js +103 -85
- package/lib/cli/commands/csv/CommandBsbm.js.map +1 -1
- package/lib/cli/commands/csv/CommandGithubActionsBenchmark.d.ts +2 -2
- package/lib/cli/commands/csv/CommandGithubActionsBenchmark.js +149 -102
- package/lib/cli/commands/csv/CommandGithubActionsBenchmark.js.map +1 -1
- package/lib/cli/commands/csv/CommandQuery.d.ts +2 -2
- package/lib/cli/commands/csv/CommandQuery.js +111 -93
- package/lib/cli/commands/csv/CommandQuery.js.map +1 -1
- package/lib/cli/commands/csv/CommandSummary.d.ts +2 -2
- package/lib/cli/commands/csv/CommandSummary.js +230 -212
- package/lib/cli/commands/csv/CommandSummary.js.map +1 -1
- package/lib/cli/commands/csv/CommandWins.d.ts +2 -2
- package/lib/cli/commands/csv/CommandWins.js +134 -119
- package/lib/cli/commands/csv/CommandWins.js.map +1 -1
- package/lib/cli/commands/csv/TableSerializerCsv.d.ts +0 -1
- package/lib/cli/commands/csv/TableSerializerMarkdown.d.ts +0 -1
- package/lib/cli/commands/csv/TableSerializerMarkdown.js.map +1 -1
- package/lib/cli/commands/stats/CommandDocker.d.ts +2 -2
- package/lib/cli/commands/stats/CommandDocker.js +66 -48
- package/lib/cli/commands/stats/CommandDocker.js.map +1 -1
- package/lib/cli/commands/tex/CommandQuery.d.ts +2 -2
- package/lib/cli/commands/tex/CommandQuery.js +241 -223
- package/lib/cli/commands/tex/CommandQuery.js.map +1 -1
- package/lib/cli/commands/tex/CommandQueryTimes.d.ts +2 -2
- package/lib/cli/commands/tex/CommandQueryTimes.js +141 -123
- package/lib/cli/commands/tex/CommandQueryTimes.js.map +1 -1
- package/lib/cli/commands/tex/TexUtils.js +38 -20
- package/lib/cli/commands/tex/TexUtils.js.map +1 -1
- package/lib/correctness/CorrectnessCheckerUtils.js +2 -3
- package/lib/correctness/CorrectnessCheckerUtils.js.map +1 -1
- package/package.json +43 -52
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Argv } from 'yargs';
|
|
2
2
|
export declare const command = "ghbench <experiment-dir...>";
|
|
3
3
|
export declare const desc = "Generates a JSON file for usage in the Benchmark Github Action";
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare function builder(yargs: Argv<any>): Argv<any>;
|
|
5
|
+
export declare function handler(argv: Record<string, any>): Promise<void>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,123 +15,166 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
37
|
};
|
|
24
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
39
|
+
exports.desc = exports.command = void 0;
|
|
40
|
+
exports.builder = builder;
|
|
41
|
+
exports.handler = handler;
|
|
26
42
|
const fs = __importStar(require("fs"));
|
|
27
43
|
const path_1 = __importDefault(require("path"));
|
|
28
44
|
const CliHelpers_1 = require("../../CliHelpers");
|
|
29
45
|
const TexUtils_1 = require("../tex/TexUtils");
|
|
30
46
|
exports.command = 'ghbench <experiment-dir...>';
|
|
31
47
|
exports.desc = 'Generates a JSON file for usage in the Benchmark Github Action';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
48
|
+
function builder(yargs) {
|
|
49
|
+
return yargs
|
|
50
|
+
.options({
|
|
51
|
+
queryRegex: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
alias: 'q',
|
|
54
|
+
describe: 'Regex for queries to include (before any label overrides). ' +
|
|
55
|
+
'Examples: \'^C\', \'^[^C]\', ...',
|
|
56
|
+
},
|
|
57
|
+
name: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
alias: 'n',
|
|
60
|
+
describe: 'Custom output file name',
|
|
61
|
+
default: 'ghbench.json',
|
|
62
|
+
},
|
|
63
|
+
inputName: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
describe: 'Custom input file name per experiment',
|
|
66
|
+
default: 'query-times.csv',
|
|
67
|
+
},
|
|
68
|
+
inputDelimiter: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
describe: 'Delimiter for the input CSV file',
|
|
71
|
+
default: ';',
|
|
72
|
+
},
|
|
73
|
+
overrideCombinationLabels: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
describe: 'Comma-separated list of combination labels to use',
|
|
76
|
+
},
|
|
77
|
+
total: {
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
describe: 'If total execution time across the experiment must be reported',
|
|
80
|
+
default: false,
|
|
81
|
+
},
|
|
82
|
+
detailed: {
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
describe: 'If separate execution time for each query in the experiment must be reported',
|
|
85
|
+
default: true,
|
|
86
|
+
},
|
|
87
|
+
failures: {
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
describe: 'If the number of failed query instantiations in the experiment must be reported',
|
|
90
|
+
default: false,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function handler(argv) {
|
|
95
|
+
return (0, CliHelpers_1.wrapCommandHandler)(argv, async (context) => (0, CliHelpers_1.wrapVisualProgress)('Collecting ghbench data', async () => {
|
|
96
|
+
// Load options
|
|
97
|
+
const { experimentDirectories, experimentNames } = (0, TexUtils_1.getExperimentNames)(argv);
|
|
98
|
+
const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;
|
|
99
|
+
// Collect timings
|
|
100
|
+
const ghbenchData = [];
|
|
101
|
+
for (const [experimentId, experimentDirectory] of experimentDirectories.entries()) {
|
|
102
|
+
const ghbenchDataRaw = {};
|
|
103
|
+
await (0, TexUtils_1.handleCsvFile)(experimentDirectory, argv, (data) => {
|
|
104
|
+
if (!queryRegex || queryRegex.test(data.name)) {
|
|
105
|
+
const value = Number.parseFloat(data.time);
|
|
106
|
+
if (!ghbenchDataRaw[data.name]) {
|
|
107
|
+
ghbenchDataRaw[data.name] = {
|
|
108
|
+
name: `${experimentNames[experimentId]} - ${data.name}`,
|
|
109
|
+
unit: 'ms',
|
|
110
|
+
values: [value],
|
|
111
|
+
extra: {
|
|
112
|
+
results: [data.results],
|
|
113
|
+
error: [data.error],
|
|
114
|
+
httpRequests: [data.httpRequests],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
ghbenchDataRaw[data.name].values.push(value);
|
|
120
|
+
ghbenchDataRaw[data.name].extra.results.push(data.results);
|
|
121
|
+
ghbenchDataRaw[data.name].extra.error.push(data.error);
|
|
122
|
+
ghbenchDataRaw[data.name].extra.httpRequests.push(data.httpRequests);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// Calculate averages
|
|
127
|
+
let total = 0;
|
|
128
|
+
for (const entry of Object.values(ghbenchDataRaw)) {
|
|
129
|
+
const successValues = entry.values.filter((val, index) => entry.extra.error[index] !== 'true');
|
|
130
|
+
// Queries that failed for all instantiations have no time, so they must not be reported as 0
|
|
131
|
+
if (successValues.length === 0) {
|
|
132
|
+
continue;
|
|
93
133
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
134
|
+
const value = (0, TexUtils_1.calcMedian)(successValues);
|
|
135
|
+
if (!Number.isNaN(value)) {
|
|
136
|
+
total += value;
|
|
137
|
+
}
|
|
138
|
+
// Output detailed
|
|
139
|
+
if (argv.detailed) {
|
|
140
|
+
ghbenchData.push({
|
|
141
|
+
name: entry.name,
|
|
142
|
+
unit: entry.unit,
|
|
143
|
+
value,
|
|
144
|
+
extra: `Results: [${entry.extra.results}]; Error: [${entry.extra.error}]; HTTP Requests: [${entry.extra.httpRequests}]`,
|
|
145
|
+
});
|
|
99
146
|
}
|
|
100
147
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
148
|
+
// Output totals
|
|
149
|
+
if (argv.total) {
|
|
150
|
+
ghbenchData.push({
|
|
151
|
+
name: `${experimentNames[experimentId]}`,
|
|
152
|
+
unit: 'ms',
|
|
153
|
+
value: total,
|
|
154
|
+
});
|
|
108
155
|
}
|
|
109
|
-
// Output
|
|
110
|
-
if (argv.
|
|
156
|
+
// Output failures, as failed queries have no time to report
|
|
157
|
+
if (argv.failures) {
|
|
158
|
+
const failedQueries = Object.entries(ghbenchDataRaw)
|
|
159
|
+
.map(([name, entry]) => ({
|
|
160
|
+
name,
|
|
161
|
+
failed: entry.extra.error.filter(error => error === 'true').length,
|
|
162
|
+
count: entry.extra.error.length,
|
|
163
|
+
}))
|
|
164
|
+
.filter(entry => entry.failed > 0);
|
|
111
165
|
ghbenchData.push({
|
|
112
|
-
name:
|
|
113
|
-
unit:
|
|
114
|
-
value,
|
|
115
|
-
extra:
|
|
166
|
+
name: `${experimentNames[experimentId]} - failed queries`,
|
|
167
|
+
unit: 'failed instantiations',
|
|
168
|
+
value: failedQueries.reduce((sum, entry) => sum + entry.failed, 0),
|
|
169
|
+
extra: failedQueries.length > 0 ?
|
|
170
|
+
failedQueries.map(entry => `${entry.name}: ${entry.failed}/${entry.count} failed`).join('; ') :
|
|
171
|
+
'None',
|
|
116
172
|
});
|
|
117
173
|
}
|
|
118
174
|
}
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
value: total,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Write output
|
|
129
|
-
// eslint-disable-next-line no-sync
|
|
130
|
-
fs.writeFileSync(path_1.default.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');
|
|
131
|
-
}));
|
|
132
|
-
exports.handler = handler;
|
|
175
|
+
// Write output
|
|
176
|
+
// eslint-disable-next-line no-sync
|
|
177
|
+
fs.writeFileSync(path_1.default.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
133
180
|
//# sourceMappingURL=CommandGithubActionsBenchmark.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandGithubActionsBenchmark.js","sourceRoot":"","sources":["CommandGithubActionsBenchmark.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AAExB,iDAA0E;AAE1E,8CAIyB;AAEZ,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,IAAI,GAAG,gEAAgE,CAAC;AAC9E,MAAM,OAAO,GAAG,CAAC,KAAgB,EAAa,EAAE,CACrD,KAAK;KACF,OAAO,CAAC;IACP,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,6FAA6F;KACxG;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,yBAAyB;QACnC,OAAO,EAAE,cAAc;KACxB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,uCAAuC;QACjD,OAAO,EAAE,iBAAiB;KAC3B;IACD,cAAc,EAAE;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,kCAAkC;QAC5C,OAAO,EAAE,GAAG;KACb;IACD,yBAAyB,EAAE;QACzB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,mDAAmD;KAC9D;IACD,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,gEAAgE;QAC1E,OAAO,EAAE,KAAK;KACf;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,8EAA8E;QACxF,OAAO,EAAE,IAAI;KACd;CACF,CA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AAK,CAAC,KAAK,sBAAsB,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG;iBACxH,CAAC,CAAC;aACJ;SACF;QAED,gBAAgB;QAChB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,GAAG,eAAe,CAAC,YAAY,CAAC,EAAE;gBACxC,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;SACJ;KACF;IAED,eAAe;IACf,mCAAmC;IACnC,EAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5G,CAAC,CAAC,CAAC,CAAC;AAlEO,QAAA,OAAO,WAkEd","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\nimport type { Argv } from 'yargs';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\nimport type { ITaskContext } from '../../ITaskContext';\nimport {\n calcMedian,\n getExperimentNames,\n handleCsvFile,\n} from '../tex/TexUtils';\n\nexport const command = 'ghbench <experiment-dir...>';\nexport const desc = 'Generates a JSON file for usage in the Benchmark Github Action';\nexport const builder = (yargs: Argv<any>): Argv<any> =>\n yargs\n .options({\n queryRegex: {\n type: 'string',\n alias: 'q',\n describe: 'Regex for queries to include (before any label overrides). Examples: \\'^C\\', \\'^[^C]\\', ...',\n },\n name: {\n type: 'string',\n alias: 'n',\n describe: 'Custom output file name',\n default: 'ghbench.json',\n },\n inputName: {\n type: 'string',\n describe: 'Custom input file name per experiment',\n default: 'query-times.csv',\n },\n inputDelimiter: {\n type: 'string',\n describe: 'Delimiter for the input CSV file',\n default: ';',\n },\n overrideCombinationLabels: {\n type: 'string',\n describe: 'Comma-separated list of combination labels to use',\n },\n total: {\n type: 'boolean',\n describe: 'If total execution time across the experiment must be reported',\n default: false,\n },\n detailed: {\n type: 'boolean',\n describe: 'If separate execution time for each query in the experiment must be reported',\n default: true,\n },\n });\nexport const handler = (argv: Record<string, any>): Promise<void> => wrapCommandHandler(argv,\n async(context: ITaskContext) => wrapVisualProgress('Collecting ghbench data', async() => {\n // Load options\n const { experimentDirectories, experimentNames } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n\n // Collect timings\n const ghbenchData: GhbenchData = [];\n for (const [ experimentId, experimentDirectory ] of experimentDirectories.entries()) {\n const ghbenchDataRaw: Record<string, GhbenchDataRaw> = {};\n\n await handleCsvFile(experimentDirectory, argv, data => {\n if (!queryRegex || queryRegex.test(data.name)) {\n const value = Number.parseInt(data.time, 10);\n if (!ghbenchDataRaw[data.name]) {\n ghbenchDataRaw[data.name] = {\n name: `${experimentNames[experimentId]} - ${data.name}`,\n unit: 'ms',\n values: [ value ],\n extra: {\n results: [ data.results ],\n error: [ data.error ],\n httpRequests: [ data.httpRequests ],\n },\n };\n } else {\n ghbenchDataRaw[data.name].values.push(value);\n ghbenchDataRaw[data.name].extra.results.push(data.results);\n ghbenchDataRaw[data.name].extra.error.push(data.error);\n ghbenchDataRaw[data.name].extra.httpRequests.push(data.httpRequests);\n }\n }\n });\n\n // Calculate averages\n let total = 0;\n for (const entry of Object.values(ghbenchDataRaw)) {\n const value = calcMedian(entry.values.filter((val, index) => entry.extra.error[index] !== 'true')) || 0;\n if (!Number.isNaN(value)) {\n total += value;\n }\n\n // Output detailed\n if (argv.detailed) {\n ghbenchData.push({\n name: entry.name,\n unit: entry.unit,\n value,\n extra: `Results: [${entry.extra.results}]; Error: [${entry.extra.error}]; HTTP Requests: [${entry.extra.httpRequests}]`,\n });\n }\n }\n\n // Output totals\n if (argv.total) {\n ghbenchData.push({\n name: `${experimentNames[experimentId]}`,\n unit: 'ms',\n value: total,\n });\n }\n }\n\n // Write output\n // eslint-disable-next-line no-sync\n fs.writeFileSync(Path.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');\n }));\n\ninterface GhbenchDataRaw {\n name: string;\n unit: string;\n values: number[];\n range?: string;\n extra: { results: number[]; error: string[]; httpRequests: number[] };\n}\n\ntype GhbenchData = {\n name: string;\n unit: string;\n value: number;\n range?: string;\n extra?: string;\n}[];\n"]}
|
|
1
|
+
{"version":3,"file":"CommandGithubActionsBenchmark.js","sourceRoot":"","sources":["CommandGithubActionsBenchmark.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,0BA6CC;AACD,0BA8FC;AAzJD,uCAAyB;AACzB,gDAAwB;AAExB,iDAA0E;AAE1E,8CAIyB;AAEZ,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,IAAI,GAAG,gEAAgE,CAAC;AACrF,SAAgB,OAAO,CAAC,KAAgB;IACtC,OAAO,KAAK;SACT,OAAO,CAAC;QACP,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,6DAA6D;gBACrE,kCAAkC;SACrC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,yBAAyB;YACnC,OAAO,EAAE,cAAc;SACxB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,iBAAiB;SAC3B;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kCAAkC;YAC5C,OAAO,EAAE,GAAG;SACb;QACD,yBAAyB,EAAE;YACzB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,mDAAmD;SAC9D;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,gEAAgE;YAC1E,OAAO,EAAE,KAAK;SACf;QACD,Q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C,IAAI,CAAC;oBACf,IAAI,EAAE,GAAG,eAAe,CAAC,YAAY,CAAC,mBAAmB;oBACzD,IAAI,EAAE,uBAAuB;oBAC7B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;oBAClE,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;wBAC/B,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC/F,MAAM;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,eAAe;QACf,mCAAmC;QACnC,EAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5G,CAAC,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\nimport type { Argv } from 'yargs';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\nimport type { ITaskContext } from '../../ITaskContext';\nimport {\n calcMedian,\n getExperimentNames,\n handleCsvFile,\n} from '../tex/TexUtils';\n\nexport const command = 'ghbench <experiment-dir...>';\nexport const desc = 'Generates a JSON file for usage in the Benchmark Github Action';\nexport function builder(yargs: Argv<any>): Argv<any> {\n return yargs\n .options({\n queryRegex: {\n type: 'string',\n alias: 'q',\n describe: 'Regex for queries to include (before any label overrides). ' +\n 'Examples: \\'^C\\', \\'^[^C]\\', ...',\n },\n name: {\n type: 'string',\n alias: 'n',\n describe: 'Custom output file name',\n default: 'ghbench.json',\n },\n inputName: {\n type: 'string',\n describe: 'Custom input file name per experiment',\n default: 'query-times.csv',\n },\n inputDelimiter: {\n type: 'string',\n describe: 'Delimiter for the input CSV file',\n default: ';',\n },\n overrideCombinationLabels: {\n type: 'string',\n describe: 'Comma-separated list of combination labels to use',\n },\n total: {\n type: 'boolean',\n describe: 'If total execution time across the experiment must be reported',\n default: false,\n },\n detailed: {\n type: 'boolean',\n describe: 'If separate execution time for each query in the experiment must be reported',\n default: true,\n },\n failures: {\n type: 'boolean',\n describe: 'If the number of failed query instantiations in the experiment must be reported',\n default: false,\n },\n });\n}\nexport function handler(argv: Record<string, any>): Promise<void> {\n return wrapCommandHandler(\n argv,\n async(context: ITaskContext) => wrapVisualProgress('Collecting ghbench data', async() => {\n // Load options\n const { experimentDirectories, experimentNames } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n\n // Collect timings\n const ghbenchData: GhbenchData = [];\n for (const [ experimentId, experimentDirectory ] of experimentDirectories.entries()) {\n const ghbenchDataRaw: Record<string, GhbenchDataRaw> = {};\n\n await handleCsvFile(experimentDirectory, argv, (data) => {\n if (!queryRegex || queryRegex.test(data.name)) {\n const value = Number.parseFloat(data.time);\n if (!ghbenchDataRaw[data.name]) {\n ghbenchDataRaw[data.name] = {\n name: `${experimentNames[experimentId]} - ${data.name}`,\n unit: 'ms',\n values: [ value ],\n extra: {\n results: [ data.results ],\n error: [ data.error ],\n httpRequests: [ data.httpRequests ],\n },\n };\n } else {\n ghbenchDataRaw[data.name].values.push(value);\n ghbenchDataRaw[data.name].extra.results.push(data.results);\n ghbenchDataRaw[data.name].extra.error.push(data.error);\n ghbenchDataRaw[data.name].extra.httpRequests.push(data.httpRequests);\n }\n }\n });\n\n // Calculate averages\n let total = 0;\n for (const entry of Object.values(ghbenchDataRaw)) {\n const successValues = entry.values.filter((val, index) => entry.extra.error[index] !== 'true');\n // Queries that failed for all instantiations have no time, so they must not be reported as 0\n if (successValues.length === 0) {\n continue;\n }\n const value = calcMedian(successValues);\n if (!Number.isNaN(value)) {\n total += value;\n }\n\n // Output detailed\n if (argv.detailed) {\n ghbenchData.push({\n name: entry.name,\n unit: entry.unit,\n value,\n extra: `Results: [${entry.extra.results}]; Error: [${entry.extra.error}]; HTTP Requests: [${entry.extra.httpRequests}]`,\n });\n }\n }\n\n // Output totals\n if (argv.total) {\n ghbenchData.push({\n name: `${experimentNames[experimentId]}`,\n unit: 'ms',\n value: total,\n });\n }\n\n // Output failures, as failed queries have no time to report\n if (argv.failures) {\n const failedQueries = Object.entries(ghbenchDataRaw)\n .map(([ name, entry ]) => ({\n name,\n failed: entry.extra.error.filter(error => error === 'true').length,\n count: entry.extra.error.length,\n }))\n .filter(entry => entry.failed > 0);\n ghbenchData.push({\n name: `${experimentNames[experimentId]} - failed queries`,\n unit: 'failed instantiations',\n value: failedQueries.reduce((sum, entry) => sum + entry.failed, 0),\n extra: failedQueries.length > 0 ?\n failedQueries.map(entry => `${entry.name}: ${entry.failed}/${entry.count} failed`).join('; ') :\n 'None',\n });\n }\n }\n\n // Write output\n // eslint-disable-next-line no-sync\n fs.writeFileSync(Path.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');\n }),\n );\n}\n\ninterface GhbenchDataRaw {\n name: string;\n unit: string;\n values: number[];\n range?: string;\n extra: { results: number[]; error: string[]; httpRequests: number[] };\n}\n\ntype GhbenchData = {\n name: string;\n unit: string;\n value: number;\n range?: string;\n extra?: string;\n}[];\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Argv } from 'yargs';
|
|
2
2
|
export declare const command = "query <experiment-dir...>";
|
|
3
3
|
export declare const desc = "List all query execution times from the given experiments";
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare function builder(yargs: Argv<any>): Argv<any>;
|
|
5
|
+
export declare function handler(argv: Record<string, any>): Promise<void>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,21 +15,33 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
37
|
};
|
|
24
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
39
|
+
exports.desc = exports.command = void 0;
|
|
40
|
+
exports.builder = builder;
|
|
41
|
+
exports.handler = handler;
|
|
26
42
|
const fs = __importStar(require("fs"));
|
|
27
43
|
const path_1 = __importDefault(require("path"));
|
|
28
|
-
const csv_parse_1 =
|
|
44
|
+
const csv_parse_1 = require("csv-parse");
|
|
29
45
|
const CorrectnessCheckerUtils_1 = require("../../../correctness/CorrectnessCheckerUtils");
|
|
30
46
|
const CliHelpers_1 = require("../../CliHelpers");
|
|
31
47
|
const TexUtils_1 = require("../tex/TexUtils");
|
|
@@ -33,88 +49,90 @@ const TableSerializerCsv_1 = require("./TableSerializerCsv");
|
|
|
33
49
|
const TableSerializerMarkdown_1 = require("./TableSerializerMarkdown");
|
|
34
50
|
exports.command = 'query <experiment-dir...>';
|
|
35
51
|
exports.desc = 'List all query execution times from the given experiments';
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// Read CSV
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
52
|
+
function builder(yargs) {
|
|
53
|
+
return yargs
|
|
54
|
+
.options({
|
|
55
|
+
queryRegex: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
alias: 'q',
|
|
58
|
+
describe: 'Regex for queries to include (before any label overrides). Examples: \'^C\', \'^[^C]\', ...',
|
|
59
|
+
},
|
|
60
|
+
name: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
alias: 'n',
|
|
63
|
+
describe: 'Custom output file name',
|
|
64
|
+
default: 'data_all.csv',
|
|
65
|
+
},
|
|
66
|
+
inputName: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
describe: 'Custom input file name per experiment',
|
|
69
|
+
default: 'query-times.csv',
|
|
70
|
+
},
|
|
71
|
+
inputDelimiter: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
describe: 'Delimiter for the input CSV file',
|
|
74
|
+
default: ';',
|
|
75
|
+
},
|
|
76
|
+
overrideCombinationLabels: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
describe: 'Comma-separated list of combination labels to use',
|
|
79
|
+
},
|
|
80
|
+
markdown: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
describe: 'If the output should be serialized as markdown',
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
correctnessReference: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
describe: 'Path to a JSON file mapping queries to expected cardinality',
|
|
88
|
+
default: '',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function handler(argv) {
|
|
93
|
+
return (0, CliHelpers_1.wrapCommandHandler)(argv, async (context) => (0, CliHelpers_1.wrapVisualProgress)('Listing data', async () => {
|
|
94
|
+
// Load options
|
|
95
|
+
const { experimentDirectories, experimentNames } = (0, TexUtils_1.getExperimentNames)(argv);
|
|
96
|
+
const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;
|
|
97
|
+
const correctnessReference = argv.correctnessReference ?
|
|
98
|
+
(0, CorrectnessCheckerUtils_1.constructCorrectnessChecker)(argv.correctnessReference) :
|
|
99
|
+
undefined;
|
|
100
|
+
// Prepare output CSV file
|
|
101
|
+
const os = fs.createWriteStream(path_1.default.join(context.cwd, `${argv.name}`));
|
|
102
|
+
const serializer = argv.markdown ? new TableSerializerMarkdown_1.TableSerializerMarkdown(os) : new TableSerializerCsv_1.TableSerializerCsv(os);
|
|
103
|
+
serializer.writeHeader([
|
|
104
|
+
'experiment',
|
|
105
|
+
'time',
|
|
106
|
+
'requests',
|
|
107
|
+
'results',
|
|
108
|
+
...correctnessReference ? ['correctness'] : [],
|
|
109
|
+
]);
|
|
110
|
+
// Read CSV files
|
|
111
|
+
for (const [experimentId, experimentDirectory] of experimentDirectories.entries()) {
|
|
112
|
+
// Read CSV file
|
|
113
|
+
const csvFile = path_1.default.join(experimentDirectory, argv.inputName);
|
|
114
|
+
await new Promise((resolve, reject) => {
|
|
115
|
+
const parser = (0, csv_parse_1.parse)({ delimiter: argv.inputDelimiter, columns: true });
|
|
116
|
+
parser.on('data', (data) => {
|
|
117
|
+
if (!queryRegex || queryRegex.test(data.name)) {
|
|
118
|
+
serializer.writeRow([
|
|
119
|
+
experimentNames[experimentId],
|
|
120
|
+
data.time,
|
|
121
|
+
data.httpRequests || '0',
|
|
122
|
+
data.results,
|
|
123
|
+
...correctnessReference ?
|
|
124
|
+
[correctnessReference.getCorrectness(experimentId, data.name, Number.parseInt(data.results, 10))] :
|
|
125
|
+
[],
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
parser.on('error', reject);
|
|
130
|
+
parser.on('end', resolve);
|
|
131
|
+
fs.createReadStream(csvFile).pipe(parser);
|
|
110
132
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// Close output CSV file
|
|
117
|
-
serializer.close();
|
|
118
|
-
}));
|
|
119
|
-
exports.handler = handler;
|
|
133
|
+
}
|
|
134
|
+
// Close output CSV file
|
|
135
|
+
serializer.close();
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
120
138
|
//# sourceMappingURL=CommandQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandQuery.js","sourceRoot":"","sources":["CommandQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandQuery.js","sourceRoot":"","sources":["CommandQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,0BAuCC;AACD,0BAiDC;AAzGD,uCAAyB;AACzB,gDAAwB;AAExB,yCAAkC;AAGlC,0FAA2F;AAC3F,iDAA0E;AAG1E,8CAAqD;AACrD,6DAA0D;AAC1D,uEAAoE;AAEvD,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,QAAA,IAAI,GAAG,2DAA2D,CAAC;AAChF,SAAgB,OAAO,CAAC,KAAgB;IACtC,OAAO,KAAK;SACT,OAAO,CAAC;QACP,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,6FAA6F;SACxG;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,yBAAyB;YACnC,OAAO,EAAE,cAAc;SACxB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,iBAAiB;SAC3B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AAE,MAAM,CAAC,CAAC;gBAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAE1B,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,wBAAwB;QACxB,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC,CAAC;AACN,CAAC","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\n\nimport { parse } from 'csv-parse';\nimport type { Argv } from 'yargs';\n\nimport { constructCorrectnessChecker } from '../../../correctness/CorrectnessCheckerUtils';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\n\nimport type { ITaskContext } from '../../ITaskContext';\nimport { getExperimentNames } from '../tex/TexUtils';\nimport { TableSerializerCsv } from './TableSerializerCsv';\nimport { TableSerializerMarkdown } from './TableSerializerMarkdown';\n\nexport const command = 'query <experiment-dir...>';\nexport const desc = 'List all query execution times from the given experiments';\nexport function builder(yargs: Argv<any>): Argv<any> {\n return yargs\n .options({\n queryRegex: {\n type: 'string',\n alias: 'q',\n describe: 'Regex for queries to include (before any label overrides). Examples: \\'^C\\', \\'^[^C]\\', ...',\n },\n name: {\n type: 'string',\n alias: 'n',\n describe: 'Custom output file name',\n default: 'data_all.csv',\n },\n inputName: {\n type: 'string',\n describe: 'Custom input file name per experiment',\n default: 'query-times.csv',\n },\n inputDelimiter: {\n type: 'string',\n describe: 'Delimiter for the input CSV file',\n default: ';',\n },\n overrideCombinationLabels: {\n type: 'string',\n describe: 'Comma-separated list of combination labels to use',\n },\n markdown: {\n type: 'boolean',\n describe: 'If the output should be serialized as markdown',\n default: false,\n },\n correctnessReference: {\n type: 'string',\n describe: 'Path to a JSON file mapping queries to expected cardinality',\n default: '',\n },\n });\n}\nexport function handler(argv: Record<string, any>): Promise<void> {\n return wrapCommandHandler(argv, async(context: ITaskContext) => wrapVisualProgress('Listing data', async() => {\n // Load options\n const { experimentDirectories, experimentNames } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n const correctnessReference = argv.correctnessReference ?\n constructCorrectnessChecker(argv.correctnessReference) :\n undefined;\n\n // Prepare output CSV file\n const os = fs.createWriteStream(Path.join(context.cwd, `${argv.name}`));\n const serializer = argv.markdown ? new TableSerializerMarkdown(os) : new TableSerializerCsv(os);\n serializer.writeHeader([\n 'experiment',\n 'time',\n 'requests',\n 'results',\n ...correctnessReference ? [ 'correctness' ] : [],\n ]);\n\n // Read CSV files\n for (const [ experimentId, experimentDirectory ] of experimentDirectories.entries()) {\n // Read CSV file\n const csvFile = Path.join(experimentDirectory, argv.inputName);\n await new Promise((resolve, reject) => {\n const parser = parse({ delimiter: argv.inputDelimiter, columns: true });\n parser.on('data', (data: Record<string, any>) => {\n if (!queryRegex || queryRegex.test(data.name)) {\n serializer.writeRow([\n experimentNames[experimentId],\n data.time,\n data.httpRequests || '0',\n data.results,\n ...correctnessReference ?\n [ correctnessReference.getCorrectness(experimentId, data.name, Number.parseInt(data.results, 10)) ] :\n [],\n ]);\n }\n });\n parser.on('error', reject);\n parser.on('end', resolve);\n\n fs.createReadStream(csvFile).pipe(parser);\n });\n }\n\n // Close output CSV file\n serializer.close();\n }));\n}\n"]}
|