aglio-worker 0.8.0 → 0.9.2
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/agent.js +6 -2
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -28246,6 +28246,10 @@ import { existsSync } from "node:fs";
|
|
|
28246
28246
|
import { PassThrough } from "node:stream";
|
|
28247
28247
|
import { join, posix, relative, resolve } from "node:path";
|
|
28248
28248
|
import Dockerode from "dockerode";
|
|
28249
|
+
async function runnerCpuCount(client) {
|
|
28250
|
+
const info = await client.info().catch(() => null);
|
|
28251
|
+
return Math.max(1, Math.min(2, Math.floor(info?.NCPU ?? 1)));
|
|
28252
|
+
}
|
|
28249
28253
|
var CONTAINER_WORKSPACE = "/workspace";
|
|
28250
28254
|
function isRunningInContainer() {
|
|
28251
28255
|
return existsSync("/.dockerenv") || existsSync("/run/.containerenv");
|
|
@@ -28328,7 +28332,7 @@ async function createDockerJobExecutor(input2) {
|
|
|
28328
28332
|
Binds: [`${hostPath}:${CONTAINER_WORKSPACE}`],
|
|
28329
28333
|
NetworkMode: networkMode,
|
|
28330
28334
|
Memory: 4 * 1024 * 1024 * 1024,
|
|
28331
|
-
NanoCpus:
|
|
28335
|
+
NanoCpus: await runnerCpuCount(client) * 1e9,
|
|
28332
28336
|
PidsLimit: 1024,
|
|
28333
28337
|
AutoRemove: false,
|
|
28334
28338
|
Init: true,
|
|
@@ -28454,7 +28458,7 @@ async function createDockerLoginContainer(input2) {
|
|
|
28454
28458
|
NetworkMode: "bridge",
|
|
28455
28459
|
ExtraHosts: input2.extraHosts ?? [],
|
|
28456
28460
|
Memory: 2 * 1024 * 1024 * 1024,
|
|
28457
|
-
NanoCpus:
|
|
28461
|
+
NanoCpus: await runnerCpuCount(client) * 1e9,
|
|
28458
28462
|
PidsLimit: 512,
|
|
28459
28463
|
AutoRemove: false,
|
|
28460
28464
|
Init: true,
|