@nosana/node 1.1.84-rc → 1.1.85-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.
Files changed (180) hide show
  1. package/dist/.env +2 -1
  2. package/dist/package.json +1 -1
  3. package/dist/packages/job-runtime/src/host/HostClient.d.ts +20 -4
  4. package/dist/packages/job-runtime/src/host/HostClient.js +35 -2
  5. package/dist/packages/job-runtime/src/host/contract.d.ts +27 -7
  6. package/dist/packages/job-runtime/src/host/contract.js +43 -7
  7. package/dist/packages/job-runtime/src/runtime/runJob.d.ts +8 -5
  8. package/dist/packages/job-runtime/src/runtime/runJob.js +44 -17
  9. package/dist/packages/vm-orchestrator/src/CidRegistry.d.ts +67 -0
  10. package/dist/packages/vm-orchestrator/src/CidRegistry.js +168 -0
  11. package/dist/packages/vm-orchestrator/src/GpuPool.d.ts +27 -0
  12. package/dist/packages/vm-orchestrator/src/GpuPool.js +41 -0
  13. package/dist/packages/vm-orchestrator/src/Hypervisor.d.ts +66 -0
  14. package/dist/packages/vm-orchestrator/src/Hypervisor.js +7 -0
  15. package/dist/packages/vm-orchestrator/src/QemuHypervisor.d.ts +62 -0
  16. package/dist/packages/vm-orchestrator/src/QemuHypervisor.js +185 -0
  17. package/dist/packages/vm-orchestrator/src/QemuHypervisorConfig.d.ts +61 -0
  18. package/dist/packages/vm-orchestrator/src/QemuHypervisorConfig.js +37 -0
  19. package/dist/packages/vm-orchestrator/src/QemuVmInstance.d.ts +37 -0
  20. package/dist/packages/vm-orchestrator/src/QemuVmInstance.js +44 -0
  21. package/dist/packages/vm-orchestrator/src/QmpClient.d.ts +43 -0
  22. package/dist/packages/vm-orchestrator/src/QmpClient.js +103 -0
  23. package/dist/packages/vm-orchestrator/src/VmSpec.d.ts +21 -0
  24. package/dist/packages/vm-orchestrator/src/VmSpec.js +30 -0
  25. package/dist/packages/vm-orchestrator/src/VmStateManager.d.ts +16 -0
  26. package/dist/packages/vm-orchestrator/src/VmStateManager.js +30 -0
  27. package/dist/packages/vm-orchestrator/src/bootAttempt.d.ts +31 -0
  28. package/dist/packages/vm-orchestrator/src/bootAttempt.js +193 -0
  29. package/dist/packages/vm-orchestrator/src/bootErrors.d.ts +33 -0
  30. package/dist/packages/vm-orchestrator/src/bootErrors.js +67 -0
  31. package/dist/packages/vm-orchestrator/src/buildCloudInit.d.ts +33 -0
  32. package/dist/packages/vm-orchestrator/src/buildCloudInit.js +55 -0
  33. package/dist/packages/vm-orchestrator/src/buildQemuArgs.d.ts +33 -0
  34. package/dist/packages/vm-orchestrator/src/buildQemuArgs.js +127 -0
  35. package/dist/packages/vm-orchestrator/src/diskSizing.d.ts +18 -0
  36. package/dist/packages/vm-orchestrator/src/diskSizing.js +41 -0
  37. package/dist/packages/vm-orchestrator/src/firmware.d.ts +5 -0
  38. package/dist/packages/vm-orchestrator/src/firmware.js +18 -0
  39. package/dist/packages/vm-orchestrator/src/hostAccess/VmHostAccess.d.ts +22 -0
  40. package/dist/packages/vm-orchestrator/src/hostAccess/VmHostAccess.js +33 -0
  41. package/dist/packages/vm-orchestrator/src/hostAccess/deviceProblems.d.ts +3 -0
  42. package/dist/packages/vm-orchestrator/src/hostAccess/deviceProblems.js +17 -0
  43. package/dist/packages/vm-orchestrator/src/hostAccess/findVmHostAccessProblems.d.ts +9 -0
  44. package/dist/packages/vm-orchestrator/src/hostAccess/findVmHostAccessProblems.js +17 -0
  45. package/dist/packages/vm-orchestrator/src/hostAccess/gpuProblems.d.ts +6 -0
  46. package/dist/packages/vm-orchestrator/src/hostAccess/gpuProblems.js +42 -0
  47. package/dist/packages/vm-orchestrator/src/hostAccess/index.d.ts +1 -0
  48. package/dist/packages/vm-orchestrator/src/hostAccess/index.js +1 -0
  49. package/dist/packages/vm-orchestrator/src/hostAccess/memlockProblems.d.ts +6 -0
  50. package/dist/packages/vm-orchestrator/src/hostAccess/memlockProblems.js +18 -0
  51. package/dist/packages/vm-orchestrator/src/hostAccess/workRootProblems.d.ts +7 -0
  52. package/dist/packages/vm-orchestrator/src/hostAccess/workRootProblems.js +30 -0
  53. package/dist/packages/vm-orchestrator/src/hostDevices.d.ts +12 -0
  54. package/dist/packages/vm-orchestrator/src/hostDevices.js +12 -0
  55. package/dist/packages/vm-orchestrator/src/hostTools.d.ts +25 -0
  56. package/dist/packages/vm-orchestrator/src/hostTools.js +39 -0
  57. package/dist/packages/vm-orchestrator/src/imageCache.d.ts +25 -0
  58. package/dist/packages/vm-orchestrator/src/imageCache.js +73 -0
  59. package/dist/packages/vm-orchestrator/src/imageDownload.d.ts +31 -0
  60. package/dist/packages/vm-orchestrator/src/imageDownload.js +85 -0
  61. package/dist/packages/vm-orchestrator/src/index.d.ts +19 -0
  62. package/dist/packages/vm-orchestrator/src/index.js +15 -0
  63. package/dist/packages/vm-orchestrator/src/memlockLimit.d.ts +5 -0
  64. package/dist/packages/vm-orchestrator/src/memlockLimit.js +23 -0
  65. package/dist/packages/vm-orchestrator/src/nvidiaHolders.d.ts +11 -0
  66. package/dist/packages/vm-orchestrator/src/nvidiaHolders.js +74 -0
  67. package/dist/packages/vm-orchestrator/src/pciNuma.d.ts +7 -0
  68. package/dist/packages/vm-orchestrator/src/pciNuma.js +18 -0
  69. package/dist/packages/vm-orchestrator/src/pciSysfs.d.ts +21 -0
  70. package/dist/packages/vm-orchestrator/src/pciSysfs.js +47 -0
  71. package/dist/packages/vm-orchestrator/src/processes.d.ts +37 -0
  72. package/dist/packages/vm-orchestrator/src/processes.js +102 -0
  73. package/dist/packages/vm-orchestrator/src/sockets.d.ts +21 -0
  74. package/dist/packages/vm-orchestrator/src/sockets.js +58 -0
  75. package/dist/packages/vm-orchestrator/src/sweepVmImageCache.d.ts +19 -0
  76. package/dist/packages/vm-orchestrator/src/sweepVmImageCache.js +132 -0
  77. package/dist/packages/vm-orchestrator/src/util.d.ts +14 -0
  78. package/dist/packages/vm-orchestrator/src/util.js +33 -0
  79. package/dist/packages/vm-orchestrator/src/vfioBinding.d.ts +27 -0
  80. package/dist/packages/vm-orchestrator/src/vfioBinding.js +163 -0
  81. package/dist/packages/vm-orchestrator/src/vmImageResolver.d.ts +20 -0
  82. package/dist/packages/vm-orchestrator/src/vmImageResolver.js +62 -0
  83. package/dist/packages/vm-orchestrator/src/vsockBridge.d.ts +20 -0
  84. package/dist/packages/vm-orchestrator/src/vsockBridge.js +27 -0
  85. package/dist/packages/vm-orchestrator/src/workDirs.d.ts +49 -0
  86. package/dist/packages/vm-orchestrator/src/workDirs.js +79 -0
  87. package/dist/src/NodeManager/configs/configs.d.ts +4 -0
  88. package/dist/src/NodeManager/configs/configs.js +3 -0
  89. package/dist/src/NodeManager/db/index.d.ts +10 -0
  90. package/dist/src/NodeManager/db/index.js +4 -0
  91. package/dist/src/NodeManager/monitoring/log/NodeLog.d.ts +2 -0
  92. package/dist/src/NodeManager/monitoring/log/NodeLog.js +21 -0
  93. package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.d.ts +8 -0
  94. package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.js +29 -5
  95. package/dist/src/NodeManager/monitoring/log/vmSetupLog.d.ts +11 -0
  96. package/dist/src/NodeManager/monitoring/log/vmSetupLog.js +33 -0
  97. package/dist/src/NodeManager/node/Node.d.ts +2 -0
  98. package/dist/src/NodeManager/node/Node.js +12 -5
  99. package/dist/src/NodeManager/node/job/ContainerJobRuntime.d.ts +141 -0
  100. package/dist/src/NodeManager/node/job/ContainerJobRuntime.js +419 -0
  101. package/dist/src/NodeManager/node/job/JobRuntimeEnvironment.d.ts +74 -0
  102. package/dist/src/NodeManager/node/job/JobRuntimeEnvironment.js +1 -0
  103. package/dist/src/NodeManager/node/job/JobRuntimeHost.d.ts +6 -2
  104. package/dist/src/NodeManager/node/job/JobRuntimeHost.js +13 -2
  105. package/dist/src/NodeManager/node/job/JobRuntimeSession.d.ts +12 -9
  106. package/dist/src/NodeManager/node/job/JobRuntimeSession.js +42 -71
  107. package/dist/src/NodeManager/node/job/VmJobRuntime.d.ts +109 -0
  108. package/dist/src/NodeManager/node/job/VmJobRuntime.js +258 -0
  109. package/dist/src/NodeManager/node/job/VmJobRuntimeConfig.d.ts +33 -0
  110. package/dist/src/NodeManager/node/job/VmJobRuntimeConfig.js +1 -0
  111. package/dist/src/NodeManager/node/job/buildJobRuntimeEnv.d.ts +41 -0
  112. package/dist/src/NodeManager/node/job/buildJobRuntimeEnv.js +25 -0
  113. package/dist/src/NodeManager/node/job/followFile.d.ts +14 -0
  114. package/dist/src/NodeManager/node/job/followFile.js +57 -0
  115. package/dist/src/NodeManager/node/job/jobHandler.d.ts +3 -3
  116. package/dist/src/NodeManager/node/job/jobHandler.js +7 -7
  117. package/dist/src/NodeManager/node/job/keepFailedConsole.d.ts +7 -0
  118. package/dist/src/NodeManager/node/job/keepFailedConsole.js +52 -0
  119. package/dist/src/NodeManager/node/job/selectJobRuntimeEnvironment.d.ts +50 -0
  120. package/dist/src/NodeManager/node/job/selectJobRuntimeEnvironment.js +117 -0
  121. package/dist/src/NodeManager/node/market/benchmark.d.ts +3 -3
  122. package/dist/src/NodeManager/node/market/benchmark.js +3 -3
  123. package/dist/src/NodeManager/node/market/marketHandler.d.ts +3 -3
  124. package/dist/src/NodeManager/node/market/marketHandler.js +3 -3
  125. package/dist/src/NodeManager/node/resource/resourceManager.d.ts +1 -1
  126. package/dist/src/NodeManager/node/resource/resourceManager.js +1 -1
  127. package/dist/src/NodeManager/provider/Provider.d.ts +3 -121
  128. package/dist/src/NodeManager/provider/Provider.js +3 -369
  129. package/dist/src/NodeManager/provider/vmHost/VmNodeOptions.d.ts +14 -0
  130. package/dist/src/NodeManager/provider/vmHost/VmNodeOptions.js +1 -0
  131. package/dist/src/NodeManager/provider/vmHost/capacity.d.ts +16 -0
  132. package/dist/src/NodeManager/provider/vmHost/capacity.js +47 -0
  133. package/dist/src/NodeManager/provider/vmHost/gpus.d.ts +19 -0
  134. package/dist/src/NodeManager/provider/vmHost/gpus.js +83 -0
  135. package/dist/src/NodeManager/provider/vmHost/index.d.ts +5 -0
  136. package/dist/src/NodeManager/provider/vmHost/index.js +4 -0
  137. package/dist/src/NodeManager/provider/vmHost/readVmSpec.d.ts +11 -0
  138. package/dist/src/NodeManager/provider/vmHost/readVmSpec.js +22 -0
  139. package/dist/src/NodeManager/provider/vmHost/setup/PrepareVmHostSystem.d.ts +27 -0
  140. package/dist/src/NodeManager/provider/vmHost/setup/PrepareVmHostSystem.js +25 -0
  141. package/dist/src/NodeManager/provider/vmHost/setup/fileOwnership.d.ts +6 -0
  142. package/dist/src/NodeManager/provider/vmHost/setup/fileOwnership.js +22 -0
  143. package/dist/src/NodeManager/provider/vmHost/setup/hostUser.d.ts +15 -0
  144. package/dist/src/NodeManager/provider/vmHost/setup/hostUser.js +25 -0
  145. package/dist/src/NodeManager/provider/vmHost/setup/index.d.ts +2 -0
  146. package/dist/src/NodeManager/provider/vmHost/setup/index.js +2 -0
  147. package/dist/src/NodeManager/provider/vmHost/setup/memlockLimits.d.ts +6 -0
  148. package/dist/src/NodeManager/provider/vmHost/setup/memlockLimits.js +12 -0
  149. package/dist/src/NodeManager/provider/vmHost/setup/prepareVmHost.d.ts +17 -0
  150. package/dist/src/NodeManager/provider/vmHost/setup/prepareVmHost.js +90 -0
  151. package/dist/src/NodeManager/provider/vmHost/setup/sudoCaller.d.ts +5 -0
  152. package/dist/src/NodeManager/provider/vmHost/setup/sudoCaller.js +35 -0
  153. package/dist/src/NodeManager/provider/vmHost/vmHostEnv.d.ts +20 -0
  154. package/dist/src/NodeManager/provider/vmHost/vmHostEnv.js +24 -0
  155. package/dist/src/NodeManager/provider/vmHost/workRoot.d.ts +14 -0
  156. package/dist/src/NodeManager/provider/vmHost/workRoot.js +84 -0
  157. package/dist/src/NodeManager/repository/NodeRepository.d.ts +12 -2
  158. package/dist/src/NodeManager/repository/NodeRepository.js +21 -1
  159. package/dist/src/cli/commands/prune/command.js +2 -1
  160. package/dist/src/cli/commands/run/action.d.ts +2 -2
  161. package/dist/src/cli/commands/run/action.js +15 -34
  162. package/dist/src/cli/commands/run/command.js +7 -2
  163. package/dist/src/cli/commands/sharedOptions/--config.d.ts +2 -0
  164. package/dist/src/cli/commands/sharedOptions/--config.js +2 -0
  165. package/dist/src/cli/commands/sharedOptions/--environment.d.ts +6 -0
  166. package/dist/src/cli/commands/sharedOptions/--environment.js +6 -0
  167. package/dist/src/cli/commands/sharedOptions/--gpu.js +5 -2
  168. package/dist/src/cli/commands/sharedOptions/--node-limits.d.ts +9 -0
  169. package/dist/src/cli/commands/sharedOptions/--node-limits.js +24 -0
  170. package/dist/src/cli/commands/sharedOptions/index.d.ts +3 -0
  171. package/dist/src/cli/commands/sharedOptions/index.js +3 -0
  172. package/dist/src/cli/commands/start/command.js +7 -2
  173. package/dist/src/cli/commands/vm-setup/action.d.ts +10 -0
  174. package/dist/src/cli/commands/vm-setup/action.js +14 -0
  175. package/dist/src/cli/commands/vm-setup/command.d.ts +3 -0
  176. package/dist/src/cli/commands/vm-setup/command.js +11 -0
  177. package/dist/src/cli/createNosanaCli.d.ts +1 -0
  178. package/dist/src/cli/createNosanaCli.js +4 -1
  179. package/npm-shrinkwrap.json +10 -2
  180. package/package.json +1 -1
