@nosana/node 1.1.100-rc → 1.1.101

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,5 +1,5 @@
1
1
  BACKEND_SOLANA_ADDRESS=7rFPFnxjXHC2sfDy3qrDa9pEb4j49oivMuV7e8sYDPmB
2
- FRP_SERVER_IMAGE=registry.hub.docker.com/nosana/frpc:v1.0.45
2
+ FRP_SERVER_IMAGE=registry.hub.docker.com/nosana/frpc:v1.0.50
3
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.21"
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.100-rc",
3
+ "version": "1.1.101",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -39,7 +39,7 @@ export class BasicNode {
39
39
  this.repository = new NodeRepository(db);
40
40
  this.containerOrchestration = selectContainerOrchestrationProvider(options.provider, options.podman, options.gpu, options.trustedExecutionRuntime, nodeOrchestrationHooks(this.repository));
41
41
  this.resourceManager = new ResourceManager(this.containerOrchestration, this.repository);
42
- this.provider = new Provider(this.containerOrchestration, this.resourceManager);
42
+ this.provider = new Provider(this.containerOrchestration, this.resourceManager, !options.vm && !options.cvm);
43
43
  this.environment = selectJobRuntimeEnvironment(options, {
44
44
  containerOrchestration: this.containerOrchestration,
45
45
  repository: this.repository,
@@ -7,10 +7,34 @@ import { ContainerOrchestrationInterface } from '../../../packages/container-orc
7
7
  export declare class Provider {
8
8
  containerOrchestration: ContainerOrchestrationInterface;
9
9
  readonly resourceManager: ResourceManager;
10
+ /**
11
+ * Whether the API proxy container requests a GPU, which managed mode
12
+ * uses. Only a node that runs its jobs in containers can: a `--vm`/`--cvm`
13
+ * node passes its GPUs to the guest, so the host container has none and
14
+ * asking for one would stop the proxy, and so the node's API, from
15
+ * starting.
16
+ */
17
+ private readonly apiProxyRequestsGpu;
10
18
  private readonly frpcImage;
11
19
  private proxyStartupAbortController;
12
- constructor(containerOrchestration: ContainerOrchestrationInterface, resourceManager: ResourceManager);
20
+ constructor(containerOrchestration: ContainerOrchestrationInterface, resourceManager: ResourceManager,
21
+ /**
22
+ * Whether the API proxy container requests a GPU, which managed mode
23
+ * uses. Only a node that runs its jobs in containers can: a `--vm`/`--cvm`
24
+ * node passes its GPUs to the guest, so the host container has none and
25
+ * asking for one would stop the proxy, and so the node's API, from
26
+ * starting.
27
+ */
28
+ apiProxyRequestsGpu?: boolean);
13
29
  stopReverseProxyApi(address: string): Promise<boolean>;
14
30
  setUpReverseProxyApi(address: string, port: string): Promise<boolean>;
31
+ /**
32
+ * The node's persistent API proxy container (`frpc-api-<address>`): frpc in
33
+ * managed mode (see the frpc image's `APP_MODE`). It requests a GPU only
34
+ * where a host container can use one (see `apiProxyRequestsGpu`). A resync
35
+ * between jobs must leave it running, so it is not tracked as a job
36
+ * container.
37
+ */
38
+ private apiProxyContainerArgs;
15
39
  generateApiFrpcProxies(address: string, port: string): any[];
16
40
  }
@@ -5,9 +5,18 @@ import { applyLoggingProxyToClass } from '../../../packages/common/src/index.js'
5
5
  * runtime environment's (see ContainerJobRuntime).
6
6
  */
7
7
  export class Provider {
8
- constructor(containerOrchestration, resourceManager) {
8
+ constructor(containerOrchestration, resourceManager,
9
+ /**
10
+ * Whether the API proxy container requests a GPU, which managed mode
11
+ * uses. Only a node that runs its jobs in containers can: a `--vm`/`--cvm`
12
+ * node passes its GPUs to the guest, so the host container has none and
13
+ * asking for one would stop the proxy, and so the node's API, from
14
+ * starting.
15
+ */
16
+ apiProxyRequestsGpu = false) {
9
17
  this.containerOrchestration = containerOrchestration;
10
18
  this.resourceManager = resourceManager;
19
+ this.apiProxyRequestsGpu = apiProxyRequestsGpu;
11
20
  this.frpcImage = configs().frp.containerImage;
12
21
  this.proxyStartupAbortController = undefined;
13
22
  applyLoggingProxyToClass(this);
@@ -40,8 +49,6 @@ export class Provider {
40
49
  const networkName = `api-${address}`;
41
50
  const frpc_name = `frpc-api-${address}`;
42
51
  await this.containerOrchestration.createNetwork(networkName);
43
- const networks = {};
44
- networks[networkName] = {};
45
52
  const startup = new AbortController();
46
53
  this.proxyStartupAbortController = startup;
47
54
  await this.containerOrchestration.pullImage(this.frpcImage, undefined, startup);
@@ -52,54 +59,15 @@ export class Provider {
52
59
  if (startup.signal.aborted) {
53
60
  throw new Error('API proxy setup was stopped');
54
61
  }
62
+ const apiProxyArgs = this.apiProxyContainerArgs(address, port, networkName);
55
63
  if (!doesFrpcExist) {
56
- await this.containerOrchestration.runFlowContainer(this.frpcImage, {
57
- name: 'frpc-api-' + address,
58
- // The node's persistent API proxy, not a job container: a resync
59
- // between jobs must leave it running rather than reap it.
60
- track: false,
61
- cmd: ['-c', '/etc/frp/frpc.toml'],
62
- networks,
63
- requires_network_mode: true,
64
- restart_policy: 'on-failure',
65
- env: {
66
- FRP_SERVER_ADDR: configs().frp.serverAddr,
67
- FRP_SERVER_PORT: configs().frp.serverPort.toString(),
68
- FRP_PROXIES: JSON.stringify(this.generateApiFrpcProxies(address, port)),
69
- },
70
- volumes: [
71
- {
72
- name: `frpc-${address}-logs`,
73
- dest: '/data',
74
- },
75
- ],
76
- });
64
+ await this.containerOrchestration.runFlowContainer(this.frpcImage, apiProxyArgs);
77
65
  }
78
66
  else {
79
67
  const hasFrpcExited = await this.containerOrchestration.isContainerExited(frpc_name);
80
68
  if (hasFrpcExited) {
81
69
  await this.containerOrchestration.stopAndDeleteContainer(frpc_name);
82
- await this.containerOrchestration.runFlowContainer(this.frpcImage, {
83
- name: 'frpc-api-' + address,
84
- // The node's persistent API proxy, not a job container: a resync
85
- // between jobs must leave it running rather than reap it.
86
- track: false,
87
- cmd: ['-c', '/etc/frp/frpc.toml'],
88
- networks,
89
- requires_network_mode: true,
90
- restart_policy: 'on-failure',
91
- env: {
92
- FRP_SERVER_ADDR: configs().frp.serverAddr,
93
- FRP_SERVER_PORT: configs().frp.serverPort.toString(),
94
- FRP_PROXIES: JSON.stringify(this.generateApiFrpcProxies(address, port)),
95
- },
96
- volumes: [
97
- {
98
- name: `frpc-${address}-logs`,
99
- dest: '/data',
100
- },
101
- ],
102
- });
70
+ await this.containerOrchestration.runFlowContainer(this.frpcImage, apiProxyArgs);
103
71
  }
104
72
  }
105
73
  }
@@ -109,6 +77,36 @@ export class Provider {
109
77
  this.proxyStartupAbortController = undefined;
110
78
  return true;
111
79
  }
80
+ /**
81
+ * The node's persistent API proxy container (`frpc-api-<address>`): frpc in
82
+ * managed mode (see the frpc image's `APP_MODE`). It requests a GPU only
83
+ * where a host container can use one (see `apiProxyRequestsGpu`). A resync
84
+ * between jobs must leave it running, so it is not tracked as a job
85
+ * container.
86
+ */
87
+ apiProxyContainerArgs(address, port, networkName) {
88
+ return {
89
+ name: 'frpc-api-' + address,
90
+ track: false,
91
+ cmd: ['-c', '/etc/frp/frpc.toml'],
92
+ gpu: this.apiProxyRequestsGpu,
93
+ networks: { [networkName]: {} },
94
+ requires_network_mode: true,
95
+ restart_policy: 'on-failure',
96
+ env: {
97
+ APP_MODE: 'managed',
98
+ FRP_SERVER_ADDR: configs().frp.serverAddr,
99
+ FRP_SERVER_PORT: configs().frp.serverPort.toString(),
100
+ FRP_PROXIES: JSON.stringify(this.generateApiFrpcProxies(address, port)),
101
+ },
102
+ volumes: [
103
+ {
104
+ name: `frpc-${address}-logs`,
105
+ dest: '/data',
106
+ },
107
+ ],
108
+ };
109
+ }
112
110
  generateApiFrpcProxies(address, port) {
113
111
  const { frp } = configs();
114
112
  const proxies = [
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.100-rc",
3
+ "version": "1.1.101",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.1.100-rc",
9
+ "version": "1.1.101",
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.100-rc",
3
+ "version": "1.1.101",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"