@animastor/installer 0.2.16 → 0.2.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animastor/installer",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Animastor Private GPU Worker installer — self-contained CLI and library for GPU worker setup, verification, and management.",
5
5
  "main": "src/installer/index.js",
6
6
  "exports": {
@@ -1036,6 +1036,7 @@ async function cmdBoot(flags, { io = createRealIo(), spawn = require('child_proc
1036
1036
  hubUrl: resolveHubUrl(flags),
1037
1037
  manifests: recordedManifests(io, flags),
1038
1038
  boot: true,
1039
+ nodeBin: execPath,
1039
1040
  // the platform's startup script waits for this process: a
1040
1041
  // blackholed network must not stall it for the doctor timeout
1041
1042
  timeoutMs: 8000,
@@ -1116,21 +1117,33 @@ function recordedManifests(io, flags) {
1116
1117
  */
1117
1118
  async function preflightSelfUpdateFromHub(io, {
1118
1119
  flags = {}, statePath = null, workerDir = null, hubUrl = null, manifests = [], logger = null,
1119
- boot = false, timeoutMs = undefined,
1120
+ boot = false, timeoutMs = undefined, nodeBin = process.execPath,
1120
1121
  } = {}) {
1121
1122
  const skip = (reason) => ({ status: 'skipped', reason, notes: [], hub: null, decision: null, cliPath: null, version: null });
1122
1123
  if (flags['no-self-update']) return skip('--no-self-update');
1123
1124
  if (process.env[hubSelfUpdateMod.SELF_UPDATE_ENV]) return skip(`already updated in this run (${hubSelfUpdateMod.SELF_UPDATE_ENV})`);
1124
- const res = await hubSelfUpdateMod.hubSelfUpdate(io, {
1125
- hubUrl,
1126
- ownVersion: ownVersion(),
1127
- bundleVersion: workerDir ? workerMod.readPkgVersion(io, workerDir) : null,
1128
- manifests,
1129
- statePath,
1130
- persistentDir: persistentInstallerDir(flags),
1131
- nodeBin,
1132
- timeoutMs,
1133
- });
1125
+ let res;
1126
+ try {
1127
+ res = await hubSelfUpdateMod.hubSelfUpdate(io, {
1128
+ hubUrl,
1129
+ ownVersion: ownVersion(),
1130
+ bundleVersion: workerDir ? workerMod.readPkgVersion(io, workerDir) : null,
1131
+ manifests,
1132
+ statePath,
1133
+ persistentDir: persistentInstallerDir(flags),
1134
+ nodeBin: nodeBin || process.execPath,
1135
+ timeoutMs,
1136
+ });
1137
+ } catch (err) {
1138
+ // Installer 0.2.17 — the self-update is advisory: ANY error in it
1139
+ // (0.2.16 on 05.12: a ReferenceError here killed every doctor/boot)
1140
+ // leaves the run on the local version with a warning.
1141
+ const reason = (err && err.message) || String(err);
1142
+ res = {
1143
+ status: 'failed', reason, hub: null, decision: null, cliPath: null, version: null, manifest_revision: null,
1144
+ notes: [{ level: 'warn', text: `hub self-update failed: ${reason} — continuing with the local installer ${ownVersion() || 'unknown'}` }],
1145
+ };
1146
+ }
1134
1147
  // The boot path writes its own log lines (its stdout is bootstrap.log);
1135
1148
  // with a logger the lines go through the run's renderer.
1136
1149
  for (const n of res.notes || []) {
@@ -1342,8 +1355,11 @@ function createScreen() {
1342
1355
  });
1343
1356
  }
1344
1357
 
1345
- async function cmdInstall(flags, { doctor = false } = {}) {
1346
- const realIo = createRealIo();
1358
+ async function cmdInstall(flags, { doctor = false, io: injectedIo = null, reexec = reexecCli, stopAfterHubPreflight = false } = {}) {
1359
+ // io / reexec / stopAfterHubPreflight: test seams (0.2.17) — the doctor
1360
+ // path up to and including the hub self-update runs for real against a
1361
+ // fake hub; nothing else of the run is reached when stopping there.
1362
+ const realIo = injectedIo || createRealIo();
1347
1363
  // doctor = the same idempotent install for the RECORDED installation:
1348
1364
  // profiles come from install-state.json unless given explicitly. The
1349
1365
  // recorded MODE is not applied: the mode follows the machine (see
@@ -1392,16 +1408,21 @@ async function cmdInstall(flags, { doctor = false } = {}) {
1392
1408
  // adopted and this command line is re-executed in that version; offline,
1393
1409
  // the local version runs and the result says so (live 05.12: doctor on a
1394
1410
  // node ran 0.2.14 while the hub served 0.2.15 — nothing was updated).
1411
+ // The node binary of this run: the hub preflight, the tools preflight and
1412
+ // the worker get the same one (0.2.17).
1413
+ const runNodeBin = (probeMod.pickNodeBinary(realIo) || {}).bin || null;
1395
1414
  if (doctor && !dryRun) {
1396
1415
  const selfUpdate = await preflightSelfUpdateFromHub(realIo, {
1397
1416
  flags, statePath, workerDir, hubUrl, manifests: loadedManifests, logger, boot,
1417
+ nodeBin: runNodeBin || process.execPath,
1398
1418
  });
1399
1419
  if (selfUpdate.status === 'updated' && selfUpdate.cliPath) {
1400
1420
  // The code of this process is already loaded: the adopted version
1401
1421
  // must run the command.
1402
- await reexecCli({ cliPath: selfUpdate.cliPath });
1403
- return;
1422
+ await reexec({ cliPath: selfUpdate.cliPath });
1423
+ return { hubPreflight: selfUpdate, reexec: true };
1404
1424
  }
1425
+ if (stopAfterHubPreflight) return { hubPreflight: selfUpdate, reexec: false };
1405
1426
  }
1406
1427
 
1407
1428
  const hubVersion = doctor
@@ -1426,7 +1447,7 @@ async function cmdInstall(flags, { doctor = false } = {}) {
1426
1447
  // Tools + bundle of THIS version before anything can stop the run (0.2.5).
1427
1448
  const preflight = await preflightSelfUpdate(realIo, {
1428
1449
  flags, statePath, root, workerDir, hubUrl, repoRoot, manifests: loadedManifests, logger, dryRun,
1429
- nodeBin: (probeMod.pickNodeBinary(realIo) || {}).bin || null,
1450
+ nodeBin: runNodeBin,
1430
1451
  });
1431
1452
  const withPre = (res) => ({ ...res, preflight });
1432
1453
 
@@ -2463,8 +2484,8 @@ async function cmdLogs(flags) {
2463
2484
  });
2464
2485
  }
2465
2486
 
2466
- async function cmdDoctor(flags) {
2467
- return cmdInstall(flags, { doctor: true });
2487
+ async function cmdDoctor(flags, deps = {}) {
2488
+ return cmdInstall(flags, { ...deps, doctor: true });
2468
2489
  }
2469
2490
 
2470
2491
  // ---------------------------------------------------------------------------