@hackerrank/astra-cli 0.1.9 → 0.1.11
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/package.json +1 -1
- package/src/report.js +20 -1
- package/src/verifier-runner.js +12 -0
package/package.json
CHANGED
package/src/report.js
CHANGED
|
@@ -20,7 +20,11 @@ export function refreshReport(root) {
|
|
|
20
20
|
if (!fs.existsSync(rootDir)) {
|
|
21
21
|
throw new Error(`bench root not found: ${rootDir}`);
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// Task versions are immutable benchmark definitions. A task output directory
|
|
24
|
+
// may retain old attempts for auditability, but combining versions changes
|
|
25
|
+
// the measured task and makes the dashboard misleading. Show the newest
|
|
26
|
+
// version for each task while preserving unversioned legacy runs.
|
|
27
|
+
const runs = latestTaskRuns(scanRuns(rootDir));
|
|
24
28
|
const summary = buildSummary(runs);
|
|
25
29
|
|
|
26
30
|
for (const run of runs) {
|
|
@@ -82,6 +86,21 @@ export function scanRuns(rootDir) {
|
|
|
82
86
|
return runs;
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
function latestTaskRuns(runs) {
|
|
90
|
+
const latestVersionByTask = new Map();
|
|
91
|
+
for (const run of runs) {
|
|
92
|
+
const taskId = run.project?.id;
|
|
93
|
+
const version = Number(run.project?.version);
|
|
94
|
+
if (!taskId || !Number.isFinite(version)) continue;
|
|
95
|
+
latestVersionByTask.set(taskId, Math.max(latestVersionByTask.get(taskId) ?? version, version));
|
|
96
|
+
}
|
|
97
|
+
return runs.filter((run) => {
|
|
98
|
+
const taskId = run.project?.id;
|
|
99
|
+
const version = Number(run.project?.version);
|
|
100
|
+
return !taskId || !Number.isFinite(version) || latestVersionByTask.get(taskId) === version;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
85
104
|
export function buildSummary(runs) {
|
|
86
105
|
runs = runs.map((run) => ({ ...run, criteria: flattenCriteria(run.criteria) }));
|
|
87
106
|
const verifierCriteria = summarizeCriteria(runs);
|
package/src/verifier-runner.js
CHANGED
|
@@ -53,6 +53,18 @@ async function acquireVerifierLock(projectRoot, timeoutSeconds) {
|
|
|
53
53
|
};
|
|
54
54
|
} catch (error) {
|
|
55
55
|
if (error?.code !== "EEXIST") throw error;
|
|
56
|
+
// A killed benchmark worker cannot run its finally block. Reclaim only
|
|
57
|
+
// a lock whose recorded owner is no longer alive; active workers keep
|
|
58
|
+
// exclusive ownership of fixed Docker ports.
|
|
59
|
+
try {
|
|
60
|
+
const owner = Number(fs.readFileSync(lockPath, "utf8").trim());
|
|
61
|
+
process.kill(owner, 0);
|
|
62
|
+
} catch (ownerError) {
|
|
63
|
+
if (ownerError?.code === "ESRCH" || !Number.isInteger(Number(fs.readFileSync(lockPath, "utf8").trim()))) {
|
|
64
|
+
try { fs.rmSync(lockPath, { force: true }); } catch {}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
56
68
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
57
69
|
}
|
|
58
70
|
}
|