@nosana/node 1.1.88-rc → 1.1.89-dev.mr94.17923173279

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/.env CHANGED
@@ -1,6 +1,6 @@
1
1
  BACKEND_SOLANA_ADDRESS=7rFPFnxjXHC2sfDy3qrDa9pEb4j49oivMuV7e8sYDPmB
2
2
  FRP_SERVER_IMAGE=registry.hub.docker.com/nosana/frpc:v1.0.45
3
- JOB_RUNTIME_IMAGE="nosana/job-runtime:v0.3.2"
3
+ JOB_RUNTIME_IMAGE=nosana/job-runtime:dev-mr94-76904514
4
4
  GOLDEN_VM_IMAGE=https://models.nosana.io/golden-vm/cuda13-580-dev-2/golden-vm-cuda13-580-dev-2.qcow2
5
5
  RESOURCE_MANAGER_IMAGE=registry.hub.docker.com/nosana/resource-manager:v1.1.19
6
6
  FRP_SERVER_PORT=7000
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.88-rc",
3
+ "version": "1.1.89-dev.mr94.17923173279",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -75,11 +75,11 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@inquirer/prompts": "^4.3.0",
78
- "@nosana/kit": "^2.24.4",
78
+ "@nosana/kit": "^2.24.5",
79
79
  "@nosana/pools-program": "^2.24.3",
80
80
  "@nosana/rewards-program": "^2.24.3",
81
- "@nosana/ssh": "^2.24.4",
82
- "@nosana/types": "^2.24.4",
81
+ "@nosana/ssh": "^2.24.5",
82
+ "@nosana/types": "^2.24.5",
83
83
  "@solana/kit": "^8.3.0",
84
84
  "chalk": "^5.3.0",
85
85
  "cli-progress": "^3.12.0",
