@nosana/node 1.1.96-rc → 1.1.98-rc

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.6"
3
+ JOB_RUNTIME_IMAGE="nosana/job-runtime:v0.3.7"
4
4
  GOLDEN_VM_IMAGE=https://models.nosana.io/golden-vm/cuda13-580-20261202/golden-vm-cuda13-580-20261202.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.96-rc",
3
+ "version": "1.1.98-rc",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -25,6 +25,6 @@ export type RunSync = (command: string, args: string[]) => string;
25
25
  export declare function qemuSupportsIommufd(run?: RunSync): boolean;
26
26
  /**
27
27
  * Whether the host's QEMU can boot the confidential VMs: SEV-SNP with VFIO passthrough needs
28
- * QEMU 9.2 or newer, read from `--version`. False when QEMU cannot run or names no version.
28
+ * QEMU 10.1 or newer, read from `--version`. False when QEMU cannot run or names no version.
29
29
  */
30
30
  export declare function qemuSupportsSevSnp(run?: RunSync): boolean;
@@ -34,11 +34,15 @@ export function qemuSupportsIommufd(run = runSync) {
34
34
  return false;
35
35
  }
36
36
  }
37
- /** The oldest QEMU that boots an SEV-SNP guest with a GPU passed through by VFIO. */
38
- const MIN_SEV_SNP_QEMU = { major: 9, minor: 2 };
37
+ /**
38
+ * The oldest QEMU that boots an SEV-SNP guest with a GPU passed through by VFIO. An SNP guest's
39
+ * memory is private (guest_memfd), and only 10.1 lets VFIO map it: 10.0 boots the guest but
40
+ * exits at the GPU with "Cannot set discarding of RAM broken: Device or resource busy".
41
+ */
42
+ const MIN_SEV_SNP_QEMU = { major: 10, minor: 1 };
39
43
  /**
40
44
  * Whether the host's QEMU can boot the confidential VMs: SEV-SNP with VFIO passthrough needs
41
- * QEMU 9.2 or newer, read from `--version`. False when QEMU cannot run or names no version.
45
+ * QEMU 10.1 or newer, read from `--version`. False when QEMU cannot run or names no version.
42
46
  */