@@ -1,16 +1,15 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { describeError } from '../../../../packages/common/src/index.js';
4
- import { isKnownVersion, JOB_RUNTIME_FILES, JOB_RUNTIME_HOST_SOCKET, JOB_RUNTIME_SEED_VERSION, RESOURCE_CHANGES_VERSION, readJson, writeJsonAtomic, } from '../../../../packages/job-runtime/src/host/index.js';
4
+ import { isReadableStatus, JOB_RUNTIME_FILES, JOB_RUNTIME_HOST_SOCKET, JOB_RUNTIME_SEED_VERSION, readJson, writeJsonAtomic, } from '../../../../packages/job-runtime/src/host/index.js';
5
5
  import { JobRuntimeHost } from './JobRuntimeHost.js';
6
6
  /**
7
7
  * How often a sidecar that exits before its result is started again before
8
- * the job is finished on what it last wrote, and how long apart.
8
+ * the job is finished on what it last wrote, and how long apart. An
9
+ * environment that does not restart its runtime (a VM) gives up at once.
9
10
  */
10
11
  const MAX_RUNTIME_RESTARTS = 5;
11
12
  const RUNTIME_RESTART_DELAY_MS = 5_000;
12
- /** How often an `onStatus` listener is handed the sidecar's status. */
13
- const STATUS_POLL_MS = 1_000;
14
13
  /**
15
14
  * One job's runtime from the node's side: the job's directory (the seed in,
16
15
  * the status and the cache changes out), the socket served in it, and the
@@ -22,6 +21,8 @@ export class JobRuntimeSession {
22
21
  constructor(options) {
23
22
  this.options = options;
24
23
  this.removing = false;
24
+ /** Resolves once the sidecar's status carries the job's result. */
25
+ this.result = createSignal();
25
26
  this.dir = path.join(options.dataDir, 'jobs', options.jobAddress);