@@ -1,3 +1,4 @@
1
+ import os from 'node:os';
1
2
  function parseRestartPolicy(restart_policy) {
2
3
  if (typeof restart_policy === 'string') {
3
4
  return restart_policy ? { Name: restart_policy, MaximumRetryCount: 0 } : undefined;
@@ -76,6 +77,10 @@ export function createDockerRunOptions(image, { name, cmd, gpu, volumes, env, wo
76
77
  ...(security?.noNewPrivileges
77
78
  ? { SecurityOpt: ['no-new-privileges'] }
78
79
  : {}),
80
+ // MemorySwap is memory plus swap: equal to Memory, it leaves no swap.
81
+ ...(security?.noSwap
82
+ ? { Memory: os.totalmem(), MemorySwap: os.totalmem() }
83
+ : {}),
79
84
  ...(group_add ? { GroupAdd: group_add } : {}),
80
85
  ...(shm_size ? { ShmSize: shm_size } : {}),
81
86
  },
@@ -37,6 +37,7 @@ export type RunContainerArgs = {
37
37
  pidsLimit?: number;
38
38
  /** Keeps the container's processes from gaining privileges (setuid etc.). */
39
39
  noNewPrivileges?: boolean;
40
+ noSwap?: boolean;
40
41
  };
41
42
  /** The user (`uid[:gid]`) the container runs as; the image's by default. */
42
43
  user?: string;
@@ -15,9 +15,13 @@ export declare function createPodmanRunOptions(image: string, args: RunContainer
15
15
  user?: string | undefined;
16
16
  no_new_privileges?: boolean | undefined;
17
17
  resource_limits?: {
18
- pids: {
18
+ memory?: {
19
19
  limit: number;
20
- };
20
+ swap: number;
21
+ } | undefined;
22
+ pids?: {
23
+ limit: number;
24
+ } | undefined;
21
25
  } | undefined;
22
26
  cap_drop?: string[] | undefined;
23
27
  hostadd: string[];
@@ -66,9 +70,13 @@ export declare function createPodmanRunOptions(image: string, args: RunContainer
66
70
  user?: string | undefined;
67
71
  no_new_privileges?: boolean | undefined;
68
72
  resource_limits?: {
69
- pids: {
73
+ memory?: {
70
74
  limit: number;
71
- };
75
+ swap: number;
76
+ } | undefined;
77
+ pids?: {
78
+ limit: number;
79
+ } | undefined;
72
80
  } | undefined;
73
81
  cap_drop?: string[] | undefined;
74
82
  hostadd: string[];
@@ -118,9 +126,13 @@ export declare function createPodmanRunOptions(image: string, args: RunContainer
118
126
  user?: string | undefined;
119
127
  no_new_privileges?: boolean | undefined;
120
128
  resource_limits?: {
121
- pids: {
129
+ memory?: {
122
130
  limit: number;
123
- };
131
+ swap: number;
132
+ } | undefined;
133
+ pids?: {
134
+ limit: number;
135
+ } | undefined;
124
136
  } | undefined;
125
137
  cap_drop?: string[] | undefined;
126
138
  hostadd: string[];
@@ -1,3 +1,4 @@
1
+ import os from 'node:os';
1
2
  import { ifStringCastToArray } from '../../utils/ifStringCastToArray.js';
2
3
  // These extra types are required because interface.ts
3
4
  function parseRestartPolicy(restart_policy) {
@@ -37,6 +38,14 @@ export function createPodmanRunOptions(image, args, gpuOption) {
37
38
  if (runtime === 'SEV-GUEST') {
38
39
  devices.push({ path: '/dev/sev-guest' });
39
40
  }
41
+ // libpod takes limits under resource_limits; a top-level key is ignored.
42
+ // memory.swap is memory plus swap: equal to the limit, it leaves no swap.
43
+ const resourceLimits = {
44
+ ...(security?.pidsLimit ? { pids: { limit: security.pidsLimit } } : {}),
45
+ ...(security?.noSwap
46
+ ? { memory: { limit: os.totalmem(), swap: os.totalmem() } }
47
+ : {}),
48
+ };
40
49
  return {
41
50
  image,
42
51
  name,
@@ -75,9 +84,8 @@ export function createPodmanRunOptions(image, args, gpuOption) {
75
84
  cgroups_mode: 'enabled',
76
85
  work_dir,
77
86
  ...(security?.capDrop ? { cap_drop: security.capDrop } : {}),
78
- // libpod takes limits under resource_limits; a top-level key is ignored.
79
- ...(security?.pidsLimit
80
- ? { resource_limits: { pids: { limit: security.pidsLimit } } }
87
+ ...(Object.keys(resourceLimits).length > 0
88
+ ? { resource_limits: resourceLimits }
81
89
  : {}),
82
90
  ...(security?.noNewPrivileges ? { no_new_privileges: true } : {}),
83
91
  ...(user ? { user } : {}),
@@ -118,6 +118,11 @@ export interface InlineJob {
118
118
  project: string;
119
119
  /** Surfaced to workloads as %%global.host%%. */
120
120
  host: string;
121
+ /**
122
+ * Keeps every operation's container out of swap, so nothing a workload
123
+ * holds in memory is written to the host's disk.
124
+ */
125
+ noSwap?: boolean;
121
126
  }
122
127
  export interface SignAuthResponse {
123
128
  authorization: string;
@@ -172,6 +172,7 @@ export class ContainerProvider {
172
172
  ? { shm_size: parseShmSize(op.args.shm_size) }
173
173
  : {}),
174
174
  runtime: teeRuntime,
175
+ ...(this.config.noSwap ? { security: { noSwap: true } } : {}),
175
176
  labels: {
176
177
  [JOB_LABEL]: flow.id,
177
178
  [OP_LABEL]: op.id,
@@ -1,4 +1,10 @@
1
1
  import { ExposedPort, Operation } from '@nosana/kit';
2
+ /**
3
+ * A port exposed as raw TCP (`type: 'tcp'` in the job definition). It is
4
+ * published as a tcpmux proxy behind the FRP server's HTTP CONNECT port, the
5
+ * way the SSH sidecar publishes sshgw, instead of as an HTTP vhost.
6
+ */
7
+ export declare const isTcpPort: (exposedPort: ExposedPort) => boolean;
2
8
  export declare function generateProxyConfig(serverAddr: string, generatedId: string, operationId: string | null, name: string, exposedPort: ExposedPort, op: Operation<'container/run'>, generatedDeploymentId: string | undefined, proxyHTTPHealthCheckPath: undefined | string): Object;
3
9
  export declare const generateProxies: (serverAddr: string, flowId: string, op: Operation<"container/run">, opIndex: number, ports: ExposedPort[], name: string, operationId: string | null, deploymentId?: string | undefined) => {
4
10
  proxies: Object[];
@@ -1,4 +1,11 @@
1
+ import { ServiceType, } from '@nosana/kit';
1
2
  import { generateExposeId } from '../../../common/src/index.js';
3
+ /**
4
+ * A port exposed as raw TCP (`type: 'tcp'` in the job definition). It is
5
+ * published as a tcpmux proxy behind the FRP server's HTTP CONNECT port, the
6
+ * way the SSH sidecar publishes sshgw, instead of as an HTTP vhost.
7
+ */
8
+ export const isTcpPort = (exposedPort) => exposedPort.type === ServiceType.TCP;
2
9
  export function generateProxyConfig(serverAddr, generatedId, operationId, name, exposedPort, op, generatedDeploymentId, proxyHTTPHealthCheckPath) {
3
10
  return {
4
11
  name: `${generatedId}-${operationId}`,
@@ -6,6 +13,10 @@ export function generateProxyConfig(serverAddr, generatedId, operationId, name,
6
13
  localPorts: exposedPort.port.toString(),
7
14
  opId: op.id,
8
15
  customDomain: generatedId + '.' + serverAddr,
16
+ ...(isTcpPort(exposedPort) && {
17
+ type: 'tcpmux',
18
+ multiplexer: 'httpconnect',
19
+ }),
9
20
  ...(generatedDeploymentId && {
10
21
  deploymentDomain: generatedDeploymentId + '.' + serverAddr,
11
22
  deploymentLoadBalancerGroup: `${generatedDeploymentId}-${exposedPort.port}`,
@@ -23,7 +34,9 @@ export const generateProxies = (serverAddr, flowId, op, opIndex, ports, name, op
23
34
  const generatedId = generateExposeId(flowId, opIndex, exposedPort.port, op.args.private);
24
35
  // When an op exposes more than one port, include the port in the id so each
25
36
  // port gets a distinct deployment endpoint instead of colliding on a shared one.
26
- const generatedDeploymentId = deploymentId
37
+ // A TCP port never joins the deployment's endpoint: that is an HTTP
38
+ // load-balancer group, and a TCP session has to land on this replica.
39
+ const generatedDeploymentId = deploymentId && !isTcpPort(exposedPort)
27
40
  ? generateExposeId(deploymentId, op.id, ports.length > 1 ? exposedPort.port : 0, false)
28
41
  : undefined;
29
42
  let proxyHTTPHealthCheckPath = undefined;
@@ -58,4 +58,6 @@ export type ContainerProviderConfig = {
58
58
  };
59
59
  /** Adds a `gpu` block to a GPU operation's stats. */
60
60
  gpu?: GpuSampler;
61
+ /** Keeps every operation's container out of swap (see InlineJob.noSwap). */
62
+ noSwap?: boolean;
61
63
  };
@@ -120,7 +120,7 @@ export async function runJob(config) {
120
120
  : undefined;
121
121
  const events = new EventEmitter();
122
122
  const sshAccess = new SshAccessManager(store, (jobId) => orchestration.getContainersByLabels(sshSidecarFilters(jobId), { all: true }));
123
- const provider = new ContainerProvider(orchestration, store, resources, (jobId, sidecar) => sshAccess.prepare(jobId, sidecar), { frp: config.frp, gpu: createGpuSampler() });
123
+ const provider = new ContainerProvider(orchestration, store, resources, (jobId, sidecar) => sshAccess.prepare(jobId, sidecar), { frp: config.frp, gpu: createGpuSampler(), noSwap: inline?.noSwap === true });
124
124
  // Aborts what is in flight when the node stops the job: resolution, the
125
125
  // api-listen waits, requests to the node.
126
126
  const stopping = new AbortController();
@@ -16,6 +16,7 @@ export interface JobRuntimeSessionOptions {
16
16
  project: string;
17
17
  /** An inline run's definition; absent for an onchain job. */
18
18
  inline?: JobDefinition;
19
+ noSwap?: boolean;
19
20
  /** The sidecar's status as it sends it, while the socket is served. */
20
21
  onStatus?: (status: JobRuntimeStatus) => void;
21
22
  /** What the sidecar's console carries (see JobRuntimeConsole). */
@@ -69,11 +69,20 @@ export class JobRuntimeSession {
69
69
  // override a directory's permissions, and it is the only thing that
70
70
  // sees this one.
71
71
  await fs.chmod(this.dir, 0o777);
72
- const { environment, inline, project } = this.options;
72
+ const { environment, inline, project, noSwap } = this.options;
73
73
  const seed = {
74
74
  version: JOB_RUNTIME_SEED_VERSION,
75
75
  resources: environment.cacheSnapshot(),
76
- ...(inline ? { inline: { definition: inline, project, host: project } } : {}),
76
+ ...(inline
77
+ ? {
78
+ inline: {
79
+ definition: inline,
80
+ project,
81
+ host: project,
82
+ ...(noSwap ? { noSwap: true } : {}),
83
+ },
84
+ }
85
+ : {}),
77
86
  };
78
87
  writeJsonAtomic(path.join(this.dir, JOB_RUNTIME_FILES.seed), seed);
79
88
  await this.host.listen();
@@ -56,6 +56,7 @@ export class Benchmark {
56
56
  jobAddress: this.benchmarkId,
57
57
  project: node,
58
58
  inline: this.jobDefinition,
59
+ noSwap: true,
59
60
  onStatus: (status) => emitBenchmark('progress', 'call', {
60
61
  completed: status.opStates.filter((op) => FINISHED_OP_STATUSES.has(op.status ?? '')).length,
61
62
  total,
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.88-rc",
3
+ "version": "1.1.89-dev.mr94.17923173279",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.1.88-rc",
9
+ "version": "1.1.89-dev.mr94.17923173279",
10
10
  "license": "ISC",
11
11
  "workspaces": [
12
12
  "packages/*"
13
13
  ],
14
14
  "dependencies": {
15
15
  "@inquirer/prompts": "^4.3.0",
16
- "@nosana/kit": "^2.24.4",
16
+ "@nosana/kit": "^2.24.5",
17
17
  "@nosana/pools-program": "^2.24.3",
18
18
  "@nosana/rewards-program": "^2.24.3",
19
- "@nosana/ssh": "^2.24.4",
20
- "@nosana/types": "^2.24.4",
19
+ "@nosana/ssh": "^2.24.5",
20
+ "@nosana/types": "^2.24.5",
21
21
  "@solana/kit": "^8.3.0",
22
22
  "chalk": "^5.3.0",
23
23
  "cli-progress": "^3.12.0",
@@ -1281,14 +1281,14 @@
1281
1281
  }
1282
1282
  },
1283
1283
  "node_modules/@nosana/api": {
1284
- "version": "2.24.4",
1285
- "resolved": "https://registry.npmjs.org/@nosana/api/-/api-2.24.4.tgz",
1286
- "integrity": "sha512-nOJiyoFzOsLrql0SsLIgriaxVZHhpH9Ok/1f+TXX3KS/N8QT10JYygnQId9v/pNU87+bgB1ILqP8Sh37Z5SbUA==",
1284
+ "version": "2.24.5",
1285
+ "resolved": "https://registry.npmjs.org/@nosana/api/-/api-2.24.5.tgz",
1286
+ "integrity": "sha512-dYHjetjUnsS2BKaUsDkFL/8tXV9u4d7hamMVoTK32FhqPdooLFAvjCD97rrPEtsLe8EeiHaYJKU8Wur1A4OQCA==",
1287
1287
  "license": "MIT",
1288
1288
  "dependencies": {
1289
1289
  "@nosana/authorization": "2.24.3",
1290
- "@nosana/ssh": "2.24.4",
1291
- "@nosana/types": "2.24.4",
1290
+ "@nosana/ssh": "2.24.5",
1291
+ "@nosana/types": "2.24.5",
1292
1292
  "eventsource": "^4.1.0",
1293
1293
  "openapi-fetch": "^0.14.0"
1294
1294
  },
@@ -1356,12 +1356,12 @@
1356
1356
  "link": true
1357
1357
  },
1358
1358
  "node_modules/@nosana/endpoints": {
1359
- "version": "2.24.4",
1360
- "resolved": "https://registry.npmjs.org/@nosana/endpoints/-/endpoints-2.24.4.tgz",
1361
- "integrity": "sha512-4uXL4Xc/6txANmkZVz8nrF0pXqe4YOrr3Jwse27y1TtdwfUxvn07t36dBINaWyiy/fAwYAQx/gFS/2ych125WA==",
1359
+ "version": "2.24.5",
1360
+ "resolved": "https://registry.npmjs.org/@nosana/endpoints/-/endpoints-2.24.5.tgz",
1361
+ "integrity": "sha512-oEfzOafCX1voZa+W08oc1rAgJuvX8g809kEXZRJofK6eeP8N0sOjtf9PAcgYlmOg3m5FGMHijTyUbTMWrsIBEQ==",
1362
1362
  "license": "MIT",
1363
1363
  "dependencies": {
1364
- "@nosana/types": "2.24.4",
1364
+ "@nosana/types": "2.24.5",
1365
1365
  "bs58": "^6.0.0",
1366
1366
  "tweetnacl": "^1.0.3"
1367
1367
  },
@@ -1398,23 +1398,23 @@
1398
1398
  }
1399
1399
  },
1400
1400
  "node_modules/@nosana/kit": {
1401
- "version": "2.24.4",
1402
- "resolved": "https://registry.npmjs.org/@nosana/kit/-/kit-2.24.4.tgz",
1403
- "integrity": "sha512-IZu4bXaphkrKFu5+Lql59dfjBomuGIHEaDA4yZHr7sQhJA4KmUPz/uPAXwkZIB4yv0ZBk2KgdAAEerbseie8bw==",
1401
+ "version": "2.24.5",
1402
+ "resolved": "https://registry.npmjs.org/@nosana/kit/-/kit-2.24.5.tgz",
1403
+ "integrity": "sha512-IdjtGHyAPo6DeHTwyiGJm5LTKP1oP5rY5NAmTyNL5FWnVHHyjTXlKgrDWpLMWlZRJakT+DnvaCb31g78hNgtaw==",
1404
1404
  "license": "MIT",
1405
1405
  "dependencies": {
1406
- "@nosana/api": "2.24.4",
1406
+ "@nosana/api": "2.24.5",
1407
1407
  "@nosana/authorization": "2.24.3",
1408
1408
  "@nosana/connect": "2.24.3",
1409
- "@nosana/endpoints": "2.24.4",
1409
+ "@nosana/endpoints": "2.24.5",
1410
1410
  "@nosana/ipfs": "2.24.3",
1411
1411
  "@nosana/jobs-program": "2.24.3",
1412
1412
  "@nosana/merkle-distributor-program": "2.24.3",
1413
1413
  "@nosana/pools-program": "2.24.3",
1414
1414
  "@nosana/rewards-program": "2.24.3",
1415
- "@nosana/ssh": "2.24.4",
1415
+ "@nosana/ssh": "2.24.5",
1416
1416
  "@nosana/stake-program": "2.24.3",
1417
- "@nosana/types": "2.24.4",
1417
+ "@nosana/types": "2.24.5",
1418
1418
  "@solana-program/compute-budget": "0.18.1",
1419
1419
  "@solana-program/system": "0.14.1",
1420
1420
  "@solana-program/token": "0.16.1",
@@ -1493,12 +1493,12 @@
1493
1493
  }
1494
1494
  },
1495
1495
  "node_modules/@nosana/ssh": {
1496
- "version": "2.24.4",
1497
- "resolved": "https://registry.npmjs.org/@nosana/ssh/-/ssh-2.24.4.tgz",
1498
- "integrity": "sha512-WAXKJezS4sgm3uE8bFqmI0f4r5obRXqi7SfBjroVJiGTEZJZjuwNDugUR8q8WghqHk7GbX+KKK41s7YpiguJHA==",
1496
+ "version": "2.24.5",
1497
+ "resolved": "https://registry.npmjs.org/@nosana/ssh/-/ssh-2.24.5.tgz",
1498
+ "integrity": "sha512-t1/uXr13lQIxXbbDlqoMb1mA3Q9VR3avv+gJ8G9ZNHvWqcZQTSJF1SUsCjGS6hIrlcbfaBbDgzPDpOEbKEU8qA==",
1499
1499
  "license": "MIT",
1500
1500
  "dependencies": {
1501
- "@nosana/types": "2.24.4",
1501
+ "@nosana/types": "2.24.5",
1502
1502
  "tweetnacl": "^1.0.3"
1503
1503
  },
1504
1504
  "engines": {
@@ -1518,9 +1518,9 @@
1518
1518
  }
1519
1519
  },
1520
1520
  "node_modules/@nosana/types": {
1521
- "version": "2.24.4",
1522
- "resolved": "https://registry.npmjs.org/@nosana/types/-/types-2.24.4.tgz",
1523
- "integrity": "sha512-JgBVJd6/w1riVSkLQdubis9xfbC/spCfttvOJn1kQ3KUQXjviaDVAkkX7gde1TUZrM7g56eUmi/3vadCHRgTyA==",
1521
+ "version": "2.24.5",
1522
+ "resolved": "https://registry.npmjs.org/@nosana/types/-/types-2.24.5.tgz",
1523
+ "integrity": "sha512-attQnO3bh4nBOF/EwzbXz/EV+rbwzbJEKNWj6nYgYTFOAGoL7MSRWCebEgjHkJWOK5mYsJFFHGUQFBX/CbluPA==",
1524
1524
  "license": "MIT",
1525
1525
  "dependencies": {
1526
1526
  "typia": "^10.0.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.88-rc",
3
+ "version": "1.1.89-dev.mr94.17923173279",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -75,11 +75,11 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@inquirer/prompts": "^4.3.0",
78
- "@nosana/kit": "^2.24.4",
78
+ "@nosana/kit": "^2.24.5",
79
79
  "@nosana/pools-program": "^2.24.3",
80
80
  "@nosana/rewards-program": "^2.24.3",
81
- "@nosana/ssh": "^2.24.4",
82
- "@nosana/types": "^2.24.4",
81
+ "@nosana/ssh": "^2.24.5",
82
+ "@nosana/types": "^2.24.5",
83
83
  "@solana/kit": "^8.3.0",
84
84
  "chalk": "^5.3.0",
85
85
  "cli-progress": "^3.12.0",