@nosana/node 1.1.89-rc → 1.1.90-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/container-orchestrator/src/docker/createDockerRunOptions.js +5 -0
- package/dist/packages/container-orchestrator/src/interface.d.ts +1 -0
- package/dist/packages/container-orchestrator/src/podman/utils/createPodmanRunOptions.d.ts +18 -6
- package/dist/packages/container-orchestrator/src/podman/utils/createPodmanRunOptions.js +11 -3
- package/dist/packages/job-runtime/src/host/contract.d.ts +5 -0
- package/dist/packages/job-runtime/src/provider/ContainerProvider.js +1 -0
- package/dist/packages/job-runtime/src/provider/ports.d.ts +2 -0
- package/dist/packages/job-runtime/src/runtime/runJob.js +1 -1
- package/dist/src/NodeManager/node/job/JobRuntimeSession.d.ts +1 -0
- package/dist/src/NodeManager/node/job/JobRuntimeSession.js +11 -2
- package/dist/src/NodeManager/node/market/benchmark.js +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
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=
|
|
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,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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
79
|
-
|
|
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;
|
|
@@ -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
|
|
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,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.90-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.90-rc",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"workspaces": [
|
|
12
12
|
"packages/*"
|