@nosana/node 1.1.96-rc → 1.1.97-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/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import { IN_JOB_LOOP_ENV } from '../exitCodes.js';
|
|
|
14
14
|
import { reportError } from './monitoring/reportError.js';
|
|
15
15
|
import { reportPodmanDiagnostics } from './monitoring/reportPodmanDiagnostics.js';
|
|
16
16
|
import { OperatorInput } from './input/OperatorInput.js';
|
|
17
|
+
import { clearDrain, drainRequested } from './node/drain.js';
|
|
17
18
|
export default class NodeManager {
|
|
18
19
|
constructor(options) {
|
|
19
20
|
this.exiting = false;
|
|
@@ -112,6 +113,15 @@ export default class NodeManager {
|
|
|
112
113
|
* with a benchmark, which would run next to the job and compete for its GPU.
|
|
113
114
|
*/
|
|
114
115
|
const liveJob = await this.node.liveJob();
|
|
116
|
+
/**
|
|
117
|
+
* drain
|
|
118
|
+
*
|
|
119
|
+
* asked to stop before the next job (see drain.ts); this is also where
|
|
120
|
+
* every job cycle starts again, so a job that runs is finished first
|
|
121
|
+
*/
|
|
122
|
+
if (!liveJob && drainRequested(this.configLocation)) {
|
|
123
|
+
return await this.shutdown();
|
|
124
|
+
}
|
|
115
125
|
/**
|
|
116
126
|
* job runtime image
|
|
117
127
|
*
|
|
@@ -310,6 +320,7 @@ export default class NodeManager {
|
|
|
310
320
|
this.operatorInput.stop();
|
|
311
321
|
this.node.exit();
|
|
312
322
|
await this.stop();
|
|
323
|
+
clearDrain(this.configLocation); // only now: whoever asked waits for this to see the node out
|
|
313
324
|
process.exit();
|
|
314
325
|
}
|
|
315
326
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* A `drain` file in the config folder asks the node to stop at the next point
|
|
6
|
+
* that costs no job: before it takes a job, never during one. It is written by
|
|
7
|
+
* whatever runs the node (the host agent); the node removes it when it stops,
|
|
8
|
+
* so a request never outlives the stop it asked for.
|
|
9
|
+
*/
|
|
10
|
+
const drainFile = (configLocation) => path.join(configLocation.replace(/^~/, os.homedir()), 'drain');
|
|
11
|
+
export function drainRequested(configLocation) {
|
|
12
|
+
return fs.existsSync(drainFile(configLocation));
|
|
13
|
+
}
|
|
14
|
+
export function clearDrain(configLocation) {
|
|
15
|
+
fs.rmSync(drainFile(configLocation), { force: true });
|
|
16
|
+
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.97-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.97-rc",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"workspaces": [
|
|
12
12
|
"packages/*"
|