26
27
  this.host = new JobRuntimeHost({
27
28
  socketPath: path.join(this.dir, JOB_RUNTIME_HOST_SOCKET),
@@ -32,11 +33,18 @@ export class JobRuntimeSession {
32
33
  });
33
34
  return headers.get('Authorization') ?? '';
34
35
  },
36
+ statusFile: path.join(this.dir, JOB_RUNTIME_FILES.status),
37
+ onStatus: (status) => {
38
+ if (status.result)
39
+ this.result.resolve();
40
+ options.onStatus?.(status);
41
+ },
35
42
  });
36
43
  }
37
44
  /**
38
- * The sidecar's latest status, undefined until it wrote one, or when what
39
- * it wrote is not one the node can read.
45
+ * The sidecar's latest status, as the socket kept it (or a sidecar of an
46
+ * earlier release wrote it); undefined until there is one, or when what is
47
+ * there is not one the node can read.
40
48
  */
41
49
  get status() {
42
50
  const status = readJson(path.join(this.dir, JOB_RUNTIME_FILES.status));
@@ -61,10 +69,10 @@ export class JobRuntimeSession {
61
69
  // override a directory's permissions, and it is the only thing that
62
70
  // sees this one.
63
71
  await fs.chmod(this.dir, 0o777);
64
- const { provider, inline, project } = this.options;
72
+ const { environment, inline, project } = this.options;
65
73
  const seed = {
66
74
  version: JOB_RUNTIME_SEED_VERSION,
67
- resources: provider.resourceManager.jobCacheSnapshot(),
75
+ resources: environment.cacheSnapshot(),
68
76
  ...(inline ? { inline: { definition: inline, project, host: project } } : {}),
69
77
  };
70
78
  writeJsonAtomic(path.join(this.dir, JOB_RUNTIME_FILES.seed), seed);
@@ -96,8 +104,8 @@ export class JobRuntimeSession {
96
104
  this.follow();
97
105
  }
98
106
  async renew() {
99
- const { provider, jobAddress } = this.options;
100
- if (!(await provider.isJobRuntimeOutdated(jobAddress)))
107
+ const { environment, jobAddress } = this.options;
108
+ if (!(await environment.isOutdated?.(jobAddress)))
101
109
  return;
102
110
  console.log(`The runtime of job ${jobAddress} is on an older job runtime image; replacing it with the node's`);
103
111
  try {
@@ -113,8 +121,8 @@ export class JobRuntimeSession {
113
121
  * the job up from the records the volume holds.
114
122
  */
115
123
  startSidecar() {
116
- const { provider, jobAddress, inline } = this.options;
117
- return provider.startJobRuntime(jobAddress, this.dir, inline ? 'inline' : 'onchain', this.options.console);
124
+ const { environment, jobAddress, inline } = this.options;
125
+ return environment.start(jobAddress, this.dir, inline ? 'inline' : 'onchain', this.options.console);
118
126
  }
119
127
  /**
120
128
  * Starts the sidecar again after it went before its result: the exited
@@ -122,9 +130,9 @@ export class JobRuntimeSession {
122
130
  * by a runtime that auto-removed it), a new one on the same volume.
123
131
  */
124
132
  async startAgain() {
125
- const { provider, jobAddress } = this.options;
126
- if (await provider.hasJobRuntime(jobAddress)) {
127
- await provider.restartJobRuntime(jobAddress);
133
+ const { environment, jobAddress } = this.options;
134
+ if (environment.restart && (await environment.has(jobAddress))) {
135
+ await environment.restart(jobAddress);
128
136
  }
129
137
  else {
130
138
  await this.startSidecar();
@@ -141,10 +149,10 @@ export class JobRuntimeSession {
141
149
  */
142
150
  async remove() {
143
151
  this.removing = true;
144
- clearInterval(this.statusPoll);
145
- writeBackCacheChanges(this.dir, this.options.provider.resourceManager, this.options.jobAddress);
152
+ const { environment, jobAddress } = this.options;
153
+ environment.writeBackCache(this.dir, jobAddress);
146
154
  try {
147
- await this.options.provider.stopJobRuntime(this.options.jobAddress);
155
+ await environment.remove(jobAddress);
148
156
  }
149
157
  catch (error) {
150
158
  console.error(`Failed to remove the runtime of job ${this.options.jobAddress}: ${describeError(error)}`);
@@ -160,7 +168,6 @@ export class JobRuntimeSession {
160
168
  */
161
169
  async release() {
162
170
  this.removing = true;
163
- clearInterval(this.statusPoll);
164
171
  await this.host.close().catch(() => undefined);
165
172
  }
166
173
  /**
@@ -169,44 +176,41 @@ export class JobRuntimeSession {
169
176
  * What each job changed in the cache records is written back first, so the
170
177
  * volumes it made are known.
171
178
  */
172
- static async removeLeftovers(dataDir, resourceManager, liveJob) {
179
+ static async removeLeftovers(dataDir, environment, liveJob) {
173
180
  const jobs = path.join(dataDir, 'jobs');
174
181
  const entries = await fs.readdir(jobs).catch(() => []);
175
182
  for (const job of entries) {
176
183
  if (job === liveJob)
177
184
  continue;
178
185
  const dir = path.join(jobs, job);
179
- writeBackCacheChanges(dir, resourceManager, job);
186
+ environment.writeBackCache(dir, job);
180
187
  await fs.rm(dir, { recursive: true, force: true }).catch(() => undefined);
181
188
  }
182
189
  }
183
190
  follow() {
184
- const { onStatus } = this.options;
185
- if (onStatus) {
186
- this.statusPoll = setInterval(() => {
187
- const status = this.status;
188
- if (status)
189
- onStatus(status);
190
- }, STATUS_POLL_MS);
191
- }
192
- this.exited = this.waitForExit().finally(() => clearInterval(this.statusPoll));
191
+ this.exited = this.waitForExit();
193
192
  }
194
193
  /**
195
194
  * Waits for the sidecar to exit with its result. One that exits without
196
195
  * it (a crash, the runtime restarting) is started again, and one that is
197
196
  * gone without it (removed from under the node) is started anew; either
198
197
  * takes the job up from its data volume. One that keeps going is given up
199
- * on. Only this session removing the sidecar makes it gone for good.
198
+ * on, and a runtime its environment does not restart (a VM) at once. Only
199
+ * this session removing the sidecar makes it gone for good.
200
200
  */
201
201
  async waitForExit() {
202
- const { provider, jobAddress } = this.options;
202
+ const { environment, jobAddress } = this.options;
203
+ const maxRestarts = environment.restart ? MAX_RUNTIME_RESTARTS : 0;
204
+ // A result a sidecar sent before this process took the job over.
205
+ if (this.status?.result)
206
+ this.result.resolve();
203
207
  for (let restarts = 0;; restarts++) {
204
- const exit = await provider.waitForJobRuntime(jobAddress);
208
+ const exit = await environment.wait(jobAddress, this.result.promise);
205
209
  const status = this.status;
206
210
  if (this.removing ||
207
211
  status?.result ||
208
212
  exit?.exitCode === 0 ||
209
- restarts >= MAX_RUNTIME_RESTARTS) {
213
+ restarts >= maxRestarts) {
210
214
  return status;
211
215
  }
212
216
  console.error(exit
@@ -219,41 +223,8 @@ export class JobRuntimeSession {
219
223
  }
220
224
  }
221
225
  }
222
- /**
223
- * Writes what the job in `dir` changed in the cache records back to the
224
- * node's. Whole or not at all: changes of a version the node does not know
225
- * are left out of the records rather than half applied.
226
- */
227
- function writeBackCacheChanges(dir, resourceManager, jobAddress) {
228
- const changes = readJson(path.join(dir, JOB_RUNTIME_FILES.resources));
229
- if (changes && isKnownVersion(changes.version, RESOURCE_CHANGES_VERSION)) {
230
- resourceManager.applyJobCacheChanges(changes);
231
- }
232
- else if (changes) {
233
- console.error(`Ignoring the cache changes of job ${jobAddress}: version ` +
234
- `${String(changes.version)}, this node reads up to ${RESOURCE_CHANGES_VERSION}`);
235
- }
236
- }
237
- /**
238
- * Whether a status file has what the node reads of it in the shape it reads
239
- * it: the outcome, the ops (the benchmark's progress) and, once there, the
240
- * result. A status has no version (see JOB_RUNTIME_SEED_VERSION); one an
241
- * older sidecar wrote reads the same.
242
- */
243
- function isReadableStatus(value) {
244
- if (typeof value !== 'object' || value === null)
245
- return false;
246
- const status = value;
247
- if (typeof status.status !== 'string' ||
248
- !Array.isArray(status.errors) ||
249
- !Array.isArray(status.opStates)) {
250
- return false;
251
- }
252
- if (status.result === undefined)
253
- return true;
254
- if (typeof status.result !== 'object' || status.result === null)
255
- return false;
256
- const { ipfsHash, error } = status.result;
257
- return ((ipfsHash === undefined || typeof ipfsHash === 'string') &&
258
- (error === undefined || typeof error === 'string'));
226
+ function createSignal() {
227
+ let resolve = () => undefined;
228
+ const promise = new Promise((done) => (resolve = done));
229
+ return { promise, resolve };
259
230
  }
@@ -0,0 +1,109 @@
1
+ import { type JobRuntimeConsole, type JobRuntimeKind } from '../../../../packages/job-runtime/src/host/index.js';
2
+ import type { ResourceCacheSnapshot } from '../../../../packages/job-runtime/src/resources/index.js';
3
+ import type { JobRuntimeEnvironment, JobRuntimeExit } from './JobRuntimeEnvironment.js';
4
+ import type { VmJobRuntimeConfig, VmJobRuntimeSystem } from './VmJobRuntimeConfig.js';
5
+ /**
6
+ * Each job's runtime in a VM of its own: the golden image, booted with the job's directory
7
+ * (the seed and the sidecar's environment) by cloud-init, runs the same `nosana/job-runtime`
8
+ * image as a container in the guest, and the guest's `host.sock` is bridged over vsock to the
9
+ * one the node serves in the job's directory (see docs/vm-runtime-plan.md). QEMU runs detached
10
+ * from the node; its VmRecord, kept in the node's database by job, is how a later node process
11
+ * attaches to it or reaps it.
12
+ *
13
+ * A VM is never restarted, and its cache dies with its overlay.
14
+ */
15
+ export declare class VmJobRuntime implements JobRuntimeEnvironment {
16
+ private readonly config;
17
+ private readonly system;
18
+ private readonly instances;
19
+ private readonly hypervisor;
20
+ private readonly repository;
21
+ private readonly sweepImageCache;
22
+ private readonly shutdownGraceMs;
23
+ private readonly outputPollMs;
24
+ constructor(config: VmJobRuntimeConfig, system: VmJobRuntimeSystem);
25
+ /** A VM's cache dies with its overlay: its runtime starts from none. */
26
+ cacheSnapshot(): ResourceCacheSnapshot;
27
+ /** ...and leaves no changes to the node's. */
28
+ writeBackCache(): void;
29
+ /**
30
+ * Resolves the golden image into the cache (downloaded and verified when missing), so the
31
+ * next job's VM boots without waiting on it, then deletes the cached images nothing needs
32
+ * any more.
33
+ */
34
+ prepare(): Promise<void>;
35
+ /**
36
+ * Boots the job's VM on `hostDir`, the job's directory: the seed the session wrote there and
37
+ * the sidecar's environment go in by cloud-init, the guest's `host.sock` is bridged to the
38
+ * one in `hostDir`. A VM the job already has is destroyed first. The VM's record is kept by
39
+ * job.
40
+ */
41
+ start(jobAddress: string, hostDir: string, kind: JobRuntimeKind,
42
+ /** What its console carries; `entries` for `nosana node run` to render. */
43
+ consoleOutput?: JobRuntimeConsole): Promise<void>;
44
+ /**
45
+ * Whether the job has a VM, running or not: one whose QEMU is gone has exited, and the wait
46
+ * on it answers at once.
47
+ */
48
+ has(jobAddress: string): Promise<boolean>;
49
+ /**
50
+ * Waits for the job's VM to be over. With the result reported (the runtime's last status,
51
+ * which the node keeps), the guest is powered down, given its grace, and destroyed: exit 0.
52
+ * QEMU going first is the job's end without it: exit 1. Undefined when the job has no VM. A
53
+ * guest that never reports runs into the job's expiry, and `remove` destroys it.
54
+ */
55
+ wait(jobAddress: string, result: Promise<void>): Promise<JobRuntimeExit | undefined>;
56
+ /**
57
+ * Destroys the job's VM if it is still there, drops its record, then deletes the cached
58
+ * images nothing needs any more. A VM already gone is no error.
59
+ */
60
+ remove(jobAddress: string): Promise<void>;
61
+ /** Where the job's runtime serves its job API: QEMU's forward of guest 8080. */
62
+ url(jobAddress: string): Promise<string | undefined>;
63
+ /**
64
+ * Follows the VM's serial console (the guest's boot, then the sidecar's console, which the
65
+ * launcher sends there) from its start: the file the node keeps it in, read as it grows.
66
+ * Undefined when the job has no VM.
67
+ */
68
+ output(jobAddress: string, read: (stream: 'stdout' | 'stderr', text: string) => void): Promise<(() => void) | undefined>;
69
+ /**
70
+ * Destroys the VM of every job but `liveJob`, and drops its record; then the work dirs of
71
+ * VMs that have no record (one this node booted but never recorded); then the image sweep.
72
+ * A VM that will not go keeps its record, for the next sweep.
73
+ */
74
+ sweep(liveJob?: string): Promise<void>;
75
+ /**
76
+ * The sidecar's environment as ContainerJobRuntime sets it, plus what the guest's launcher
77
+ * reads; the guest adds its own docker's.
78
+ */
79
+ private guestEnv;
80
+ /** The golden image as a local file; a failure names the image. */
81
+ private resolveGoldenImage;
82
+ /**
83
+ * The job's VM this process holds, else the one its record names, attached; undefined when
84
+ * that QEMU is gone or cannot be attached to.
85
+ */
86
+ private heldOrAttached;
87
+ /**
88
+ * Waits for the result or QEMU's exit, whichever comes first, and destroys the VM: after
89
+ * powering the guest down and its grace, with the result.
90
+ */
91
+ private waitForEnd;
92
+ /**
93
+ * The job's VM attached from its record, and held. Of a QEMU no longer running, what it left
94
+ * (its bridge, CID, GPUs and work dir) is released and undefined answered, its record kept.
95
+ * Throws when a QEMU that runs cannot be attached to, or what a dead one left will not go.
96
+ */
97
+ private attached;
98
+ /**
99
+ * Destroys the job's VM: the one this process holds, else the one its record names (of a
100
+ * QEMU no longer running, what it left is released).
101
+ */
102
+ private destroy;
103
+ /** The job's VM attached from its record, when it has one (see attached). */
104
+ private attachedFromRecord;
105
+ /** Destroys a VM an earlier runtime left and drops its record; one that will not go keeps it. */
106
+ private removeLeftVm;
107
+ /** Deletes every cached image but the configured one that no VM backs. */
108
+ private sweepImages;
109
+ }
@@ -0,0 +1,258 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { applyLoggingProxyToClass, describeError } from '../../../../packages/common/src/index.js';
4
+ import { JOB_RUNTIME_FILES, JOB_RUNTIME_HOST_SOCKET, } from '../../../../packages/job-runtime/src/host/index.js';
5
+ import { sweepVmImageCache, VM_CONSOLE_LOG, VmNotRunningError, waitAtMost, } from '../../../../packages/vm-orchestrator/src/index.js';
6
+ import { trackVmSetup } from '../../monitoring/log/vmSetupLog.js';
7
+ import { buildJobRuntimeEnv } from './buildJobRuntimeEnv.js';
8
+ import { followFile } from './followFile.js';
9
+ import { keepFailedConsole } from './keepFailedConsole.js';
10
+ /** How long a powered-down guest gets to stop before QEMU is killed (as VM-POC). */
11
+ const SHUTDOWN_GRACE_MS = 20_000;
12
+ /** How often a followed console file is read for what the guest wrote since. */
13
+ const OUTPUT_POLL_MS = 250;
14
+ /**
15
+ * Each job's runtime in a VM of its own: the golden image, booted with the job's directory
16
+ * (the seed and the sidecar's environment) by cloud-init, runs the same `nosana/job-runtime`
17
+ * image as a container in the guest, and the guest's `host.sock` is bridged over vsock to the
18
+ * one the node serves in the job's directory (see docs/vm-runtime-plan.md). QEMU runs detached
19
+ * from the node; its VmRecord, kept in the node's database by job, is how a later node process
20
+ * attaches to it or reaps it.
21
+ *
22
+ * A VM is never restarted, and its cache dies with its overlay.
23
+ */
24
+ export class VmJobRuntime {
25
+ constructor(config, system) {
26
+ this.config = config;
27
+ this.system = system;
28
+ this.instances = new Map();
29
+ this.hypervisor = system.hypervisor;
30
+ this.repository = system.repository;
31
+ this.sweepImageCache = system.sweepImageCache ?? sweepVmImageCache;
32
+ this.shutdownGraceMs = config.shutdownGraceMs ?? SHUTDOWN_GRACE_MS;
33
+ this.outputPollMs = config.outputPollMs ?? OUTPUT_POLL_MS;
34
+ applyLoggingProxyToClass(this);
35
+ }
36
+ /** A VM's cache dies with its overlay: its runtime starts from none. */
37
+ cacheSnapshot() {
38
+ return { images: {}, volumes: {}, marketImages: [], marketVolumes: [] };
39
+ }
40
+ /** ...and leaves no changes to the node's. */
41
+ writeBackCache() {
42
+ // Nothing to take up: the guest's cache is its own.
43
+ }
44
+ /**
45
+ * Resolves the golden image into the cache (downloaded and verified when missing), so the
46
+ * next job's VM boots without waiting on it, then deletes the cached images nothing needs
47
+ * any more.
48
+ */
49
+ async prepare() {
50
+ await this.resolveGoldenImage();
51
+ await this.sweepImages();
52
+ }
53
+ /**
54
+ * Boots the job's VM on `hostDir`, the job's directory: the seed the session wrote there and
55
+ * the sidecar's environment go in by cloud-init, the guest's `host.sock` is bridged to the
56
+ * one in `hostDir`. A VM the job already has is destroyed first. The VM's record is kept by
57
+ * job.
58
+ */
59
+ async start(jobAddress, hostDir, kind,
60
+ /** What its console carries; `entries` for `nosana node run` to render. */
61
+ consoleOutput = 'text') {
62
+ await this.destroy(jobAddress);
63
+ const seed = await fs.readFile(path.join(hostDir, JOB_RUNTIME_FILES.seed), 'utf8');
64
+ // The console shows the setup as one spinner; the boot's steps are not reported.
65
+ const instance = await trackVmSetup(jobAddress, async () => this.hypervisor.boot(this.config.spec, {
66
+ imagePath: await this.resolveGoldenImage(),
67
+ hostSocket: path.join(hostDir, JOB_RUNTIME_HOST_SOCKET),
68
+ cloudInit: { seed, env: this.guestEnv(jobAddress, kind, consoleOutput) },
69
+ }));
70
+ this.instances.set(jobAddress, instance);
71
+ this.repository.setVm(jobAddress, instance.record);
72
+ }
73
+ /**
74
+ * Whether the job has a VM, running or not: one whose QEMU is gone has exited, and the wait
75
+ * on it answers at once.
76
+ */
77
+ async has(jobAddress) {
78
+ return this.repository.getVm(jobAddress) !== undefined;
79
+ }
80
+ /**
81
+ * Waits for the job's VM to be over. With the result reported (the runtime's last status,
82
+ * which the node keeps), the guest is powered down, given its grace, and destroyed: exit 0.
83
+ * QEMU going first is the job's end without it: exit 1. Undefined when the job has no VM. A
84
+ * guest that never reports runs into the job's expiry, and `remove` destroys it.
85
+ */
86
+ async wait(jobAddress, result) {
87
+ const record = this.repository.getVm(jobAddress);
88
+ if (!record)
89
+ return undefined;
90
+ const instance = await this.heldOrAttached(jobAddress, record);
91
+ // A QEMU that is gone, or runs but cannot be attached to, is given up on as one that
92
+ // stopped; its record stays for remove, or the next sweep.
93
+ if (!instance)
94
+ return { exitCode: 1 };
95
+ return this.waitForEnd(jobAddress, instance, result);
96
+ }
97
+ /**
98
+ * Destroys the job's VM if it is still there, drops its record, then deletes the cached
99
+ * images nothing needs any more. A VM already gone is no error.
100
+ */
101
+ async remove(jobAddress) {
102
+ await this.destroy(jobAddress);
103
+ this.repository.deleteVm(jobAddress);
104
+ await this.sweepImages();
105
+ }
106
+ /** Where the job's runtime serves its job API: QEMU's forward of guest 8080. */
107
+ async url(jobAddress) {
108
+ const record = this.repository.getVm(jobAddress);
109
+ if (!record || !(await this.hypervisor.isRunning(record)))
110
+ return undefined;
111
+ return `http://127.0.0.1:${record.apiHostPort}`;
112
+ }
113
+ /**
114
+ * Follows the VM's serial console (the guest's boot, then the sidecar's console, which the
115
+ * launcher sends there) from its start: the file the node keeps it in, read as it grows.
116
+ * Undefined when the job has no VM.
117
+ */
118
+ async output(jobAddress, read) {
119
+ const record = this.repository.getVm(jobAddress);
120
+ if (!record)
121
+ return undefined;
122
+ return followFile({
123
+ file: path.join(record.workdir, VM_CONSOLE_LOG),
124
+ // The serial line has no stderr.
125
+ onText: (text) => read('stdout', text),
126
+ pollMs: this.outputPollMs,
127
+ });
128
+ }
129
+ /**
130
+ * Destroys the VM of every job but `liveJob`, and drops its record; then the work dirs of
131
+ * VMs that have no record (one this node booted but never recorded); then the image sweep.
132
+ * A VM that will not go keeps its record, for the next sweep.
133
+ */
134
+ async sweep(liveJob) {
135
+ const leftJobs = Object.keys(this.repository.listVms()).filter((job) => job !== liveJob);
136
+ for (const jobAddress of leftJobs)
137
+ await this.removeLeftVm(jobAddress);
138
+ const recorded = Object.values(this.repository.listVms()).map(({ workdir }) => workdir);
139
+ await this.hypervisor.sweepWorkDirs(recorded);
140
+ await this.sweepImages();
141
+ }
142
+ /**
143
+ * The sidecar's environment as ContainerJobRuntime sets it, plus what the guest's launcher
144
+ * reads; the guest adds its own docker's.
145
+ */
146
+ guestEnv(jobAddress, kind, consoleOutput) {
147
+ const { runtimeImage, gpuPowerLimitWatts } = this.config;
148
+ return {
149
+ ...buildJobRuntimeEnv({ ...this.config, jobAddress, kind, consoleOutput }),
150
+ JOB_RUNTIME_IMAGE: runtimeImage,
151
+ ...(gpuPowerLimitWatts === undefined ? {} : { GPU_POWER_LIMIT: String(gpuPowerLimitWatts) }),
152
+ };
153
+ }
154
+ /** The golden image as a local file; a failure names the image. */
155
+ async resolveGoldenImage() {
156
+ const { image } = this.config;
157
+ try {
158
+ return await this.system.resolveImage(image);
159
+ }
160
+ catch (error) {
161
+ throw new Error(`Failed to get the golden VM image ${image}: ${describeError(error)}`);
162
+ }
163
+ }
164
+ /**
165
+ * The job's VM this process holds, else the one its record names, attached; undefined when
166
+ * that QEMU is gone or cannot be attached to.
167
+ */
168
+ async heldOrAttached(jobAddress, record) {
169
+ const held = this.instances.get(jobAddress);
170
+ if (held)
171
+ return held;
172
+ try {
173
+ return await this.attached(jobAddress, record);
174
+ }
175
+ catch (error) {
176
+ console.error(`Failed to attach to the VM of job ${jobAddress}: ${describeError(error)}`);
177
+ return undefined;
178
+ }
179
+ }
180
+ /**
181
+ * Waits for the result or QEMU's exit, whichever comes first, and destroys the VM: after
182
+ * powering the guest down and its grace, with the result.
183
+ */
184
+ async waitForEnd(jobAddress, instance, result) {
185
+ const exited = instance.waitForExit().then(() => 'exited');
186
+ const first = await Promise.race([exited, result.then(() => 'result')]);
187
+ // Removed meanwhile: remove destroyed it.
188
+ if (this.instances.get(jobAddress) !== instance)
189
+ return { exitCode: 1 };
190
+ if (first === 'result') {
191
+ await instance.shutdown();
192
+ await waitAtMost(exited, this.shutdownGraceMs);
193
+ }
194
+ else {
195
+ const consoleFile = path.join(instance.record.workdir, VM_CONSOLE_LOG);
196
+ await keepFailedConsole(jobAddress, consoleFile, this.config.workRoot);
197
+ }
198
+ await instance.destroy();
199
+ this.instances.delete(jobAddress);
200
+ return { exitCode: first === 'result' ? 0 : 1 };
201
+ }
202
+ /**
203
+ * The job's VM attached from its record, and held. Of a QEMU no longer running, what it left
204
+ * (its bridge, CID, GPUs and work dir) is released and undefined answered, its record kept.
205
+ * Throws when a QEMU that runs cannot be attached to, or what a dead one left will not go.
206
+ */
207
+ async attached(jobAddress, record) {
208
+ let instance;
209
+ try {
210
+ instance = await this.hypervisor.attach(record);
211
+ }
212
+ catch (error) {
213
+ if (!(error instanceof VmNotRunningError))
214
+ throw error;
215
+ await this.hypervisor.release(record);
216
+ return undefined;
217
+ }
218
+ this.instances.set(jobAddress, instance);
219
+ // Attach starts a new bridge when the old one is gone.
220
+ if (instance.record.bridgePid !== record.bridgePid) {
221
+ this.repository.setVm(jobAddress, instance.record);
222
+ }
223
+ return instance;
224
+ }
225
+ /**
226
+ * Destroys the job's VM: the one this process holds, else the one its record names (of a
227
+ * QEMU no longer running, what it left is released).
228
+ */
229
+ async destroy(jobAddress) {
230
+ const instance = this.instances.get(jobAddress) ?? (await this.attachedFromRecord(jobAddress));
231
+ if (!instance)
232
+ return;
233
+ this.instances.delete(jobAddress);
234
+ await instance.destroy();
235
+ }
236
+ /** The job's VM attached from its record, when it has one (see attached). */
237
+ async attachedFromRecord(jobAddress) {
238
+ const record = this.repository.getVm(jobAddress);
239
+ return record ? this.attached(jobAddress, record) : undefined;
240
+ }
241
+ /** Destroys a VM an earlier runtime left and drops its record; one that will not go keeps it. */
242
+ async removeLeftVm(jobAddress) {
243
+ try {
244
+ await this.destroy(jobAddress);
245
+ this.repository.deleteVm(jobAddress);
246
+ }
247
+ catch (error) {
248
+ console.error(`Failed to remove the VM of job ${jobAddress}: ${describeError(error)}`);
249
+ }
250
+ }
251
+ /** Deletes every cached image but the configured one that no VM backs. */
252
+ async sweepImages() {
253
+ const { cacheDir, image, workRoot } = this.config;
254
+ await this.sweepImageCache(cacheDir, [image], workRoot, {
255
+ log: (message) => console.log(message),
256
+ }).catch((error) => console.error(`Failed to sweep the VM image cache: ${describeError(error)}`));
257
+ }
258
+ }
@@ -0,0 +1,33 @@
1
+ import type { sweepVmImageCache, Hypervisor, VmSpec } from '../../../../packages/vm-orchestrator/src/index.js';
2
+ import type { NodeRepository } from '../../repository/NodeRepository.js';
3
+ import type { JobRuntimeNodeSettings } from './buildJobRuntimeEnv.js';
4
+ /** What every job's VM is booted from and with, and what its sidecar is told. */
5
+ export interface VmJobRuntimeConfig extends JobRuntimeNodeSettings {
6
+ /** The golden image every job's VM boots (`GOLDEN_VM_IMAGE`). */
7
+ image: string;
8
+ /** Where the image resolver caches images. */
9
+ cacheDir: string;
10
+ /** Where the VMs' work dirs are (`<data dir>/vms`). */
11
+ workRoot: string;
12
+ /** The VM every job boots: its vCPUs, memory, GPUs and disk. */
13
+ spec: VmSpec;
14
+ /** Power cap (watts) the guest applies to each GPU. */
15
+ gpuPowerLimitWatts?: number;
16
+ /** The `nosana/job-runtime` image the guest pulls and runs (`JOB_RUNTIME_IMAGE`). */
17
+ runtimeImage: string;
18
+ /** How long a powered-down guest gets to stop before QEMU is killed; 20 s by default. */
19
+ shutdownGraceMs?: number;
20
+ /** How often the console is read for what the guest wrote since; 250 ms by default. */
21
+ outputPollMs?: number;
22
+ }
23
+ /** What the runtime runs its VMs with; injectable for tests. */
24
+ export interface VmJobRuntimeSystem {
25
+ /** Boots VMs, and attaches to or releases those a record names. */
26
+ hypervisor: Hypervisor;
27
+ /** Keeps each job's VM record, by which a later node process finds the VM. */
28
+ repository: NodeRepository;
29
+ /** Resolves an image to a local file, downloading and verifying it when missing. */
30
+ resolveImage: (image: string) => Promise<string>;
31
+ /** Deletes the cached images nothing needs any more; sweepVmImageCache by default. */
32
+ sweepImageCache?: typeof sweepVmImageCache;
33
+ }
@@ -0,0 +1,41 @@
1
+ import { type JobRuntimeConsole, type JobRuntimeKind } from '../../../../packages/job-runtime/src/host/index.js';
2
+ /** The frp server a job's sidecar exposes the job API through. */
3
+ export interface JobRuntimeFrp {
4
+ /** The frp server's address. */
5
+ serverAddr: string;
6
+ /** The frp server's port. */
7
+ serverPort: number;
8
+ /** The frpc image the sidecar runs. */
9
+ containerImage: string;
10
+ }
11
+ /** What the node tells every job's sidecar of itself, whatever the job. */
12
+ export interface JobRuntimeNodeSettings {
13
+ /** The node's address. */
14
+ nodeAddress: string;
15
+ /** The Nosana network the node is on. */
16
+ network: string;
17
+ /** The node SDK's RPC endpoint, if it has one. */
18
+ rpc?: string;
19
+ /** The frp server the job API is exposed through. */
20
+ frp: JobRuntimeFrp;
21
+ /** The resource manager image the sidecar fetches resources with. */
22
+ resourceManagerImage: string;
23
+ /** The node's version. */
24
+ nodeVersion: string;
25
+ }
26
+ /** What the sidecar's environment says of the job and the node. */
27
+ export interface JobRuntimeEnvSource extends JobRuntimeNodeSettings {
28
+ /** The job's address. */
29
+ jobAddress: string;
30
+ /** Whether the job is onchain or an inline run. */
31
+ kind: JobRuntimeKind;
32
+ /** What its console carries; `entries` for `nosana node run` to render. */
33
+ consoleOutput: JobRuntimeConsole;
34
+ }
35
+ /**
36
+ * The sidecar's environment as every runtime environment sets it (see
37
+ * docs/job-runtime-sidecar.md, "What the node starts"): the job, the node and what the job's
38
+ * containers are run with. What the sidecar's own host adds (its container runtime, its GPUs)
39
+ * is each environment's.
40
+ */
41
+ export declare function buildJobRuntimeEnv(source: JobRuntimeEnvSource): Record<string, string>;