@andersbakken/fisk 4.0.64 → 4.0.66
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/builder/VM_runtime.js +12 -1
- package/builder/fisk-builder.js +35 -10
- package/monitor/fisk-monitor.js +1 -0
- package/package.json +2 -2
- package/scheduler/fisk-scheduler.js +32 -21
package/builder/VM_runtime.js
CHANGED
|
@@ -3071,7 +3071,9 @@ class Compile extends EventEmitter__default["default"] {
|
|
|
3071
3071
|
case "-cxx-isystem":
|
|
3072
3072
|
case "-isysroot":
|
|
3073
3073
|
case "-isystem":
|
|
3074
|
+
case "-iquote":
|
|
3074
3075
|
case "-I":
|
|
3076
|
+
case "-F":
|
|
3075
3077
|
args.splice(i--, 2);
|
|
3076
3078
|
break;
|
|
3077
3079
|
case "-x":
|
|
@@ -3120,7 +3122,16 @@ class Compile extends EventEmitter__default["default"] {
|
|
|
3120
3122
|
++i;
|
|
3121
3123
|
break;
|
|
3122
3124
|
default:
|
|
3123
|
-
if (
|
|
3125
|
+
if (args[i].startsWith("-mlinker-version=") ||
|
|
3126
|
+
args[i].startsWith("-stdlib=") ||
|
|
3127
|
+
args[i].startsWith("-I") ||
|
|
3128
|
+
args[i].startsWith("-F") ||
|
|
3129
|
+
args[i].startsWith("-isystem") ||
|
|
3130
|
+
args[i].startsWith("-isysroot") ||
|
|
3131
|
+
args[i].startsWith("-cxx-isystem") ||
|
|
3132
|
+
args[i].startsWith("-iquote") ||
|
|
3133
|
+
args[i].startsWith("--sysroot=") ||
|
|
3134
|
+
args[i].startsWith("--gcc-toolchain=")) {
|
|
3124
3135
|
args.splice(i--, 1);
|
|
3125
3136
|
break;
|
|
3126
3137
|
}
|
package/builder/fisk-builder.js
CHANGED
|
@@ -60147,7 +60147,15 @@ function getFromCache(job, cb) {
|
|
|
60147
60147
|
let sendBuffer = buffer;
|
|
60148
60148
|
// Decompress if client doesn't support compressed responses from cache
|
|
60149
60149
|
if (!sendCompressed && buffer.byteLength > 0) {
|
|
60150
|
-
|
|
60150
|
+
try {
|
|
60151
|
+
sendBuffer = zlib__default["default"].gunzipSync(buffer);
|
|
60152
|
+
}
|
|
60153
|
+
catch (gunzipErr) {
|
|
60154
|
+
assert__default["default"](objectCache, "Must have objectCache");
|
|
60155
|
+
console.error(`Failed to gunzip ${path__default["default"].join(objectCache.dir, item.response.sha1)} for file index ${fileIdx}:`, gunzipErr);
|
|
60156
|
+
finish(gunzipErr);
|
|
60157
|
+
return;
|
|
60158
|
+
}
|
|
60151
60159
|
}
|
|
60152
60160
|
job.send(sendBuffer);
|
|
60153
60161
|
pos += read;
|
|
@@ -60501,7 +60509,22 @@ client.on("getEnvironments", (message) => {
|
|
|
60501
60509
|
fs$3.mkdirpSync(dir);
|
|
60502
60510
|
const file = path__default["default"].join(dir, "env.tar.gz");
|
|
60503
60511
|
const writeStream = fs$3.createWriteStream(file);
|
|
60512
|
+
let writeStreamFailed = false;
|
|
60513
|
+
writeStream.on("error", (err) => {
|
|
60514
|
+
writeStreamFailed = true;
|
|
60515
|
+
console.error("Got writeStream error for", file, err);
|
|
60516
|
+
try {
|
|
60517
|
+
fs$3.removeSync(dir);
|
|
60518
|
+
}
|
|
60519
|
+
catch (rmErr) {
|
|
60520
|
+
/* */
|
|
60521
|
+
}
|
|
60522
|
+
setTimeout(work, 0);
|
|
60523
|
+
});
|
|
60504
60524
|
writeStream.on("finish", () => {
|
|
60525
|
+
if (writeStreamFailed) {
|
|
60526
|
+
return;
|
|
60527
|
+
}
|
|
60505
60528
|
console.log("Got finish", env);
|
|
60506
60529
|
exec("tar xf '" + file + "'", { cwd: dir })
|
|
60507
60530
|
.then(() => {
|
|
@@ -60545,24 +60568,26 @@ client.on("getEnvironments", (message) => {
|
|
|
60545
60568
|
});
|
|
60546
60569
|
axios({ method: "get", url: url, responseType: "stream" })
|
|
60547
60570
|
.then((response) => {
|
|
60571
|
+
response.data.on("error", (err) => {
|
|
60572
|
+
console.error("Got error from environment download stream", url, err);
|
|
60573
|
+
if (writeStream.destroy instanceof Function) {
|
|
60574
|
+
writeStream.destroy(err);
|
|
60575
|
+
}
|
|
60576
|
+
else {
|
|
60577
|
+
writeStream.end();
|
|
60578
|
+
}
|
|
60579
|
+
});
|
|
60548
60580
|
response.data.pipe(writeStream);
|
|
60549
|
-
// console
|
|
60550
60581
|
})
|
|
60551
60582
|
.catch((error) => {
|
|
60552
60583
|
console.log("Got error from request", error);
|
|
60584
|
+
// writeStream.on("error", ...) handles dir cleanup and work() reschedule.
|
|
60553
60585
|
if (writeStream.destroy instanceof Function) {
|
|
60554
|
-
writeStream.destroy();
|
|
60586
|
+
writeStream.destroy(error instanceof Error ? error : new Error(String(error)));
|
|
60555
60587
|
}
|
|
60556
60588
|
else {
|
|
60557
60589
|
writeStream.end();
|
|
60558
60590
|
}
|
|
60559
|
-
try {
|
|
60560
|
-
fs$3.removeSync(dir);
|
|
60561
|
-
}
|
|
60562
|
-
catch (err) {
|
|
60563
|
-
/* */
|
|
60564
|
-
}
|
|
60565
|
-
fs$3.mkdirpSync(dir);
|
|
60566
60591
|
});
|
|
60567
60592
|
};
|
|
60568
60593
|
work();
|
package/monitor/fisk-monitor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andersbakken/fisk",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.66",
|
|
4
4
|
"description": "Fisk, a distributed compile system",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint . --ext .ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"prettier": "^2.8.2",
|
|
75
75
|
"rollup": "^2.38.4",
|
|
76
76
|
"rollup-plugin-hashbang": "^3.0.0",
|
|
77
|
-
"rollup-plugin-typescript2": "^0.
|
|
77
|
+
"rollup-plugin-typescript2": "^0.37.0",
|
|
78
78
|
"run-p": "^0.0.0"
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -139,7 +139,12 @@ class Database {
|
|
|
139
139
|
resolve(JSON.parse(data));
|
|
140
140
|
}
|
|
141
141
|
catch (error) {
|
|
142
|
-
|
|
142
|
+
try {
|
|
143
|
+
fs__default["default"].renameSync(this.path, this.path + ".error");
|
|
144
|
+
}
|
|
145
|
+
catch (renameErr) {
|
|
146
|
+
console.error("Failed to quarantine corrupt DB file", this.path, renameErr);
|
|
147
|
+
}
|
|
143
148
|
reject(new Error(`Failed to parse JSON from file: ${this.path} ${error.message}`));
|
|
144
149
|
}
|
|
145
150
|
}
|
|
@@ -3659,7 +3664,8 @@ class Environments {
|
|
|
3659
3664
|
if (st.isDirectory()) {
|
|
3660
3665
|
// we're good
|
|
3661
3666
|
this._path = p;
|
|
3662
|
-
fs$4.readdir(p)
|
|
3667
|
+
fs$4.readdir(p)
|
|
3668
|
+
.then((files) => {
|
|
3663
3669
|
const promises = [];
|
|
3664
3670
|
files.forEach((e) => {
|
|
3665
3671
|
if (e.length === 47 && e.indexOf(".tar.gz", 40) === 40) {
|
|
@@ -3678,13 +3684,12 @@ class Environments {
|
|
|
3678
3684
|
}));
|
|
3679
3685
|
}
|
|
3680
3686
|
});
|
|
3681
|
-
Promise.all(promises).then(() => {
|
|
3687
|
+
return Promise.all(promises).then(() => {
|
|
3682
3688
|
resolve();
|
|
3683
3689
|
});
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
// }, 1000);
|
|
3690
|
+
})
|
|
3691
|
+
.catch((err) => {
|
|
3692
|
+
reject(`Failed to read environments directory ${p}: ${err}`);
|
|
3688
3693
|
});
|
|
3689
3694
|
}
|
|
3690
3695
|
else {
|
|
@@ -3720,15 +3725,12 @@ class Environments {
|
|
|
3720
3725
|
return new File(path__default["default"].join(this._path, `${environment.hash}.tar.gz`), environment.hash);
|
|
3721
3726
|
}
|
|
3722
3727
|
complete(file) {
|
|
3723
|
-
return
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
this._data[file.hash] = env;
|
|
3730
|
-
resolve();
|
|
3731
|
-
});
|
|
3728
|
+
return untarFile(file.path, "etc/compiler_info").then((data) => {
|
|
3729
|
+
const idx = data.indexOf("\n");
|
|
3730
|
+
const info = JSON.parse(data.substr(0, idx));
|
|
3731
|
+
const env = new Environment(file.path, file.hash, info.system, info.originalPath);
|
|
3732
|
+
env.info = data.substr(idx + 1);
|
|
3733
|
+
this._data[file.hash] = env;
|
|
3732
3734
|
});
|
|
3733
3735
|
}
|
|
3734
3736
|
hasEnvironment(hash) {
|
|
@@ -3807,21 +3809,24 @@ class Environments {
|
|
|
3807
3809
|
return this._db.set("links", this.linksInfo());
|
|
3808
3810
|
}
|
|
3809
3811
|
remove(hash) {
|
|
3810
|
-
// ### this should be promisified
|
|
3811
3812
|
const env = this._data[hash];
|
|
3812
3813
|
if (!env) {
|
|
3813
3814
|
return;
|
|
3814
3815
|
}
|
|
3815
3816
|
try {
|
|
3816
3817
|
fs$4.removeSync(env.path);
|
|
3817
|
-
delete this._data[hash];
|
|
3818
|
-
this.unlink(hash);
|
|
3819
|
-
this.unlink(undefined, hash);
|
|
3820
|
-
this.syncLinks();
|
|
3821
3818
|
}
|
|
3822
3819
|
catch (err) {
|
|
3823
3820
|
console.error("Failed to remove environment", env.path, err);
|
|
3821
|
+
return;
|
|
3824
3822
|
}
|
|
3823
|
+
delete this._data[hash];
|
|
3824
|
+
this.unlink(hash)
|
|
3825
|
+
.then(() => this.unlink(undefined, hash))
|
|
3826
|
+
.then(() => this.syncLinks())
|
|
3827
|
+
.catch((err) => {
|
|
3828
|
+
console.error("Failed to unlink environment metadata", env.path, err);
|
|
3829
|
+
});
|
|
3825
3830
|
}
|
|
3826
3831
|
}
|
|
3827
3832
|
Environments.instance = new Environments();
|
|
@@ -58415,6 +58420,12 @@ server.on("listen", (app) => {
|
|
|
58415
58420
|
rstream.on("error", (err) => {
|
|
58416
58421
|
console.error("Got read stream error for", env.path, err);
|
|
58417
58422
|
rstream.close();
|
|
58423
|
+
if (!res.headersSent) {
|
|
58424
|
+
res.sendStatus(500);
|
|
58425
|
+
}
|
|
58426
|
+
else {
|
|
58427
|
+
res.destroy(err);
|
|
58428
|
+
}
|
|
58418
58429
|
});
|
|
58419
58430
|
rstream.pipe(res);
|
|
58420
58431
|
});
|