@nosana/node 1.1.86 → 1.1.87-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 +1 -1
- package/dist/package.json +1 -1
- package/dist/packages/common/src/loggingProxy.js +1 -0
- package/dist/src/NodeManager/db/index.d.ts +0 -21
- package/dist/src/NodeManager/db/index.js +3 -40
- package/dist/src/NodeManager/index.js +7 -7
- package/dist/src/NodeManager/monitoring/state/NodeState.d.ts +22 -0
- package/dist/src/NodeManager/monitoring/state/NodeState.js +92 -50
- package/dist/src/NodeManager/monitoring/state/classifyState.d.ts +2 -0
- package/dist/src/NodeManager/monitoring/state/classifyState.js +8 -0
- package/dist/src/NodeManager/node/Node.d.ts +0 -1
- package/dist/src/NodeManager/node/Node.js +3 -5
- package/dist/src/NodeManager/node/api/ApiHandler.d.ts +2 -0
- package/dist/src/NodeManager/node/api/ApiHandler.js +6 -0
- package/dist/src/NodeManager/node/api/routes/get/node-info.d.ts +2 -2
- package/dist/src/NodeManager/node/api/routes/get/node-info.js +3 -20
- package/dist/src/NodeManager/node/balance/balanceHandler.d.ts +5 -1
- package/dist/src/NodeManager/node/balance/balanceHandler.js +18 -13
- package/dist/src/NodeManager/node/job/ContainerJobRuntime.d.ts +1 -3
- package/dist/src/NodeManager/node/job/ContainerJobRuntime.js +1 -5
- package/dist/src/NodeManager/node/job/selectJobRuntimeEnvironment.js +2 -2
- package/dist/src/NodeManager/repository/NodeRepository.d.ts +0 -2
- package/dist/src/NodeManager/repository/NodeRepository.js +0 -7
- package/dist/src/cli/commands/start/action.js +0 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/src/NodeManager/types/index.d.ts +0 -18
- package/dist/src/NodeManager/types/index.js +0 -1
- package/dist/src/NodeManager/utils/wslCheck.d.ts +0 -14
- package/dist/src/NodeManager/utils/wslCheck.js +0 -54
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.
|
|
3
|
+
JOB_RUNTIME_IMAGE="nosana/job-runtime:v0.3.2"
|
|
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,7 +1,6 @@
|
|
|
1
1
|
import { LowSync } from 'lowdb/lib';
|
|
2
2
|
import type { ResourceHistory, VolumeResource } from '../../../packages/job-runtime/src/resources/index.js';
|
|
3
3
|
import type { VmRecord } from '../../../packages/vm-orchestrator/src/index.js';
|
|
4
|
-
import { CudaCheckSuccessResponse } from '../types/index.js';
|
|
5
4
|
export type NodeDb = {
|
|
6
5
|
resources: Resources;
|
|
7
6
|
/**
|
|
@@ -10,26 +9,6 @@ export type NodeDb = {
|
|
|
10
9
|
* still holds (see RunHandler).
|
|
11
10
|
*/
|
|
12
11
|
finishedJob?: string;
|
|
13
|
-
info: {
|
|
14
|
-
version: string;
|
|
15
|
-
country: string;
|
|
16
|
-
network: {
|
|
17
|
-
ip: string;
|
|
18
|
-
ping_ms: number;
|
|
19
|
-
download_mbps: number;
|
|
20
|
-
upload_mbps: number;
|
|
21
|
-
};
|
|
22
|
-
system_environment: string;
|
|
23
|
-
cpu: {
|
|
24
|
-
model: string;
|
|
25
|
-
physical_cores: number;
|
|
26
|
-
logical_cores: number;
|
|
27
|
-
};
|
|
28
|
-
disk_gb: number;
|
|
29
|
-
ram_mb: number;
|
|
30
|
-
gpus: CudaCheckSuccessResponse;
|
|
31
|
-
protocol: string;
|
|
32
|
-
};
|
|
33
12
|
};
|
|
34
13
|
export type Resources = {
|
|
35
14
|
images: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import { JSONFileSyncPreset } from 'lowdb/node';
|
|
4
|
-
import { pkg } from '../../static/index.js';
|
|
5
4
|
const initial_state = {
|
|
6
5
|
resources: {
|
|
7
6
|
images: {},
|
|
@@ -9,31 +8,6 @@ const initial_state = {
|
|
|
9
8
|
containers: {},
|
|
10
9
|
vms: {},
|
|
11
10
|
},
|
|
12
|
-
info: {
|
|
13
|
-
version: pkg.version,
|
|
14
|
-
country: '',
|
|
15
|
-
network: {
|
|
16
|
-
ip: '',
|
|
17
|
-
ping_ms: 0,
|
|
18
|
-
download_mbps: 0,
|
|
19
|
-
upload_mbps: 0,
|
|
20
|
-
},
|
|
21
|
-
system_environment: '',
|
|
22
|
-
cpu: {
|
|
23
|
-
model: '',
|
|
24
|
-
physical_cores: 0,
|
|
25
|
-
logical_cores: 0,
|
|
26
|
-
},
|
|
27
|
-
disk_gb: 0,
|
|
28
|
-
ram_mb: 0,
|
|
29
|
-
gpus: {
|
|
30
|
-
devices: [],
|
|
31
|
-
runtime_version: 0,
|
|
32
|
-
cuda_driver_version: 0,
|
|
33
|
-
nvml_driver_version: '0.0.0',
|
|
34
|
-
},
|
|
35
|
-
protocol: '',
|
|
36
|
-
},
|
|
37
11
|
};
|
|
38
12
|
export class DB {
|
|
39
13
|
constructor(configLocation) {
|
|
@@ -54,23 +28,12 @@ export class DB {
|
|
|
54
28
|
if (!this.db.data.resources.vms) {
|
|
55
29
|
this.db.data.resources.vms = {};
|
|
56
30
|
}
|
|
57
|
-
// A job's records are its runtime's now
|
|
31
|
+
// A job's records are its runtime's now, and the node's specs are
|
|
32
|
+
// host-manager's. Node versions that ran jobs and collected specs
|
|
58
33
|
// themselves kept them here.
|
|
59
|
-
for (const legacy of ['flows', 'sshKeyGrants', 'sshHostKeys']) {
|
|
34
|
+
for (const legacy of ['flows', 'sshKeyGrants', 'sshHostKeys', 'info']) {
|
|
60
35
|
delete this.db.data[legacy];
|
|
61
36
|
}
|
|
62
|
-
if (!this.db.data.info) {
|
|
63
|
-
this.db.data.info = initial_state.info;
|
|
64
|
-
}
|
|
65
|
-
if (this.db.data.info) {
|
|
66
|
-
this.db.data.info = { ...initial_state.info, ...this.db.data.info };
|
|
67
|
-
}
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
if (this.db.data.info.disk) {
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
delete this.db.data.info.disk; // remove old key
|
|
72
|
-
}
|
|
73
|
-
this.db.data.info.version = pkg.version;
|
|
74
37
|
this.db.write();
|
|
75
38
|
}
|
|
76
39
|
}
|
|
@@ -10,7 +10,6 @@ import { updateWatcher } from '../version/updateWatcher.js';
|
|
|
10
10
|
import { checkForMaintenance } from './checkForMaintenance.js';
|
|
11
11
|
import { ping } from './monitoring/ping/PingHandler.js';
|
|
12
12
|
import { LogMonitoringRegistry } from './monitoring/LogMonitoringRegistry.js';
|
|
13
|
-
import { checkWSLStatus } from './utils/wslCheck.js';
|
|
14
13
|
import { IN_JOB_LOOP_ENV } from '../exitCodes.js';
|
|
15
14
|
import { reportError } from './monitoring/reportError.js';
|
|
16
15
|
import { reportPodmanDiagnostics } from './monitoring/reportPodmanDiagnostics.js';
|
|
@@ -69,6 +68,13 @@ export default class NodeManager {
|
|
|
69
68
|
* directory, which has no other route off the node
|
|
70
69
|
*/
|
|
71
70
|
reportPodmanDiagnostics(this.configLocation);
|
|
71
|
+
/**
|
|
72
|
+
* answer /node/info locally already: the node may wait for SOL or its
|
|
73
|
+
* registration below, and that is readable here
|
|
74
|
+
*/
|
|
75
|
+
if (!this.apiStarted) {
|
|
76
|
+
await this.apiHandler.listenLocally();
|
|
77
|
+
}
|
|
72
78
|
/**
|
|
73
79
|
* start
|
|
74
80
|
*
|
|
@@ -97,12 +103,6 @@ export default class NodeManager {
|
|
|
97
103
|
if (this.inJobLoop) {
|
|
98
104
|
await Promise.all([validateCLIVersion(true), checkForMaintenance(true)]);
|
|
99
105
|
}
|
|
100
|
-
/**
|
|
101
|
-
* WSL check
|
|
102
|
-
* - Shows warning message for all WSL hosts
|
|
103
|
-
* - Throws WSLBlockedError after December 15, 2025 to prevent queue joining
|
|
104
|
-
*/
|
|
105
|
-
checkWSLStatus(this.node.getSystemEnvironment());
|
|
106
106
|
/**
|
|
107
107
|
* live job
|
|
108
108
|
*
|
|
@@ -12,18 +12,40 @@ export declare class NodeState {
|
|
|
12
12
|
private info;
|
|
13
13
|
private status;
|
|
14
14
|
private state;
|
|
15
|
+
private since;
|
|
15
16
|
private history;
|
|
16
17
|
private observers;
|
|
17
18
|
constructor(node: string);
|
|
18
19
|
clear(): void;
|
|
20
|
+
/** The state category, the exact status with its details and since when, and the recent states. */
|
|
19
21
|
getNodeInfo(): {
|
|
20
22
|
state: import("./classifyState.js").StateCategory;
|
|
23
|
+
status: string;
|
|
24
|
+
details: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
since: string;
|
|
28
|
+
history: {
|
|
29
|
+
status: string;
|
|
30
|
+
details: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
at: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}[];
|
|
21
36
|
};
|
|
22
37
|
addObserver(observer: StateObserver): void;
|
|
23
38
|
removeObserver(observer: StateObserver): void;
|
|
24
39
|
private notifyObservers;
|
|
40
|
+
/** A status the same as the current one updates its entry instead of adding one. */
|
|
25
41
|
addState(status: string, state: {
|
|
26
42
|
[key: string]: string;
|
|
27
43
|
}): void;
|
|
44
|
+
/**
|
|
45
|
+
* A progress bar's step: kept as `progress` in the current state's details,
|
|
46
|
+
* so the status and the history stay what the node is doing. Observers get
|
|
47
|
+
* the step as before.
|
|
48
|
+
*/
|
|
49
|
+
private setProgress;
|
|
28
50
|
process(data: LogEntry): void;
|
|
29
51
|
}
|
|
@@ -9,12 +9,15 @@ export const state = (() => {
|
|
|
9
9
|
return instance;
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
|
+
/** How many state changes are kept, newest last. */
|
|
13
|
+
const HISTORY_SIZE = 50;
|
|
12
14
|
export class NodeState {
|
|
13
15
|
constructor(node) {
|
|
14
16
|
this.shared = {};
|
|
15
17
|
this.info = {};
|
|
16
18
|
this.status = 'none';
|
|
17
19
|
this.state = {};
|
|
20
|
+
this.since = Date.now();
|
|
18
21
|
this.history = [];
|
|
19
22
|
this.observers = [];
|
|
20
23
|
this.info = {
|
|
@@ -31,10 +34,20 @@ export class NodeState {
|
|
|
31
34
|
this.state = {};
|
|
32
35
|
this.shared = {};
|
|
33
36
|
}
|
|
37
|
+
/** The state category, the exact status with its details and since when, and the recent states. */
|
|
34
38
|
getNodeInfo() {
|
|
35
39
|
return {
|
|
36
40
|
...this.info,
|
|
37
41
|
state: classifyState(this.status),
|
|
42
|
+
status: this.status,
|
|
43
|
+
details: this.state,
|
|
44
|
+
since: new Date(this.since).toISOString(),
|
|
45
|
+
history: this.history.map((h) => ({
|
|
46
|
+
status: h.status,
|
|
47
|
+
details: h.state,
|
|
48
|
+
at: new Date(h.timestamp).toISOString(),
|
|
49
|
+
updatedAt: new Date(h.updatedAt).toISOString(),
|
|
50
|
+
})),
|
|
38
51
|
};
|
|
39
52
|
}
|
|
40
53
|
addObserver(observer) {
|
|
@@ -48,17 +61,44 @@ export class NodeState {
|
|
|
48
61
|
observer.update(status, state, timestamp);
|
|
49
62
|
}
|
|
50
63
|
}
|
|
64
|
+
/** A status the same as the current one updates its entry instead of adding one. */
|
|
51
65
|
addState(status, state) {
|
|
52
66
|
const timestamp = Date.now();
|
|
53
|
-
this.history.
|
|
54
|
-
status: this.status,
|
|
55
|
-
state: this.state,
|
|
56
|
-
timestamp,
|
|
57
|
-
});
|
|
58
|
-
this.status = status;
|
|
67
|
+
const last = this.history[this.history.length - 1];
|
|
59
68
|
this.state = { ...this.shared, ...state };
|
|
69
|
+
if (last && this.status === status) {
|
|
70
|
+
last.state = this.state;
|
|
71
|
+
last.updatedAt = timestamp;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.status = status;
|
|
75
|
+
this.since = timestamp;
|
|
76
|
+
this.history.push({ status, state: this.state, timestamp, updatedAt: timestamp });
|
|
77
|
+
if (this.history.length > HISTORY_SIZE) {
|
|
78
|
+
this.history.shift();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
60
81
|
this.notifyObservers(this.status, this.state, timestamp);
|
|
61
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A progress bar's step: kept as `progress` in the current state's details,
|
|
85
|
+
* so the status and the history stay what the node is doing. Observers get
|
|
86
|
+
* the step as before.
|
|
87
|
+
*/
|
|
88
|
+
setProgress(status, details, progress) {
|
|
89
|
+
const timestamp = Date.now();
|
|
90
|
+
if (progress) {
|
|
91
|
+
this.state.progress = {
|
|
92
|
+
...this.state.progress,
|
|
93
|
+
...progress,
|
|
94
|
+
updatedAt: new Date(timestamp).toISOString(),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
delete this.state.progress;
|
|
99
|
+
}
|
|
100
|
+
this.notifyObservers(status, { ...this.shared, ...details }, timestamp);
|
|
101
|
+
}
|
|
62
102
|
process(data) {
|
|
63
103
|
if (data.class === 'Provider') {
|
|
64
104
|
if (data.method == 'runOperation') {
|
|
@@ -259,7 +299,12 @@ export class NodeState {
|
|
|
259
299
|
}
|
|
260
300
|
if (data.method === 'restartDelay') {
|
|
261
301
|
if (data.type == 'call') {
|
|
262
|
-
|
|
302
|
+
const seconds = Number(data.arguments?.[0]) || 0;
|
|
303
|
+
this.addState('node-restarting', {
|
|
304
|
+
node: this.shared.node,
|
|
305
|
+
delay: String(seconds),
|
|
306
|
+
at: new Date(Date.now() + seconds * 1000).toISOString(),
|
|
307
|
+
});
|
|
263
308
|
}
|
|
264
309
|
if (data.type == 'return') {
|
|
265
310
|
this.addState('node-restarted', { node: this.shared.node });
|
|
@@ -325,6 +370,28 @@ export class NodeState {
|
|
|
325
370
|
}
|
|
326
371
|
}
|
|
327
372
|
}
|
|
373
|
+
if (data.class === 'BalanceHandler' && data.method === 'waitForSol') {
|
|
374
|
+
if (data.type == 'call') {
|
|
375
|
+
this.addState('waiting-for-sol', { node: this.shared.node });
|
|
376
|
+
}
|
|
377
|
+
if (data.type == 'return') {
|
|
378
|
+
this.addState('sol-funded', { node: this.shared.node });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (data.class === 'RegisterHandler' && data.method === 'register') {
|
|
382
|
+
if (data.type == 'call') {
|
|
383
|
+
this.addState('waiting-for-registration', { node: this.shared.node });
|
|
384
|
+
}
|
|
385
|
+
if (data.type == 'return') {
|
|
386
|
+
this.addState('registered', { node: this.shared.node });
|
|
387
|
+
}
|
|
388
|
+
if (data.type == 'error') {
|
|
389
|
+
this.addState('registration-failed', {
|
|
390
|
+
node: this.shared.node,
|
|
391
|
+
error: `${data.error}`,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
328
395
|
if (data.class === 'BenchmarkTaskManager' && data.method === 'start') {
|
|
329
396
|
this.addState(data.type == 'call' ? 'benchmark-running' : 'benchmark-finished', {
|
|
330
397
|
node: this.shared.node,
|
|
@@ -608,49 +675,24 @@ export class NodeState {
|
|
|
608
675
|
}
|
|
609
676
|
}
|
|
610
677
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
this.addState('process-bar-stop', {
|
|
630
|
-
desc: data.arguments[0],
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
if (data.class === 'MultiProgressBarReporter') {
|
|
635
|
-
if (data.method === 'start' && data.type == 'call') {
|
|
636
|
-
this.addState('multi-process-bar-start', {
|
|
637
|
-
desc: data.arguments[0],
|
|
638
|
-
optProgressBar: data.arguments[1],
|
|
639
|
-
total: data.arguments[2],
|
|
640
|
-
startValue: data.arguments[3],
|
|
641
|
-
payload: data.arguments[4],
|
|
642
|
-
progressBarPreset: data.arguments[5],
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
if (data.method === 'update' && data.type == 'call') {
|
|
646
|
-
this.addState('multi-process-bar-update', {
|
|
647
|
-
event: data.arguments[0],
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
if (data.method === 'stop' && data.type == 'call') {
|
|
651
|
-
this.addState('multi-process-bar-stop', {
|
|
652
|
-
desc: data.arguments[0],
|
|
653
|
-
});
|
|
678
|
+
for (const [cls, prefix] of [
|
|
679
|
+
['ProgressBarReporter', 'process-bar'],
|
|
680
|
+
['MultiProgressBarReporter', 'multi-process-bar'],
|
|
681
|
+
]) {
|
|
682
|
+
if (data.class !== cls || data.type != 'call')
|
|
683
|
+
continue;
|
|
684
|
+
const [first, optProgressBar, total, startValue, payload, progressBarPreset] = data.arguments;
|
|
685
|
+
if (data.method === 'start') {
|
|
686
|
+
this.setProgress(`${prefix}-start`, { desc: first, optProgressBar, total, startValue, payload, progressBarPreset }, { desc: first, total, current: startValue });
|
|
687
|
+
}
|
|
688
|
+
if (data.method === 'update') {
|
|
689
|
+
const details = cls === 'ProgressBarReporter'
|
|
690
|
+
? { current: first, payload: optProgressBar }
|
|
691
|
+
: { event: first };
|
|
692
|
+
this.setProgress(`${prefix}-update`, details, details);
|
|
693
|
+
}
|
|
694
|
+
if (data.method === 'stop') {
|
|
695
|
+
this.setProgress(`${prefix}-stop`, { desc: first });
|
|
654
696
|
}
|
|
655
697
|
}
|
|
656
698
|
}
|
|
@@ -4,6 +4,8 @@ export declare enum StateCategory {
|
|
|
4
4
|
HEALTHCHECK = "HEALTHCHECK",
|
|
5
5
|
RESTARTING = "RESTARTING",
|
|
6
6
|
STARTING = "STARTING",
|
|
7
|
+
WAITING_FOR_SOL = "WAITING_FOR_SOL",
|
|
8
|
+
WAITING_FOR_REGISTRATION = "WAITING_FOR_REGISTRATION",
|
|
7
9
|
JOINING_MARKET = "JOINING_MARKET",
|
|
8
10
|
QUEUED = "QUEUED",
|
|
9
11
|
OTHER = "OTHER"
|
|
@@ -5,6 +5,8 @@ export var StateCategory;
|
|
|
5
5
|
StateCategory["HEALTHCHECK"] = "HEALTHCHECK";
|
|
6
6
|
StateCategory["RESTARTING"] = "RESTARTING";
|
|
7
7
|
StateCategory["STARTING"] = "STARTING";
|
|
8
|
+
StateCategory["WAITING_FOR_SOL"] = "WAITING_FOR_SOL";
|
|
9
|
+
StateCategory["WAITING_FOR_REGISTRATION"] = "WAITING_FOR_REGISTRATION";
|
|
8
10
|
StateCategory["JOINING_MARKET"] = "JOINING_MARKET";
|
|
9
11
|
StateCategory["QUEUED"] = "QUEUED";
|
|
10
12
|
StateCategory["OTHER"] = "OTHER";
|
|
@@ -41,6 +43,12 @@ export const stateClassificationMap = {
|
|
|
41
43
|
'node-starting': StateCategory.STARTING,
|
|
42
44
|
'node-starting-failed': StateCategory.STARTING,
|
|
43
45
|
'node-started': StateCategory.STARTING,
|
|
46
|
+
'sol-funded': StateCategory.STARTING,
|
|
47
|
+
'registered': StateCategory.STARTING,
|
|
48
|
+
// Waiting for the owner, before the node can do anything
|
|
49
|
+
'waiting-for-sol': StateCategory.WAITING_FOR_SOL,
|
|
50
|
+
'waiting-for-registration': StateCategory.WAITING_FOR_REGISTRATION,
|
|
51
|
+
'registration-failed': StateCategory.WAITING_FOR_REGISTRATION,
|
|
44
52
|
// JOINING MARKET states
|
|
45
53
|
'queueing-in-market': StateCategory.JOINING_MARKET,
|
|
46
54
|
'queueing-in-market-success': StateCategory.QUEUED,
|
|
@@ -89,9 +89,6 @@ export class BasicNode {
|
|
|
89
89
|
node() {
|
|
90
90
|
return nodeAddress();
|
|
91
91
|
}
|
|
92
|
-
getSystemEnvironment() {
|
|
93
|
-
return this.repository.getNodeInfo().system_environment;
|
|
94
|
-
}
|
|
95
92
|
async stop() {
|
|
96
93
|
await this.marketHandler.stop();
|
|
97
94
|
await this.runHandler.stop();
|
|
@@ -111,8 +108,9 @@ export class BasicNode {
|
|
|
111
108
|
nodeAbortControllerSelector().refresh();
|
|
112
109
|
}
|
|
113
110
|
async start() {
|
|
114
|
-
if (await this.balanceHandler.balance())
|
|
115
|
-
|
|
111
|
+
if ((await this.balanceHandler.balance()) &&
|
|
112
|
+
!this.balanceHandler.sufficient()) {
|
|
113
|
+
await this.balanceHandler.waitForSol();
|
|
116
114
|
}
|
|
117
115
|
/**
|
|
118
116
|
* get an instance to the container
|
|
@@ -28,6 +28,8 @@ export declare class ApiHandler {
|
|
|
28
28
|
address: Address, repository: NodeRepository, provider: Provider, port: number,
|
|
29
29
|
/** Where a running job's runtime serves its job API (see jobRuntimeProxy). */
|
|
30
30
|
locateJobRuntime: JobRuntimeLocator);
|
|
31
|
+
/** Listens on the local port only; start() adds the public tunnel and listens anew. */
|
|
32
|
+
listenLocally(): Promise<void>;
|
|
31
33
|
start(): Promise<string>;
|
|
32
34
|
preventMultipleApiStarts(): Promise<void>;
|
|
33
35
|
testApiServerOnce(server: string, timeoutMs?: number): Promise<boolean>;
|
|
@@ -45,6 +45,12 @@ export class ApiHandler {
|
|
|
45
45
|
// periodically check if the api server returns a response on / (the response is the address)
|
|
46
46
|
// if not stop the reverse proxy and set it up again
|
|
47
47
|
}
|
|
48
|
+
/** Listens on the local port only; start() adds the public tunnel and listens anew. */
|
|
49
|
+
async listenLocally() {
|
|
50
|
+
if (!this.server) {
|
|
51
|
+
await this.listen();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
48
54
|
async start() {
|
|
49
55
|
try {
|
|
50
56
|
const server = await this.restartApiProxy();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Response } from
|
|
2
|
-
import { NodeAPIRequest } from
|
|
1
|
+
import { Response } from "express";
|
|
2
|
+
import { NodeAPIRequest } from "../../types/index.js";
|
|
3
3
|
export declare function getNodeInfoRoute(req: NodeAPIRequest<{}>, res: Response): void;
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import { state } from
|
|
1
|
+
import { state } from "../../../../monitoring/state/NodeState.js";
|
|
2
|
+
import { pkg } from "../../../../../static/index.js";
|
|
2
3
|
export function getNodeInfoRoute(req, res) {
|
|
3
|
-
const info = req.repository.getNodeInfo();
|
|
4
|
-
const networkRedacted = { ...info.network };
|
|
5
|
-
delete networkRedacted['ip'];
|
|
6
4
|
const images = Object.keys(req.repository.getImagesResources());
|
|
7
5
|
const volumes = Object.keys(req.repository.getVolumesResources());
|
|
8
6
|
res.status(200).json({
|
|
9
7
|
...state(req.address.toString()).getNodeInfo(),
|
|
10
|
-
|
|
11
|
-
...info,
|
|
12
|
-
gpus: {
|
|
13
|
-
...info.gpus,
|
|
14
|
-
devices: info.gpus.devices
|
|
15
|
-
? info.gpus.devices.map(({ index, name, uuid, memory, network_architecture }) => ({
|
|
16
|
-
index,
|
|
17
|
-
name,
|
|
18
|
-
uuid,
|
|
19
|
-
memory,
|
|
20
|
-
network_architecture,
|
|
21
|
-
}))
|
|
22
|
-
: [],
|
|
23
|
-
},
|
|
24
|
-
network: networkRedacted,
|
|
25
|
-
},
|
|
8
|
+
version: pkg.version,
|
|
26
9
|
resources: {
|
|
27
10
|
images,
|
|
28
11
|
volumes,
|
|
@@ -6,6 +6,10 @@ export declare class BalanceHandler {
|
|
|
6
6
|
constructor(kit: NosanaClient);
|
|
7
7
|
balance(): Promise<boolean>;
|
|
8
8
|
private waitForSufficentSol;
|
|
9
|
-
|
|
9
|
+
private insufficientSolMessage;
|
|
10
|
+
sufficient(): boolean;
|
|
11
|
+
/** Waits for SOL to arrive; a state of its own through the logging proxy. */
|
|
12
|
+
waitForSol(): Promise<void>;
|
|
13
|
+
check(): Promise<void>;
|
|
10
14
|
getNosBalance(): TokenBalanceInfo | undefined;
|
|
11
15
|
}
|
|
@@ -33,19 +33,24 @@ export class BalanceHandler {
|
|
|
33
33
|
}, 30000);
|
|
34
34
|
}).finally(() => clearInterval(balancePollingInterval));
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
insufficientSolMessage() {
|
|
37
|
+
return `SOL balance ${this.balances.sol} should be ${MINIMUM_SOL_BALANCE} or higher. Send some SOL to your node address ${this.address} `;
|
|
38
|
+
}
|
|
39
|
+
sufficient() {
|
|
40
|
+
return this.balances.sol >= MINIMUM_SOL_BALANCE;
|
|
41
|
+
}
|
|
42
|
+
/** Waits for SOL to arrive; a state of its own through the logging proxy. */
|
|
43
|
+
async waitForSol() {
|
|
44
|
+
const spinner = ora({
|
|
45
|
+
text: chalk.yellow(this.insufficientSolMessage()),
|
|
46
|
+
discardStdin: false,
|
|
47
|
+
}).start();
|
|
48
|
+
await this.waitForSufficentSol();
|
|
49
|
+
spinner.succeed();
|
|
50
|
+
}
|
|
51
|
+
async check() {
|
|
52
|
+
if (!this.sufficient()) {
|
|
53
|
+
throw new Error(this.insufficientSolMessage());
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
getNosBalance() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NodeRepository } from '../../repository/NodeRepository.js';
|
|
2
1
|
import { ResourceManager } from '../resource/resourceManager.js';
|
|
3
2
|
import { ContainerOrchestrationInterface } from '../../../../packages/container-orchestrator/src/index.js';
|
|
4
3
|
import { type JobRuntimeConsole, type JobRuntimeKind } from '../../../../packages/job-runtime/src/host/index.js';
|
|
@@ -10,12 +9,11 @@ import type { JobRuntimeEnvironment } from './JobRuntimeEnvironment.js';
|
|
|
10
9
|
*/
|
|
11
10
|
export declare class ContainerJobRuntime implements JobRuntimeEnvironment {
|
|
12
11
|
private containerOrchestration;
|
|
13
|
-
private repository;
|
|
14
12
|
/** The node's image and resource cache, which a job's sidecar starts from. */
|
|
15
13
|
private resourceManager;
|
|
16
14
|
private jobRuntimeVolumesSwept;
|
|
17
15
|
private readonly jobRuntimeUrls;
|
|
18
|
-
constructor(containerOrchestration: ContainerOrchestrationInterface,
|
|
16
|
+
constructor(containerOrchestration: ContainerOrchestrationInterface,
|
|
19
17
|
/** The node's image and resource cache, which a job's sidecar starts from. */
|
|
20
18
|
resourceManager: ResourceManager);
|
|
21
19
|
/** The sidecar shares the node's cache: it starts from the node's records. */
|
|
@@ -33,11 +33,10 @@ function sleep(ms) {
|
|
|
33
33
|
* job's own containers.
|
|
34
34
|
*/
|
|
35
35
|
export class ContainerJobRuntime {
|
|
36
|
-
constructor(containerOrchestration,
|
|
36
|
+
constructor(containerOrchestration,
|
|
37
37
|
/** The node's image and resource cache, which a job's sidecar starts from. */
|
|
38
38
|
resourceManager) {
|
|
39
39
|
this.containerOrchestration = containerOrchestration;
|
|
40
|
-
this.repository = repository;
|
|
41
40
|
this.resourceManager = resourceManager;
|
|
42
41
|
this.jobRuntimeVolumesSwept = false;
|
|
43
42
|
this.jobRuntimeUrls = new Map();
|
|
@@ -118,9 +117,6 @@ export class ContainerJobRuntime {
|
|
|
118
117
|
...(socketGroup === undefined
|
|
119
118
|
? { user: '0:0' }
|
|
120
119
|
: { group_add: [String(socketGroup)] }),
|
|
121
|
-
// GPU stats need the device; a node without GPUs (which may have no
|
|
122
|
-
// GPU driver either) gives its sidecar none.
|
|
123
|
-
...(this.repository.getNodeInfo().gpus.devices.length > 0 ? { gpu: true } : {}),
|
|
124
120
|
networks: { NOSANA_GATEWAY: {} },
|
|
125
121
|
aliases: [name],
|
|
126
122
|
env: {
|
|
@@ -14,12 +14,12 @@ import { VmJobRuntime } from './VmJobRuntime.js';
|
|
|
14
14
|
* its first job.
|
|
15
15
|
*/
|
|
16
16
|
export function selectJobRuntimeEnvironment(options, deps) {
|
|
17
|
-
const { containerOrchestration,
|
|
17
|
+
const { containerOrchestration, resourceManager } = deps;
|
|
18
18
|
if (!options.vm) {
|
|
19
19
|
// The container runtime selects GPUs by index.
|
|
20
20
|
if (hasPciAddress(options.gpu))
|
|
21
21
|
throw new Error('PCI addresses in --gpu need --vm');
|
|
22
|
-
return new ContainerJobRuntime(containerOrchestration,
|
|
22
|
+
return new ContainerJobRuntime(containerOrchestration, resourceManager);
|
|
23
23
|
}
|
|
24
24
|
const system = {
|
|
25
25
|
platform: process.platform,
|
|
@@ -15,8 +15,6 @@ export declare class NodeRepository {
|
|
|
15
15
|
* depends on this.
|
|
16
16
|
*/
|
|
17
17
|
private persist;
|
|
18
|
-
updateNodeInfo(updatedFields: Partial<NodeDb['info']>): void;
|
|
19
|
-
getNodeInfo(): NodeDb['info'];
|
|
20
18
|
getFinishedJob(): string | undefined;
|
|
21
19
|
setFinishedJob(jobAddress: string): void;
|
|
22
20
|
getImagesResources(): {
|
|
@@ -66,13 +66,6 @@ export class NodeRepository {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
updateNodeInfo(updatedFields) {
|
|
70
|
-
Object.assign(this.db.data.info, updatedFields);
|
|
71
|
-
this.persist();
|
|
72
|
-
}
|
|
73
|
-
getNodeInfo() {
|
|
74
|
-
return this.db.data.info;
|
|
75
|
-
}
|
|
76
69
|
getFinishedJob() {
|
|
77
70
|
return this.db.data.finishedJob;
|
|
78
71
|
}
|
|
@@ -15,10 +15,6 @@ export async function startNode(market, options) {
|
|
|
15
15
|
// Failed because the node is stopping, and that shutdown owns the exit.
|
|
16
16
|
if (nodeManager.isStopping())
|
|
17
17
|
return;
|
|
18
|
-
if (error.name === 'WSLBlockedError') {
|
|
19
|
-
await nodeManager.stop();
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
18
|
const formattedError = `
|
|
23
19
|
========== ERROR ==========
|
|
24
20
|
Timestamp: ${new Date().toISOString()}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.87-rc",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@nosana/node",
|
|
9
|
-
"version": "1.1.
|
|
9
|
+
"version": "1.1.87-rc",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"workspaces": [
|
|
12
12
|
"packages/*"
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type CudaCheckSuccessResponse = {
|
|
2
|
-
devices: {
|
|
3
|
-
index: number;
|
|
4
|
-
name: string;
|
|
5
|
-
uuid: string;
|
|
6
|
-
memory: {
|
|
7
|
-
total_mb: number;
|
|
8
|
-
};
|
|
9
|
-
network_architecture: {
|
|
10
|
-
major: number;
|
|
11
|
-
minor: number;
|
|
12
|
-
};
|
|
13
|
-
results: number[];
|
|
14
|
-
}[];
|
|
15
|
-
runtime_version: number;
|
|
16
|
-
cuda_driver_version: number;
|
|
17
|
-
nvml_driver_version: string;
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function isWSLHost(systemEnvironment: string): boolean;
|
|
2
|
-
export declare function isWSLBlockActive(): boolean;
|
|
3
|
-
export declare function displayWSLWarning(): void;
|
|
4
|
-
export declare function displayWSLBlockMessage(): void;
|
|
5
|
-
export declare class WSLBlockedError extends Error {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Check WSL status and handle warning/blocking
|
|
10
|
-
*
|
|
11
|
-
* @param systemEnvironment - The system_environment value from specs
|
|
12
|
-
* @throws WSLBlockedError if WSL host and block date has passed
|
|
13
|
-
*/
|
|
14
|
-
export declare function checkWSLStatus(systemEnvironment: string): void;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
const WSL_QUEUE_BLOCK_DATE = new Date('2025-12-15T00:00:00Z');
|
|
3
|
-
export function isWSLHost(systemEnvironment) {
|
|
4
|
-
if (!systemEnvironment)
|
|
5
|
-
return false;
|
|
6
|
-
return systemEnvironment.toLowerCase().includes('wsl');
|
|
7
|
-
}
|
|
8
|
-
export function isWSLBlockActive() {
|
|
9
|
-
return new Date() >= WSL_QUEUE_BLOCK_DATE;
|
|
10
|
-
}
|
|
11
|
-
export function displayWSLWarning() {
|
|
12
|
-
console.log('');
|
|
13
|
-
console.log(chalk.bgYellow.black.bold(' ⚠️ WSL DEPRECATION WARNING '));
|
|
14
|
-
console.log('');
|
|
15
|
-
console.log(chalk.yellow('WSL hosts are being removed from the Nosana network.'));
|
|
16
|
-
console.log('');
|
|
17
|
-
console.log(chalk.yellow(`• ${chalk.bold('December 15, 2025')}: WSL hosts will be blocked from joining the queue`));
|
|
18
|
-
console.log(chalk.yellow(`• ${chalk.bold('January 15, 2026')}: Premium market keys for WSL hosts will be revoked`));
|
|
19
|
-
console.log('');
|
|
20
|
-
console.log(chalk.yellow('Please migrate to a native Linux installation to continue participating in the network.'));
|
|
21
|
-
console.log('');
|
|
22
|
-
}
|
|
23
|
-
export function displayWSLBlockMessage() {
|
|
24
|
-
console.log('');
|
|
25
|
-
console.log(chalk.bgRed.white.bold(' 🚫 WSL HOST BLOCKED '));
|
|
26
|
-
console.log('');
|
|
27
|
-
console.log(chalk.red(`WSL hosts have been blocked from the queue since ${chalk.bold('December 15, 2025')}.`));
|
|
28
|
-
console.log(chalk.red(`Premium market keys for WSL hosts will be revoked on ${chalk.bold('January 15, 2026')}.`));
|
|
29
|
-
console.log('');
|
|
30
|
-
console.log(chalk.red('Please migrate to a native Linux installation to continue participating in the network.'));
|
|
31
|
-
console.log('');
|
|
32
|
-
}
|
|
33
|
-
export class WSLBlockedError extends Error {
|
|
34
|
-
constructor() {
|
|
35
|
-
super('WSL hosts are no longer allowed to join the queue');
|
|
36
|
-
this.name = 'WSLBlockedError';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check WSL status and handle warning/blocking
|
|
41
|
-
*
|
|
42
|
-
* @param systemEnvironment - The system_environment value from specs
|
|
43
|
-
* @throws WSLBlockedError if WSL host and block date has passed
|
|
44
|
-
*/
|
|
45
|
-
export function checkWSLStatus(systemEnvironment) {
|
|
46
|
-
if (!isWSLHost(systemEnvironment)) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (isWSLBlockActive()) {
|
|
50
|
-
displayWSLBlockMessage();
|
|
51
|
-
// throw new WSLBlockedError();
|
|
52
|
-
}
|
|
53
|
-
displayWSLWarning();
|
|
54
|
-
}
|