@nosana/node 1.1.38 → 1.1.39-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 +2 -2
- package/dist/src/NodeManager/node/task/TaskManager.js +10 -7
- package/dist/src/NodeManager/node/task/executions/createDependencyMap.d.ts +10 -0
- package/dist/src/NodeManager/node/task/executions/createDependencyMap.js +24 -10
- package/npm-shrinkwrap.json +6 -6
- package/package.json +3 -3
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39-rc",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nosana-node": "./dist/src/index.js"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@coral-xyz/anchor": "^0.28.1-beta.1",
|
|
74
74
|
"@inquirer/prompts": "^4.3.0",
|
|
75
75
|
"@nosana/ipfs": "^2.2.6",
|
|
76
|
-
"@nosana/sdk": "^0.4.
|
|
76
|
+
"@nosana/sdk": "^0.4.87",
|
|
77
77
|
"@solana/web3.js": "^1.78.0",
|
|
78
78
|
"bn.js": "^5.2.1",
|
|
79
79
|
"chalk": "^5.3.0",
|
|
@@ -449,14 +449,17 @@ export default class TaskManager {
|
|
|
449
449
|
this.currentGroupOperationsPromises.set(opId, promise);
|
|
450
450
|
promise.finally(() => {
|
|
451
451
|
this.currentGroupOperationsPromises.delete(opId);
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
452
|
+
// Read from the dependency map rather than the op's own `depends_on`, so
|
|
453
|
+
// the pair can be declared from either side: the server naming what it
|
|
454
|
+
// serves, or those operations naming the server they wait for. Both
|
|
455
|
+
// produce the same dependents, and only that direction says whose ending
|
|
456
|
+
// stops the server.
|
|
457
|
+
for (const [candidateId, { execution }] of this.opMap) {
|
|
458
|
+
if (!this.currentGroup || !execution?.stop_if_dependent_stops)
|
|
457
459
|
continue;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
+
const dependents = this.dependecyMap.get(candidateId)?.dependents ?? [];
|
|
461
|
+
if (dependents.includes(opId)) {
|
|
462
|
+
this.stopTaskManagerOperation(this.currentGroup, candidateId);
|
|
460
463
|
}
|
|
461
464
|
}
|
|
462
465
|
});
|
|
@@ -11,6 +11,16 @@ import TaskManager from '../TaskManager.js';
|
|
|
11
11
|
* - Dynamically trigger downstream ops when upstream completes
|
|
12
12
|
* - Track dependencies and dependents efficiently during execution
|
|
13
13
|
* - Use alongside the execution plan to resolve execution flow
|
|
14
|
+
*
|
|
15
|
+
* `depends_on` is read in one of two directions. On an op that also sets
|
|
16
|
+
* `stop_if_dependent_stops` it names the ops that op serves: a server is stopped
|
|
17
|
+
* once they finish, so it has to be running before they start. Everywhere else
|
|
18
|
+
* it names what the op waits for.
|
|
19
|
+
*
|
|
20
|
+
* The direction matters because a client reaches its server by hostname, and
|
|
21
|
+
* that name exists only once the server's container does — after the server has
|
|
22
|
+
* pulled its image and fetched its resources. Starting the client first puts all
|
|
23
|
+
* of that inside the client's own wait.
|
|
14
24
|
*/
|
|
15
25
|
export declare function createDependencyMap(this: TaskManager): Map<string, {
|
|
16
26
|
dependencies: string[];
|
|
@@ -10,22 +10,36 @@
|
|
|
10
10
|
* - Dynamically trigger downstream ops when upstream completes
|
|
11
11
|
* - Track dependencies and dependents efficiently during execution
|
|
12
12
|
* - Use alongside the execution plan to resolve execution flow
|
|
13
|
+
*
|
|
14
|
+
* `depends_on` is read in one of two directions. On an op that also sets
|
|
15
|
+
* `stop_if_dependent_stops` it names the ops that op serves: a server is stopped
|
|
16
|
+
* once they finish, so it has to be running before they start. Everywhere else
|
|
17
|
+
* it names what the op waits for.
|
|
18
|
+
*
|
|
19
|
+
* The direction matters because a client reaches its server by hostname, and
|
|
20
|
+
* that name exists only once the server's container does — after the server has
|
|
21
|
+
* pulled its image and fetched its resources. Starting the client first puts all
|
|
22
|
+
* of that inside the client's own wait.
|
|
13
23
|
*/
|
|
14
24
|
export function createDependencyMap() {
|
|
15
25
|
const map = new Map();
|
|
16
|
-
// Initialize map with declared dependencies
|
|
17
26
|
for (const op of this.operations) {
|
|
18
|
-
map.set(op.id, {
|
|
19
|
-
dependencies: op.execution?.depends_on ?? [],
|
|
20
|
-
dependents: [],
|
|
21
|
-
});
|
|
27
|
+
map.set(op.id, { dependencies: [], dependents: [] });
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
for (const op of this.operations) {
|
|
30
|
+
const declared = op.execution?.depends_on ?? [];
|
|
31
|
+
const serves = op.execution?.stop_if_dependent_stops === true;
|
|
32
|
+
for (const otherId of declared) {
|
|
33
|
+
if (!map.has(otherId))
|
|
27
34
|
continue;
|
|
28
|
-
|
|
35
|
+
if (serves) {
|
|
36
|
+
map.get(op.id).dependents.push(otherId);
|
|
37
|
+
map.get(otherId).dependencies.push(op.id);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
map.get(op.id).dependencies.push(otherId);
|
|
41
|
+
map.get(otherId).dependents.push(op.id);
|
|
42
|
+
}
|
|
29
43
|
}
|
|
30
44
|
}
|
|
31
45
|
return map;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39-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.39-rc",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@coral-xyz/anchor": "^0.28.1-beta.1",
|
|
13
13
|
"@inquirer/prompts": "^4.3.0",
|
|
14
14
|
"@nosana/ipfs": "^2.2.6",
|
|
15
|
-
"@nosana/sdk": "^0.4.
|
|
15
|
+
"@nosana/sdk": "^0.4.87",
|
|
16
16
|
"@solana/web3.js": "^1.78.0",
|
|
17
17
|
"bn.js": "^5.2.1",
|
|
18
18
|
"chalk": "^5.3.0",
|
|
@@ -1609,9 +1609,9 @@
|
|
|
1609
1609
|
}
|
|
1610
1610
|
},
|
|
1611
1611
|
"node_modules/@nosana/sdk": {
|
|
1612
|
-
"version": "0.4.
|
|
1613
|
-
"resolved": "https://registry.npmjs.org/@nosana/sdk/-/sdk-0.4.
|
|
1614
|
-
"integrity": "sha512-
|
|
1612
|
+
"version": "0.4.87",
|
|
1613
|
+
"resolved": "https://registry.npmjs.org/@nosana/sdk/-/sdk-0.4.87.tgz",
|
|
1614
|
+
"integrity": "sha512-PwZQ3trTl4vRW176mq2+gvYIeAEVwfrFYctmjjVz6fwYWRM8dnqDI/5I/q2NcICR3ZVln/+nOK10FAl49UTVdA==",
|
|
1615
1615
|
"license": "ISC",
|
|
1616
1616
|
"dependencies": {
|
|
1617
1617
|
"@coral-xyz/anchor": "^0.28.1-beta.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosana/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39-rc",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nosana-node": "./dist/src/index.js"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@coral-xyz/anchor": "^0.28.1-beta.1",
|
|
74
74
|
"@inquirer/prompts": "^4.3.0",
|
|
75
75
|
"@nosana/ipfs": "^2.2.6",
|
|
76
|
-
"@nosana/sdk": "^0.4.
|
|
76
|
+
"@nosana/sdk": "^0.4.87",
|
|
77
77
|
"@solana/web3.js": "^1.78.0",
|
|
78
78
|
"bn.js": "^5.2.1",
|
|
79
79
|
"chalk": "^5.3.0",
|
|
@@ -105,4 +105,4 @@
|
|
|
105
105
|
"util": "^0.12.5",
|
|
106
106
|
"yaml": "^2.8.0"
|
|
107
107
|
}
|
|
108
|
-
}
|
|
108
|
+
}
|