hammerkit 2.2.0-next.2 → 2.2.0-next.4
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/dist/dashboard/assets/{graph-canvas-D6GMgkoe.js → graph-canvas-D2f3lNda.js} +1 -1
- package/dist/dashboard/assets/{index-BNq9j5Jo.js → index-DE3NTbjw.js} +4 -4
- package/dist/dashboard/index.html +1 -1
- package/dist/executer/deadline.js +2 -3
- package/dist/executer/docker-task.js +19 -2
- package/dist/executer/execution-steps.js +36 -1
- package/dist/executer/get-container-binds.js +2 -1
- package/dist/remote/remote-status.js +2 -3
- package/dist/remote/remote-work-commands.js +16 -6
- package/dist/server/proposal-store.js +94 -0
- package/dist/server/proposals-api.js +3 -0
- package/dist/server/proposals.js +168 -19
- package/dist/server/runs.js +23 -18
- package/dist/server/server-config.js +6 -2
- package/dist/server/server.js +17 -2
- package/dist/utils/long-timer.js +33 -0
- package/package.json +1 -1
package/dist/server/server.js
CHANGED
|
@@ -35,6 +35,7 @@ const definitions_api_1 = require("./definitions-api");
|
|
|
35
35
|
const approvals_api_1 = require("./approvals-api");
|
|
36
36
|
const proposals_api_1 = require("./proposals-api");
|
|
37
37
|
const proposals_1 = require("./proposals");
|
|
38
|
+
const proposal_store_1 = require("./proposal-store");
|
|
38
39
|
const sources_1 = require("./sources");
|
|
39
40
|
const sources_api_1 = require("./sources-api");
|
|
40
41
|
const sandbox_follow_1 = require("./sandbox-follow");
|
|
@@ -90,6 +91,8 @@ const MAX_WAIT_MS = 50000;
|
|
|
90
91
|
const CHECK_SWEEP_MS = 6 * 60 * 60 * 1000;
|
|
91
92
|
// how often the outputs of runs that are over their time are removed
|
|
92
93
|
const ARTIFACT_SWEEP_MS = 60 * 60 * 1000;
|
|
94
|
+
// how long a run or a proposed version waits for its approval, unset: until somebody decides
|
|
95
|
+
const approvalTimeoutOf = (config) => config.approvals.timeout === undefined ? undefined : (0, units_1.parseDuration)(config.approvals.timeout);
|
|
93
96
|
// Server-sent events: `id` is the sequence number, so a client that lost the
|
|
94
97
|
// connection continues with Last-Event-ID (or ?after=) and misses nothing.
|
|
95
98
|
function streamEvents(registry, config, principal, id, req, res, url) {
|
|
@@ -1093,7 +1096,7 @@ async function startServer(config, environment, options = {}) {
|
|
|
1093
1096
|
maxConcurrent: config.runs.maxConcurrent,
|
|
1094
1097
|
keep: config.runs.keep,
|
|
1095
1098
|
maxWaiting: config.approvals.maxWaiting,
|
|
1096
|
-
approvalTimeout: (
|
|
1099
|
+
approvalTimeout: approvalTimeoutOf(config),
|
|
1097
1100
|
limits: config.runs.limits,
|
|
1098
1101
|
maxDuration: (0, units_1.parseDuration)(config.runs.maxDuration),
|
|
1099
1102
|
maxLogBytes: config.runs.maxLogBytes,
|
|
@@ -1142,9 +1145,20 @@ async function startServer(config, environment, options = {}) {
|
|
|
1142
1145
|
void sweepArtifacts();
|
|
1143
1146
|
const proposals = new proposals_1.ProposalRegistry({
|
|
1144
1147
|
maxWaiting: config.approvals.maxWaiting,
|
|
1145
|
-
|
|
1148
|
+
maxWaitingPerProposer: config.approvals.maxWaitingPerProposer,
|
|
1149
|
+
timeout: approvalTimeoutOf(config),
|
|
1146
1150
|
cooldown: (0, units_1.parseDuration)(config.approvals.cooldown),
|
|
1151
|
+
store: new proposal_store_1.FileProposalStore((0, path_1.join)(storage, 'proposals')),
|
|
1152
|
+
// what waited reads its files again, as a proposal does (no fetch from git). The principal
|
|
1153
|
+
// { iss: 'restart', sub: 'restart' } is a placeholder: prepare only reads the files, and
|
|
1154
|
+
// nothing is recorded as its doing
|
|
1155
|
+
prepare: (bundle) => definitions
|
|
1156
|
+
.prepare(bundle, { iss: 'restart', sub: 'restart' }, { noRemote: 'proposal' })
|
|
1157
|
+
.then(({ version }) => version),
|
|
1158
|
+
log,
|
|
1147
1159
|
});
|
|
1160
|
+
// take back what waited when the server last stopped, with its cooldowns
|
|
1161
|
+
await proposals.restore();
|
|
1148
1162
|
const login = config.endpoints?.login;
|
|
1149
1163
|
const gateway = config.endpoints
|
|
1150
1164
|
? new endpoints_1.EndpointGateway(config, registry, {
|
|
@@ -1287,6 +1301,7 @@ async function startServer(config, environment, options = {}) {
|
|
|
1287
1301
|
clearInterval(sweeping);
|
|
1288
1302
|
clearInterval(sweepingArtifacts);
|
|
1289
1303
|
proposals.close();
|
|
1304
|
+
await proposals.flush();
|
|
1290
1305
|
follower.close();
|
|
1291
1306
|
sandboxSync.close();
|
|
1292
1307
|
await registry.close();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLongTimeout = exports.MAX_TIMER_MS = void 0;
|
|
4
|
+
// the longest delay of setTimeout: Node fires a longer one after 1 ms
|
|
5
|
+
exports.MAX_TIMER_MS = 2 ** 31 - 1;
|
|
6
|
+
// setTimeout for any delay. A delay longer than a timer can wait (about 24.8 days) waits
|
|
7
|
+
// in steps of the longest one, then fires at its time. The timers do not keep the process
|
|
8
|
+
// alive. Returns what cancels the delay.
|
|
9
|
+
function setLongTimeout(callback, ms) {
|
|
10
|
+
let timer;
|
|
11
|
+
const wait = (left) => {
|
|
12
|
+
const step = Math.min(left, exports.MAX_TIMER_MS);
|
|
13
|
+
timer = setTimeout(() => {
|
|
14
|
+
timer = undefined;
|
|
15
|
+
if (left > step) {
|
|
16
|
+
wait(left - step);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
callback();
|
|
20
|
+
}
|
|
21
|
+
}, step);
|
|
22
|
+
timer.unref();
|
|
23
|
+
};
|
|
24
|
+
wait(Math.max(0, ms));
|
|
25
|
+
return () => {
|
|
26
|
+
if (timer) {
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
timer = undefined;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
exports.setLongTimeout = setLongTimeout;
|
|
33
|
+
//# sourceMappingURL=long-timer.js.map
|
package/package.json
CHANGED