43
47
  export function qemuSupportsSevSnp(run = runSync) {
44
48
  let banner;
@@ -14,6 +14,7 @@ import { IN_JOB_LOOP_ENV } from '../exitCodes.js';
14
14
  import { reportError } from './monitoring/reportError.js';
15
15
  import { reportPodmanDiagnostics } from './monitoring/reportPodmanDiagnostics.js';
16
16
  import { OperatorInput } from './input/OperatorInput.js';
17
+ import { clearDrain, drainRequested } from './node/drain.js';
17
18
  export default class NodeManager {
18
19
  constructor(options) {
19
20
  this.exiting = false;
@@ -112,6 +113,15 @@ export default class NodeManager {
112
113
  * with a benchmark, which would run next to the job and compete for its GPU.
113
114
  */
114
115
  const liveJob = await this.node.liveJob();
116
+ /**
117
+ * drain
118
+ *
119
+ * asked to stop before the next job (see drain.ts); this is also where
120
+ * every job cycle starts again, so a job that runs is finished first
121
+ */
122
+ if (!liveJob && drainRequested(this.configLocation)) {
123
+ return await this.shutdown();
124
+ }
115
125
  /**
116
126
  * job runtime image
117
127
  *
@@ -310,6 +320,7 @@ export default class NodeManager {
310
320
  this.operatorInput.stop();
311
321
  this.node.exit();
312
322
  await this.stop();
323
+ clearDrain(this.configLocation); // only now: whoever asked waits for this to see the node out
313
324
  process.exit();
314
325
  }
315
326
  /**
@@ -33,7 +33,10 @@ declare class NodeLog {
33
33
  private notifyObservers;
34
34
  private addLog;
35
35
  private process;
36
- /** A job VM's setup is one spinner; its boot steps are not shown (see vmSetupLog). */
36
+ /**
37
+ * A job VM's setup is one spinner; its boot steps are not shown (see vmSetupLog). A failed
38
+ * setup says why: otherwise only the job's result, on IPFS, does.
39
+ */
37
40
  private handleVmSetup;
38
41
  private handleRecommend;
39
42
  private handleRegister;
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { logEmitter, translateJobPhaseLog } from '../../../../packages/common/src/index.js';
2
+ import { describeError, logEmitter, translateJobPhaseLog } from '../../../../packages/common/src/index.js';
3
3
  import { SECONDS_PER_DAY } from '../../utils/utils.js';
4
4
  import { LogMonitoringRegistry } from '../LogMonitoringRegistry.js';
5
5
  import { VM_SETUP_LOG_CLASS, VM_SETUP_LOG_METHOD, VM_SETUP_NODE_LOG_METHOD, } from './vmSetupLog.js';
@@ -162,12 +162,18 @@ class NodeLog {
162
162
  this.handleExpiryHandler(data);
163
163
  }
164
164
  }
165
- /** A job VM's setup is one spinner; its boot steps are not shown (see vmSetupLog). */
165
+ /**
166
+ * A job VM's setup is one spinner; its boot steps are not shown (see vmSetupLog). A failed
167
+ * setup says why: otherwise only the job's result, on IPFS, does.
168
+ */
166
169
  handleVmSetup(data) {
167
170
  const outcome = {
168
171
  call: { type: 'process', log: chalk.cyan('Setting up VM') },
169
172
  return: { type: 'success', log: chalk.green('VM is ready') },
170
- error: { type: 'error', log: chalk.red('Failed to set up the VM') },
173
+ error: {
174
+ type: 'error',
175
+ log: chalk.red(`Failed to set up the VM: ${describeError(data.error)}`),
176
+ },
171
177
  }[data.type];
172
178
  this.addLog({
173
179
  method: VM_SETUP_NODE_LOG_METHOD,
@@ -1,6 +1,9 @@
1
1
  /** The log stream's class for a job VM's setup. */
2
2
  export declare const VM_SETUP_LOG_CLASS = "VmJobRuntime";
3
- /** The setup itself: `call` as it starts, `return` once the VM is up, `error` if it fails. */
3
+ /**
4
+ * The setup itself: `call` as it starts, `return` once the VM is up, `error`, carrying what was
5
+ * thrown, if it fails.
6
+ */
4
7
  export declare const VM_SETUP_LOG_METHOD = "setup";
5
8
  /** How NodeLog names the setup to its observers (see ConsoleLogger). */
6
9
  export declare const VM_SETUP_NODE_LOG_METHOD = "VmJobRuntime.setup";
@@ -1,7 +1,10 @@
1
1
  import { logEmitter } from '../../../../packages/common/src/index.js';
2
2
  /** The log stream's class for a job VM's setup. */
3
3
  export const VM_SETUP_LOG_CLASS = 'VmJobRuntime';
4
- /** The setup itself: `call` as it starts, `return` once the VM is up, `error` if it fails. */
4
+ /**
5
+ * The setup itself: `call` as it starts, `return` once the VM is up, `error`, carrying what was
6
+ * thrown, if it fails.
7
+ */
5
8
  export const VM_SETUP_LOG_METHOD = 'setup';
6
9
  /** How NodeLog names the setup to its observers (see ConsoleLogger). */
7
10
  export const VM_SETUP_NODE_LOG_METHOD = `${VM_SETUP_LOG_CLASS}.${VM_SETUP_LOG_METHOD}`;
@@ -16,18 +19,19 @@ export async function trackVmSetup(jobAddress, setup) {
16
19
  result = await setup();
17
20
  }
18
21
  catch (error) {
19
- emit('error', jobAddress);
22
+ emit('error', jobAddress, error);
20
23
  throw error;
21
24
  }
22
25
  emit('return', jobAddress);
23
26
  return result;
24
27
  }
25
- function emit(type, jobAddress) {
28
+ function emit(type, jobAddress, error) {
26
29
  logEmitter.emit('log', {
27
30
  class: VM_SETUP_LOG_CLASS,
28
31
  method: VM_SETUP_LOG_METHOD,
29
32
  arguments: [jobAddress],
30
33
  timestamp: new Date().toISOString(),
31
34
  type,
35
+ ...(type === 'error' && { error }),
32
36
  });
33
37
  }
@@ -0,0 +1,2 @@
1
+ export declare function drainRequested(configLocation: string): boolean;
2
+ export declare function clearDrain(configLocation: string): void;
@@ -0,0 +1,16 @@
1
+ import fs from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ /**
5
+ * A `drain` file in the config folder asks the node to stop at the next point
6
+ * that costs no job: before it takes a job, never during one. It is written by
7
+ * whatever runs the node (the host agent); the node removes it when it stops,
8
+ * so a request never outlives the stop it asked for.
9
+ */
10
+ const drainFile = (configLocation) => path.join(configLocation.replace(/^~/, os.homedir()), 'drain');
11
+ export function drainRequested(configLocation) {
12
+ return fs.existsSync(drainFile(configLocation));
13
+ }
14
+ export function clearDrain(configLocation) {
15
+ fs.rmSync(drainFile(configLocation), { force: true });
16
+ }
@@ -25,7 +25,7 @@ export interface VmHostSystem {
25
25
  canPassGpus: () => boolean;
26
26
  /** Whether the host kernel runs AMD SEV-SNP. */
27
27
  hasSevSnp: () => boolean;
28
- /** Whether the host's QEMU boots SEV-SNP guests with GPUs (QEMU 9.2 or newer). */
28
+ /** Whether the host's QEMU boots SEV-SNP guests with GPUs (QEMU 10.1 or newer). */
29
29
  canBootSevSnp: () => boolean;
30
30
  /** The OVMF firmware a confidential VM boots; undefined when the host has none. */
31
31
  findUefiFirmware: () => string | undefined;
@@ -96,7 +96,7 @@ function assertCanLaunchConfidentialVms(spec, system) {
96
96
  ? []
97
97
  : ['AMD SEV-SNP in the host kernel: enable it in the BIOS and in kvm_amd (sev_snp=Y)']),
98
98
  ...(system.findUefiFirmware() ? [] : ['OVMF firmware: install the ovmf package']),
99
- ...(system.canBootSevSnp() ? [] : ['QEMU 9.2 or newer: upgrade qemu-system-x86_64']),
99
+ ...(system.canBootSevSnp() ? [] : ['QEMU 10.1 or newer: upgrade qemu-system-x86_64']),
100
100
  ];
101
101
  if (problems.length === 0)
102
102
  return;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.96-rc",
3
+ "version": "1.1.98-rc",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.1.96-rc",
9
+ "version": "1.1.98-rc",
10
10
  "license": "ISC",
11
11
  "workspaces": [
12
12
  "packages/*"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.96-rc",
3
+ "version": "1.1.98-rc",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"