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.
Files changed (2) hide show
  1. package/agent.js +6 -2
  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: 2e9,
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: 2e9,
28461
+ NanoCpus: await runnerCpuCount(client) * 1e9,
28458
28462
  PidsLimit: 512,
28459
28463
  AutoRemove: false,
28460
28464
  Init: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aglio-worker",
3
- "version": "0.8.0",
3
+ "version": "0.9.2",
4
4
  "description": "Host machine agent for Aglio: claims jobs over the API and starts aglio-runner containers.",
5
5
  "type": "module",
6
6
  "bin": {