@nosana/node 1.1.73-dev.mr80.17351441846 → 1.1.73-dev.mr80.17352210002

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.1.1"
3
+ JOB_RUNTIME_IMAGE="nosana/job-runtime:v0.1.2"
4
4
  RESOURCE_MANAGER_IMAGE=registry.hub.docker.com/nosana/resource-manager:v1.1.19
5
5
  FRP_SERVER_PORT=7000
6
6
  MIN_DISK_SPACE=25
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.73-dev.mr80.17351441846",
3
+ "version": "1.1.73-dev.mr80.17352210002",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -1,8 +1,32 @@
1
+ import { existsSync } from 'fs';
1
2
  import os from 'os';
2
3
  import { OperationError } from '../../../common/src/index.js';
3
4
  import { DockerExtended } from './dockerExtended/index.js';
4
5
  import { createDockerRunOptions } from './createDockerRunOptions.js';
5
6
  import { liveAbortSignal } from '../utils/liveAbortSignal.js';
7
+ /** Docker writes `/.dockerenv` into every container, podman `/run/.containerenv`. */
8
+ function insideContainer() {
9
+ return existsSync('/.dockerenv') || existsSync('/run/.containerenv');
10
+ }
11
+ /**
12
+ * `path` as a host path through the mount holding it, the most specific when
13
+ * mounts nest; undefined when none holds it. Podman reports a destination as
14
+ * it was given, trailing slash and all.
15
+ */
16
+ function hostPathThrough(mounts, path) {
17
+ let through;
18
+ for (const { Source, Destination } of mounts) {
19
+ const dest = Destination?.replace(/\/+$/, '');
20
+ if (!Source || !dest)
21
+ continue;
22
+ if (path !== dest && !path.startsWith(`${dest}/`))
23
+ continue;
24
+ if (!through || dest.length > through.dest.length) {
25
+ through = { source: Source.replace(/\/+$/, ''), dest };
26
+ }
27
+ }
28
+ return through && through.source + path.slice(through.dest.length);
29
+ }
6
30
  export class DockerContainerOrchestration {
7
31
  constructor(socketPath, gpu, teeRuntime, hooks = {}) {
8
32
  this.hooks = hooks;
@@ -79,19 +103,31 @@ export class DockerContainerOrchestration {
79
103
  return this.docker.getContainer(id);
80
104
  }
81
105
  async resolveHostPath(path) {
106
+ // On a bare host the path already is a host path.
107
+ if (!insideContainer())
108
+ return path;
82
109
  try {
83
- // A container's hostname is its id unless overridden, so this finds the
84
- // node's own container; on a bare host the lookup fails and the path is
85
- // already a host path.
110
+ // A container's hostname is its id unless overridden, so this finds
111
+ // this process's own container.
86
112
  const self = await this.docker.getContainer(os.hostname()).inspect();
87
- const mount = self.Mounts?.find((m) => path === m.Destination || path.startsWith(`${m.Destination}/`));
88
- if (!mount?.Source)
89
- return path;
90
- return mount.Source + path.slice(mount.Destination.length);
113
+ return hostPathThrough(self.Mounts ?? [], path) ?? path;
91
114
  }
92
115
  catch (_) {
93
- return path;
116
+ // Not found by hostname: nosana/podman runs every container in its own
117
+ // UTS namespace (utsns="host"), so all of them have its hostname. Ours
118
+ // is among the running containers with a mount holding the path; when
119
+ // those all map it to one host path, that is ours.
120
+ }
121
+ try {
122
+ const sources = new Set((await this.docker.listContainers()).map((info) => hostPathThrough(info.Mounts ?? [], path)));
123
+ sources.delete(undefined);
124
+ if (sources.size === 1)
125
+ return [...sources][0];
126
+ }
127
+ catch (_) {
128
+ // Unresolved, as below.
94
129
  }
130
+ return path;
95
131
  }
96
132
  getConnection() {
97
133
  return this.docker;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.73-dev.mr80.17351441846",
3
+ "version": "1.1.73-dev.mr80.17352210002",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.1.73-dev.mr80.17351441846",
9
+ "version": "1.1.73-dev.mr80.17352210002",
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.73-dev.mr80.17351441846",
3
+ "version": "1.1.73-dev.mr80.17352210002",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"