@scrypted/server 0.123.32 → 0.123.33
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/plugin/plugin-host.d.ts +1 -1
- package/dist/plugin/plugin-host.js +11 -10
- package/dist/plugin/plugin-host.js.map +1 -1
- package/dist/plugin/plugin-remote-worker.js +10 -9
- package/dist/plugin/plugin-remote-worker.js.map +1 -1
- package/dist/plugin/runtime/child-process-worker.d.ts +1 -1
- package/dist/plugin/runtime/child-process-worker.js +2 -2
- package/dist/plugin/runtime/child-process-worker.js.map +1 -1
- package/dist/plugin/runtime/cluster-fork-worker.d.ts +2 -2
- package/dist/plugin/runtime/cluster-fork-worker.js +7 -3
- package/dist/plugin/runtime/cluster-fork-worker.js.map +1 -1
- package/dist/plugin/runtime/custom-worker.d.ts +1 -1
- package/dist/plugin/runtime/custom-worker.js +3 -3
- package/dist/plugin/runtime/custom-worker.js.map +1 -1
- package/dist/plugin/runtime/node-fork-worker.d.ts +1 -1
- package/dist/plugin/runtime/node-fork-worker.js +2 -2
- package/dist/plugin/runtime/node-fork-worker.js.map +1 -1
- package/dist/plugin/runtime/python-worker.d.ts +1 -1
- package/dist/plugin/runtime/python-worker.js +3 -3
- package/dist/plugin/runtime/python-worker.js.map +1 -1
- package/dist/plugin/runtime/runtime-host.d.ts +1 -1
- package/dist/plugin/runtime/runtime-host.js +3 -3
- package/dist/plugin/runtime/runtime-host.js.map +1 -1
- package/dist/scrypted-cluster-main.d.ts +2 -1
- package/dist/scrypted-cluster-main.js +12 -14
- package/dist/scrypted-cluster-main.js.map +1 -1
- package/dist/scrypted-server-main.js +1 -0
- package/dist/scrypted-server-main.js.map +1 -1
- package/dist/services/cluster-fork.d.ts +2 -1
- package/dist/services/cluster-fork.js +4 -3
- package/dist/services/cluster-fork.js.map +1 -1
- package/package.json +2 -2
- package/python/plugin_remote.py +15 -2
- package/src/plugin/plugin-host.ts +25 -21
- package/src/plugin/plugin-remote-worker.ts +16 -10
- package/src/plugin/runtime/child-process-worker.ts +3 -1
- package/src/plugin/runtime/cluster-fork-worker.ts +15 -9
- package/src/plugin/runtime/custom-worker.ts +3 -3
- package/src/plugin/runtime/node-fork-worker.ts +2 -2
- package/src/plugin/runtime/python-worker.ts +3 -3
- package/src/plugin/runtime/runtime-host.ts +4 -4
- package/src/scrypted-cluster-main.ts +16 -21
- package/src/scrypted-server-main.ts +1 -0
- package/src/services/cluster-fork.ts +6 -4
@@ -100,6 +100,7 @@ app.use(bodyParser.raw({ type: 'application/*', limit: 100000000 }) as any)
|
|
100
100
|
async function start(mainFilename: string, options?: {
|
101
101
|
onRuntimeCreated?: (runtime: ScryptedRuntime) => Promise<void>,
|
102
102
|
}) {
|
103
|
+
console.log('Cluster server starting.');
|
103
104
|
const volumeDir = getScryptedVolume();
|
104
105
|
await fs.promises.mkdir(volumeDir, {
|
105
106
|
recursive: true
|
@@ -1,11 +1,13 @@
|
|
1
|
+
import { ClusterWorker } from "@scrypted/types";
|
1
2
|
import { matchesClusterLabels } from "../cluster/cluster-labels";
|
2
3
|
import type { ScryptedRuntime } from "../runtime";
|
3
4
|
import type { ClusterForkOptions, ClusterForkParam, PeerLiveness, RunningClusterWorker } from "../scrypted-cluster-main";
|
5
|
+
import type { RuntimeWorkerOptions } from "../plugin/runtime/runtime-worker";
|
4
6
|
|
5
7
|
export class ClusterForkService {
|
6
8
|
constructor(public runtime: ScryptedRuntime) { }
|
7
9
|
|
8
|
-
async fork(
|
10
|
+
async fork(runtimeWorkerOptions: RuntimeWorkerOptions, options: ClusterForkOptions, peerLiveness: PeerLiveness, getZip: () => Promise<Buffer>) {
|
9
11
|
const matchingWorkers = [...this.runtime.clusterWorkers.entries()].map(([id, worker]) => ({
|
10
12
|
worker,
|
11
13
|
matches: matchesClusterLabels(options, worker.labels),
|
@@ -34,8 +36,8 @@ export class ClusterForkService {
|
|
34
36
|
}
|
35
37
|
|
36
38
|
const fork: ClusterForkParam = await worker.peer.getParam('fork');
|
37
|
-
const forkResult = await fork(
|
38
|
-
options.id ||= this.runtime.findPluginDevice(packageJson.name)?._id;
|
39
|
+
const forkResult = await fork(options.runtime, runtimeWorkerOptions, peerLiveness, getZip);
|
40
|
+
options.id ||= this.runtime.findPluginDevice(runtimeWorkerOptions.packageJson.name)?._id;
|
39
41
|
worker.forks.add(options);
|
40
42
|
forkResult.waitKilled().catch(() => { }).finally(() => {
|
41
43
|
worker.forks.delete(options);
|
@@ -43,7 +45,7 @@ export class ClusterForkService {
|
|
43
45
|
|
44
46
|
forkResult.clusterWorkerId = worker.id;
|
45
47
|
return forkResult;
|
46
|
-
}
|
48
|
+
};
|
47
49
|
|
48
50
|
async getClusterWorkers() {
|
49
51
|
const ret: any = {};
|