@nsshunt/stsrunnerframework 1.0.156 → 1.0.157
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.
|
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _collectorCollectorPort, _runners, _options, _workerId, _archiveDeleteTimeout, _logMessage, _debug, _error, _warn, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopRunner, _TerminateRunner, _SendRunnerCommandResponse, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateRunner, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _archiveDeleteTimeout2, _logMessage2, _debug2, _error2, _warn2, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _StartRunner2, _StopRunner2, _ResetRunner2, _ExecuteRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateRunner2, _StartWorker, _StopWorker, _PauseWorker, _ResumeWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _ProcessWorkerCommands, _ExecuteVariableCommandOnRunners, _STSWorkerManager_instances, GetRunnersResponse_fn, ProcessRunnerResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _SetupCallbackMessage, _PostMessageToWorkerGetRunners;
|
|
12
|
+
var _collectorCollectorPort, _runners, _options, _workerId, _archiveDeleteTimeout, _logMessage, _debug, _error, _warn, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopRunner, _TerminateRunner, _SendRunnerCommandResponse, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateRunner, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _archiveDeleteTimeout2, _logMessage2, _debug2, _error2, _warn2, _silly, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _StartRunner2, _StopRunner2, _ResetRunner2, _ExecuteRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateRunner2, _StartWorker, _StopWorker, _PauseWorker, _ResumeWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _ProcessWorkerCommands, _ExecuteVariableCommandOnRunners, _STSWorkerManager_instances, GetRunnersResponse_fn, ProcessRunnerResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _SetupCallbackMessage, _PostMessageToWorkerGetRunners;
|
|
13
13
|
import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
|
|
14
14
|
import { Gauge } from "@nsshunt/stsobservability";
|
|
15
15
|
var eIWMessageCommands = /* @__PURE__ */ ((eIWMessageCommands2) => {
|
|
@@ -1550,7 +1550,6 @@ class WorkerInstance {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
if (removeList.length > 0) {
|
|
1552
1552
|
setTimeout(() => {
|
|
1553
|
-
__privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Removing runners from collection: [${removeList}]`));
|
|
1554
1553
|
for (let i = 0; i < removeList.length; i++) {
|
|
1555
1554
|
__privateGet(this, _runners)[removeList[i]].archived = true;
|
|
1556
1555
|
if (__privateGet(this, _archiveDeleteTimeout) !== 0) {
|
|
@@ -1561,7 +1560,6 @@ class WorkerInstance {
|
|
|
1561
1560
|
}
|
|
1562
1561
|
}
|
|
1563
1562
|
}
|
|
1564
|
-
__privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Remaining Runner Count: [${Object.keys(__privateGet(this, _runners)).length}]`));
|
|
1565
1563
|
setTimeout(__privateGet(this, _processLoopExecutor), 1e3);
|
|
1566
1564
|
}, 100);
|
|
1567
1565
|
} else {
|
|
@@ -1573,7 +1571,6 @@ class WorkerInstance {
|
|
|
1573
1571
|
}
|
|
1574
1572
|
});
|
|
1575
1573
|
__publicField(this, "GetRandomInt", (max) => {
|
|
1576
|
-
__privateGet(this, _debug).call(this, `GetRandomInt`);
|
|
1577
1574
|
return Math.floor(Math.random() * Math.floor(max));
|
|
1578
1575
|
});
|
|
1579
1576
|
__publicField(this, "PostTelemetryById", (id) => {
|
|
@@ -1581,15 +1578,12 @@ class WorkerInstance {
|
|
|
1581
1578
|
});
|
|
1582
1579
|
__privateAdd(this, _SetMessagePort, (workerMessagePort) => {
|
|
1583
1580
|
try {
|
|
1584
|
-
__privateGet(this, _debug).call(this, `SetMessagePort`);
|
|
1585
1581
|
__privateSet(this, _collectorCollectorPort, workerMessagePort.port);
|
|
1586
1582
|
if (isNode) {
|
|
1587
1583
|
__privateGet(this, _collectorCollectorPort).on("message", (data) => {
|
|
1588
|
-
__privateGet(this, _debug).call(this, `collectorCollectorPort on('message'): ${JSON.stringify(data)}`);
|
|
1589
1584
|
});
|
|
1590
1585
|
} else {
|
|
1591
1586
|
__privateGet(this, _collectorCollectorPort).addEventListener("message", (data) => {
|
|
1592
|
-
__privateGet(this, _debug).call(this, `collectorCollectorPort addEventListener('message'): ${JSON.stringify(data.data)}`);
|
|
1593
1587
|
});
|
|
1594
1588
|
}
|
|
1595
1589
|
const response = {
|
|
@@ -2022,10 +2016,8 @@ class WorkerInstance {
|
|
|
2022
2016
|
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
2023
2017
|
if (state === IRunnerState.paused || state === IRunnerState.created) {
|
|
2024
2018
|
const currentIteration = __privateGet(this, _GetRunnerIterationById).call(this, runnerId);
|
|
2025
|
-
__privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ExecuteRunner(${currentIteration})`);
|
|
2026
2019
|
result = await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.ExecuteRunner());
|
|
2027
2020
|
const newIteration = __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
|
|
2028
|
-
__privateGet(this, _debug).call(this, `${chalk.magenta(` --> runner: [${runnerId}]`)} Next iteration number: [${newIteration}] for next Execute or Resume.`);
|
|
2029
2021
|
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
|
|
2030
2022
|
}
|
|
2031
2023
|
} else {
|
|
@@ -2044,9 +2036,7 @@ class WorkerInstance {
|
|
|
2044
2036
|
if (__privateGet(this, _runners)[runnerId]) {
|
|
2045
2037
|
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
2046
2038
|
if (state === IRunnerState.paused || state === IRunnerState.created || state === IRunnerState.running) {
|
|
2047
|
-
__privateGet(this, _debug).call(this, chalk.cyan(`before: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
|
|
2048
2039
|
__privateGet(this, _SetRunnerOptionsById).call(this, runnerId, testRunnerTelemetryPayload.runner.options);
|
|
2049
|
-
__privateGet(this, _debug).call(this, chalk.cyan(`after: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
|
|
2050
2040
|
result = await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.UpdateRunner(testRunnerTelemetryPayload.runner.options));
|
|
2051
2041
|
}
|
|
2052
2042
|
} else {
|
|
@@ -2066,47 +2056,35 @@ class WorkerInstance {
|
|
|
2066
2056
|
__privateGet(this, _SetMessagePort).call(this, payloadMessage.payload);
|
|
2067
2057
|
__privateSet(this, _options, payloadMessage.payload.options);
|
|
2068
2058
|
__privateSet(this, _workerId, payloadMessage.payload.workerId);
|
|
2069
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::#workerId: [${__privateGet(this, _workerId)}]`);
|
|
2070
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::#options: [${JSON.stringify(__privateGet(this, _options))}]`);
|
|
2071
2059
|
break;
|
|
2072
2060
|
case eIWMessageCommands.AddRunner:
|
|
2073
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::AddRunner`);
|
|
2074
2061
|
__privateGet(this, _AddRunner).call(this, payloadMessage.payload);
|
|
2075
2062
|
break;
|
|
2076
2063
|
case eIWMessageCommands.StartRunner:
|
|
2077
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::StartRunner`);
|
|
2078
2064
|
__privateGet(this, _StartRunner).call(this, payloadMessage.payload);
|
|
2079
2065
|
break;
|
|
2080
2066
|
case eIWMessageCommands.StopRunner:
|
|
2081
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::StopRunner`);
|
|
2082
2067
|
__privateGet(this, _StopRunner).call(this, payloadMessage.payload);
|
|
2083
2068
|
break;
|
|
2084
2069
|
case eIWMessageCommands.TerminateRunner:
|
|
2085
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::TerminateRunner`);
|
|
2086
2070
|
__privateGet(this, _TerminateRunner).call(this, payloadMessage.payload);
|
|
2087
2071
|
break;
|
|
2088
2072
|
case eIWMessageCommands.PauseRunner:
|
|
2089
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::PauseRunner`);
|
|
2090
2073
|
__privateGet(this, _PauseRunner).call(this, payloadMessage.payload);
|
|
2091
2074
|
break;
|
|
2092
2075
|
case eIWMessageCommands.ResumeRunner:
|
|
2093
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::ResumeRunner`);
|
|
2094
2076
|
__privateGet(this, _ResumeRunner).call(this, payloadMessage.payload);
|
|
2095
2077
|
break;
|
|
2096
2078
|
case eIWMessageCommands.ResetRunner:
|
|
2097
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::ResetRunner`);
|
|
2098
2079
|
__privateGet(this, _ResetRunner).call(this, payloadMessage.payload);
|
|
2099
2080
|
break;
|
|
2100
2081
|
case eIWMessageCommands.ExecuteRunner:
|
|
2101
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::ExecuteRunner`);
|
|
2102
2082
|
__privateGet(this, _ExecuteRunner).call(this, payloadMessage.payload);
|
|
2103
2083
|
break;
|
|
2104
2084
|
case eIWMessageCommands.UpdateRunner:
|
|
2105
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::UpdateRunner`);
|
|
2106
2085
|
__privateGet(this, _UpdateRunner).call(this, payloadMessage.payload);
|
|
2107
2086
|
break;
|
|
2108
2087
|
case eIWMessageCommands.GetRunners:
|
|
2109
|
-
__privateGet(this, _debug).call(this, `ProcessMessage::GetRunners`);
|
|
2110
2088
|
__privateGet(this, _PostRunnersToWorkerManager).call(this, eIWMessageCommands.GetRunners, payloadMessage);
|
|
2111
2089
|
break;
|
|
2112
2090
|
default:
|
|
@@ -2117,7 +2095,6 @@ class WorkerInstance {
|
|
|
2117
2095
|
__privateGet(this, _error).call(this, error);
|
|
2118
2096
|
}
|
|
2119
2097
|
});
|
|
2120
|
-
__privateGet(this, _debug).call(this, `constructor`);
|
|
2121
2098
|
__privateGet(this, _processLoopExecutor).call(this);
|
|
2122
2099
|
}
|
|
2123
2100
|
get logger() {
|
|
@@ -2336,6 +2313,7 @@ class STSWorkerManager {
|
|
|
2336
2313
|
__privateAdd(this, _debug2, (message) => __privateGet(this, _logMessage2).call(this, __privateGet(this, _options2).logger.debug, message));
|
|
2337
2314
|
__privateAdd(this, _error2, (error) => __privateGet(this, _logMessage2).call(this, __privateGet(this, _options2).logger.error, error));
|
|
2338
2315
|
__privateAdd(this, _warn2, (error) => __privateGet(this, _logMessage2).call(this, __privateGet(this, _options2).logger.warn, error));
|
|
2316
|
+
__privateAdd(this, _silly, (error) => __privateGet(this, _logMessage2).call(this, __privateGet(this, _options2).logger.silly, error));
|
|
2339
2317
|
__privateAdd(this, _processLoopExecutor2, async () => {
|
|
2340
2318
|
try {
|
|
2341
2319
|
const removeList = [];
|
|
@@ -2352,25 +2330,21 @@ class STSWorkerManager {
|
|
|
2352
2330
|
}
|
|
2353
2331
|
if (removeList.length > 0) {
|
|
2354
2332
|
setTimeout(async () => {
|
|
2355
|
-
__privateGet(this, _debug2).call(this, chalk.grey(`STSWorkerManager:#processLoopExecutor(): Removing runners from collection: [${JSON.stringify(removeList)}]`));
|
|
2356
2333
|
for (let i = 0; i < removeList.length; i++) {
|
|
2357
2334
|
const workerEx = __privateGet(this, _workersEx)[removeList[i].workerId];
|
|
2358
2335
|
if (workerEx) {
|
|
2359
2336
|
const runnerEx = workerEx.runnersEx[removeList[i].runnerId];
|
|
2360
2337
|
if (runnerEx) {
|
|
2361
2338
|
if (runnerEx.publishInstrumentController) {
|
|
2362
|
-
__privateGet(this, _debug2).call(this, chalk.grey(`Ending publish for runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
|
|
2363
2339
|
runnerEx.publishInstrumentController.EndPublish();
|
|
2364
2340
|
}
|
|
2365
2341
|
if (runnerEx.state !== IRunnerState.terminated) {
|
|
2366
|
-
__privateGet(this, _debug2).call(this, chalk.grey(`Archive runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
|
|
2367
2342
|
const runner = this.CreateRunnerCopy(runnerEx);
|
|
2368
2343
|
__privateGet(this, _archiveList).push(runner);
|
|
2369
2344
|
if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
|
|
2370
2345
|
__privateGet(this, _archiveList).shift();
|
|
2371
2346
|
}
|
|
2372
2347
|
} else {
|
|
2373
|
-
__privateGet(this, _debug2).call(this, chalk.grey(`Runner has been terminated and will not be archived, runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
|
|
2374
2348
|
}
|
|
2375
2349
|
runnerEx.archived = true;
|
|
2376
2350
|
if (__privateGet(this, _archiveDeleteTimeout2) !== 0) {
|
|
@@ -2384,7 +2358,7 @@ class STSWorkerManager {
|
|
|
2384
2358
|
}
|
|
2385
2359
|
}
|
|
2386
2360
|
for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
|
|
2387
|
-
__privateGet(this,
|
|
2361
|
+
__privateGet(this, _silly).call(this, chalk.grey(`STSWorkerManager:#processLoopExecutor(): Remaining runners from worker: [${workerEx.id}]: [${Object.keys(workerEx.runnersEx).length}]`));
|
|
2388
2362
|
}
|
|
2389
2363
|
setTimeout(__privateGet(this, _processLoopExecutor2), 1e3);
|
|
2390
2364
|
}, 100);
|
|
@@ -2518,7 +2492,6 @@ class STSWorkerManager {
|
|
|
2518
2492
|
if (__privateGet(this, _STSInstrumentController)) {
|
|
2519
2493
|
__privateGet(this, _STSInstrumentController).LogEx(chalk.yellow(`pid: [${process.pid}] Creating new worker: [${stsWorkerEx.id}]`));
|
|
2520
2494
|
}
|
|
2521
|
-
__privateGet(this, _debug2).call(this, `AddWorker::workerThreadWorkerOptions: Worker ID: [${stsWorkerEx.id}] Options: [${stsWorkerEx.options}]`);
|
|
2522
2495
|
if (stsWorkerEx.options.mocked) {
|
|
2523
2496
|
stsWorkerEx.worker.SetPort({
|
|
2524
2497
|
command: eIWMessageCommands.MessagePort,
|
|
@@ -2546,11 +2519,9 @@ class STSWorkerManager {
|
|
|
2546
2519
|
if (isNode) {
|
|
2547
2520
|
stsWorkerEx.worker.on("exit", (code) => {
|
|
2548
2521
|
try {
|
|
2549
|
-
__privateGet(this, _debug2).call(this, chalk.magenta(`STSWorkerManager:stsWorkerEx.worker.on(exit): Worker exited with code: ${code}`));
|
|
2550
2522
|
__privateGet(this, _EmitWorkerEvent).call(this, "exit", stsWorkerEx);
|
|
2551
2523
|
if (__privateGet(this, _workersEx)[stsWorkerEx.id]) {
|
|
2552
2524
|
delete __privateGet(this, _workersEx)[stsWorkerEx.id];
|
|
2553
|
-
__privateGet(this, _debug2).call(this, chalk.magenta(`STSWorkerManager:stsWorkerEx.worker.on(exit): Worker: [${stsWorkerEx.id}] has been removed from the worker collection.`));
|
|
2554
2525
|
}
|
|
2555
2526
|
} catch (error) {
|
|
2556
2527
|
__privateGet(this, _error2).call(this, chalk.red(`STSWorkerManager:stsWorkerEx.worker.on(exit): Error: [${error}] Worker: [${stsWorkerEx.id}]`));
|
|
@@ -2571,7 +2542,6 @@ class STSWorkerManager {
|
|
|
2571
2542
|
__privateGet(this, _EmitWorkerEvent).call(this, "onerror", stsWorkerEx);
|
|
2572
2543
|
if (__privateGet(this, _workersEx)[stsWorkerEx.id]) {
|
|
2573
2544
|
delete __privateGet(this, _workersEx)[stsWorkerEx.id];
|
|
2574
|
-
__privateGet(this, _debug2).call(this, chalk.magenta(`STSWorkerManager:stsWorkerEx.worker.onerror(error): Worker: [${stsWorkerEx.id}] has been removed from the worker collection.`));
|
|
2575
2545
|
}
|
|
2576
2546
|
} catch (error2) {
|
|
2577
2547
|
__privateGet(this, _error2).call(this, chalk.red(`STSWorkerManager:stsWorkerEx.worker.onerror(error): Error: [${error2}] Worker: [${stsWorkerEx.id}]`));
|
|
@@ -2592,7 +2562,6 @@ class STSWorkerManager {
|
|
|
2592
2562
|
const publishMessagePayload2 = data;
|
|
2593
2563
|
switch (publishMessagePayload2.command) {
|
|
2594
2564
|
case eIWMessageCommands.MessagePortResponse:
|
|
2595
|
-
__privateGet(this, _debug2).call(this, `AddWorker:processMessage(): eIWMessageCommands.MessagePortResponse`);
|
|
2596
2565
|
break;
|
|
2597
2566
|
case eIWMessageCommands.InstrumentTelemetry:
|
|
2598
2567
|
__privateGet(this, _ProcessTelemetry).call(this, stsWorkerEx, publishMessagePayload2.payload);
|
|
@@ -2635,7 +2604,6 @@ class STSWorkerManager {
|
|
|
2635
2604
|
});
|
|
2636
2605
|
}
|
|
2637
2606
|
__privateGet(this, _workersEx)[stsWorkerEx.id] = stsWorkerEx;
|
|
2638
|
-
__privateGet(this, _debug2).call(this, `Added worker: [${stsWorkerEx.id}]`);
|
|
2639
2607
|
await Sleep(10);
|
|
2640
2608
|
const worker = await this.GetWorker(stsWorkerEx.id);
|
|
2641
2609
|
if (worker.id.localeCompare(stsWorkerEx.id) === 0) {
|
|
@@ -2657,7 +2625,6 @@ class STSWorkerManager {
|
|
|
2657
2625
|
runnerEx.publishInstrumentController.LogEx(chalk.green(`Added runner: [${runnerEx.id}] into worker: [${stsWorkerEx.id}]`));
|
|
2658
2626
|
}
|
|
2659
2627
|
if (retVal) {
|
|
2660
|
-
__privateGet(this, _debug2).call(this, chalk.green(`Added runner: [${runnerEx.id}] into worker: [${stsWorkerEx.id}] result: [${JSON.stringify(retVal)}]`));
|
|
2661
2628
|
}
|
|
2662
2629
|
return runnerEx;
|
|
2663
2630
|
} catch (error) {
|
|
@@ -2668,7 +2635,6 @@ class STSWorkerManager {
|
|
|
2668
2635
|
__privateAdd(this, _SetRunnerIntoWorker, async (workerEx, runnerEx) => {
|
|
2669
2636
|
return new Promise((resolve, reject) => {
|
|
2670
2637
|
try {
|
|
2671
|
-
__privateGet(this, _debug2).call(this, `#SetRunnerIntoWorker`);
|
|
2672
2638
|
const command = eIWMessageCommands.AddRunner;
|
|
2673
2639
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2674
2640
|
const payload = {
|
|
@@ -2677,7 +2643,7 @@ class STSWorkerManager {
|
|
|
2677
2643
|
};
|
|
2678
2644
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2679
2645
|
} catch (error) {
|
|
2680
|
-
__privateGet(this,
|
|
2646
|
+
__privateGet(this, _error2).call(this, `#PauseRunner(): Error: [${error}]`);
|
|
2681
2647
|
throw error;
|
|
2682
2648
|
}
|
|
2683
2649
|
});
|
|
@@ -2743,7 +2709,6 @@ class STSWorkerManager {
|
|
|
2743
2709
|
runner: { ...runner }
|
|
2744
2710
|
});
|
|
2745
2711
|
__privateGet(this, _SyncRunnerData).call(this, runnerEx, runner);
|
|
2746
|
-
__privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): Worker: [${workerEx.id}] Runner: [${runner.id}] Previous State: [${previousState}] State: [${runner.state}]`);
|
|
2747
2712
|
__privateGet(this, _EmitRunnerEvent).call(this, "StateChange", workerEx, runner.id);
|
|
2748
2713
|
}
|
|
2749
2714
|
} catch (error) {
|
|
@@ -2822,22 +2787,18 @@ class STSWorkerManager {
|
|
|
2822
2787
|
__privateAdd(this, _PostMessageToWorkerUsingDefaultChannel, (workerEx, command, payload, transferObject) => {
|
|
2823
2788
|
try {
|
|
2824
2789
|
if (transferObject) {
|
|
2825
|
-
__privateGet(this, _debug2).call(this, `#PostMessageToWorker with transfer object`);
|
|
2826
2790
|
workerEx.worker.postMessage({ command, payload }, [transferObject]);
|
|
2827
|
-
__privateGet(this, _debug2).call(this, `#PostMessageToWorker with transfer object - done...`);
|
|
2828
2791
|
} else {
|
|
2829
|
-
__privateGet(this, _debug2).call(this, `#PostMessageToWorker`);
|
|
2830
2792
|
workerEx.worker.postMessage({ command, payload });
|
|
2831
2793
|
}
|
|
2832
2794
|
} catch (error) {
|
|
2833
|
-
__privateGet(this,
|
|
2795
|
+
__privateGet(this, _error2).call(this, `PostMessageToWorkerUsingDefaultChannel(): Error: [${error}]`);
|
|
2834
2796
|
throw error;
|
|
2835
2797
|
}
|
|
2836
2798
|
});
|
|
2837
2799
|
__privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
|
|
2838
2800
|
return new Promise((resolve, reject) => {
|
|
2839
2801
|
try {
|
|
2840
|
-
__privateGet(this, _debug2).call(this, `#StartRunner`);
|
|
2841
2802
|
const command = eIWMessageCommands.StartRunner;
|
|
2842
2803
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2843
2804
|
const payload = {
|
|
@@ -2846,7 +2807,7 @@ class STSWorkerManager {
|
|
|
2846
2807
|
};
|
|
2847
2808
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2848
2809
|
} catch (error) {
|
|
2849
|
-
__privateGet(this,
|
|
2810
|
+
__privateGet(this, _error2).call(this, `#StartRunner(): Error: [${error}]`);
|
|
2850
2811
|
throw error;
|
|
2851
2812
|
}
|
|
2852
2813
|
});
|
|
@@ -2854,7 +2815,6 @@ class STSWorkerManager {
|
|
|
2854
2815
|
__privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
|
|
2855
2816
|
return new Promise((resolve, reject) => {
|
|
2856
2817
|
try {
|
|
2857
|
-
__privateGet(this, _debug2).call(this, `#StopRunner`);
|
|
2858
2818
|
const command = eIWMessageCommands.StopRunner;
|
|
2859
2819
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2860
2820
|
const payload = {
|
|
@@ -2863,7 +2823,7 @@ class STSWorkerManager {
|
|
|
2863
2823
|
};
|
|
2864
2824
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2865
2825
|
} catch (error) {
|
|
2866
|
-
__privateGet(this,
|
|
2826
|
+
__privateGet(this, _error2).call(this, `#StopRunner(): Error: [${error}]`);
|
|
2867
2827
|
throw error;
|
|
2868
2828
|
}
|
|
2869
2829
|
});
|
|
@@ -2871,7 +2831,6 @@ class STSWorkerManager {
|
|
|
2871
2831
|
__privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
|
|
2872
2832
|
return new Promise((resolve, reject) => {
|
|
2873
2833
|
try {
|
|
2874
|
-
__privateGet(this, _debug2).call(this, `#ResetRunner`);
|
|
2875
2834
|
const command = eIWMessageCommands.ResetRunner;
|
|
2876
2835
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2877
2836
|
const payload = {
|
|
@@ -2880,7 +2839,7 @@ class STSWorkerManager {
|
|
|
2880
2839
|
};
|
|
2881
2840
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2882
2841
|
} catch (error) {
|
|
2883
|
-
__privateGet(this,
|
|
2842
|
+
__privateGet(this, _error2).call(this, `#ResetRunner(): Error: [${error}]`);
|
|
2884
2843
|
throw error;
|
|
2885
2844
|
}
|
|
2886
2845
|
});
|
|
@@ -2888,7 +2847,6 @@ class STSWorkerManager {
|
|
|
2888
2847
|
__privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
|
|
2889
2848
|
return new Promise((resolve, reject) => {
|
|
2890
2849
|
try {
|
|
2891
|
-
__privateGet(this, _debug2).call(this, `#ExecuteRunner`);
|
|
2892
2850
|
const command = eIWMessageCommands.ExecuteRunner;
|
|
2893
2851
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2894
2852
|
const payload = {
|
|
@@ -2897,7 +2855,7 @@ class STSWorkerManager {
|
|
|
2897
2855
|
};
|
|
2898
2856
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2899
2857
|
} catch (error) {
|
|
2900
|
-
__privateGet(this,
|
|
2858
|
+
__privateGet(this, _error2).call(this, `#ExecuteRunner(): Error: [${error}]`);
|
|
2901
2859
|
throw error;
|
|
2902
2860
|
}
|
|
2903
2861
|
});
|
|
@@ -2905,7 +2863,6 @@ class STSWorkerManager {
|
|
|
2905
2863
|
__privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
|
|
2906
2864
|
return new Promise((resolve, reject) => {
|
|
2907
2865
|
try {
|
|
2908
|
-
__privateGet(this, _debug2).call(this, `#TerminateRunner`);
|
|
2909
2866
|
const command = eIWMessageCommands.TerminateRunner;
|
|
2910
2867
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2911
2868
|
const payload = {
|
|
@@ -2914,7 +2871,7 @@ class STSWorkerManager {
|
|
|
2914
2871
|
};
|
|
2915
2872
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2916
2873
|
} catch (error) {
|
|
2917
|
-
__privateGet(this,
|
|
2874
|
+
__privateGet(this, _error2).call(this, `#PauseRunner(): Error: [${error}]`);
|
|
2918
2875
|
throw error;
|
|
2919
2876
|
}
|
|
2920
2877
|
});
|
|
@@ -2922,7 +2879,6 @@ class STSWorkerManager {
|
|
|
2922
2879
|
__privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
|
|
2923
2880
|
return new Promise((resolve, reject) => {
|
|
2924
2881
|
try {
|
|
2925
|
-
__privateGet(this, _debug2).call(this, `#PauseRunner`);
|
|
2926
2882
|
const command = eIWMessageCommands.PauseRunner;
|
|
2927
2883
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2928
2884
|
const payload = {
|
|
@@ -2931,7 +2887,7 @@ class STSWorkerManager {
|
|
|
2931
2887
|
};
|
|
2932
2888
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2933
2889
|
} catch (error) {
|
|
2934
|
-
__privateGet(this,
|
|
2890
|
+
__privateGet(this, _error2).call(this, `#PauseRunner(): Error: [${error}]`);
|
|
2935
2891
|
throw error;
|
|
2936
2892
|
}
|
|
2937
2893
|
});
|
|
@@ -2939,7 +2895,6 @@ class STSWorkerManager {
|
|
|
2939
2895
|
__privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
|
|
2940
2896
|
return new Promise((resolve, reject) => {
|
|
2941
2897
|
try {
|
|
2942
|
-
__privateGet(this, _debug2).call(this, `#ResumeRunner`);
|
|
2943
2898
|
const command = eIWMessageCommands.ResumeRunner;
|
|
2944
2899
|
const messageId = __privateGet(this, _SetupCallbackMessage).call(this, resolve, reject, command);
|
|
2945
2900
|
const payload = {
|
|
@@ -2948,7 +2903,7 @@ class STSWorkerManager {
|
|
|
2948
2903
|
};
|
|
2949
2904
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2950
2905
|
} catch (error) {
|
|
2951
|
-
__privateGet(this,
|
|
2906
|
+
__privateGet(this, _error2).call(this, `ResumeRunner(): Error: [${error}]`);
|
|
2952
2907
|
throw error;
|
|
2953
2908
|
}
|
|
2954
2909
|
});
|
|
@@ -2956,7 +2911,6 @@ class STSWorkerManager {
|
|
|
2956
2911
|
__privateAdd(this, _UpdateRunner2, async (workerEx, runnerEx, runnerOptions) => {
|
|
2957
2912
|
return new Promise((resolve, reject) => {
|
|
2958
2913
|
try {
|
|
2959
|
-
__privateGet(this, _debug2).call(this, `#UpdateRunner`);
|
|
2960
2914
|
if (runnerOptions.description) {
|
|
2961
2915
|
runnerEx.options.description = runnerOptions.description;
|
|
2962
2916
|
}
|
|
@@ -2980,7 +2934,7 @@ class STSWorkerManager {
|
|
|
2980
2934
|
};
|
|
2981
2935
|
workerEx.messagePort.postMessage({ command, payload });
|
|
2982
2936
|
} catch (error) {
|
|
2983
|
-
__privateGet(this,
|
|
2937
|
+
__privateGet(this, _error2).call(this, `UpdateRunner(): Error: [${error}]`);
|
|
2984
2938
|
throw error;
|
|
2985
2939
|
}
|
|
2986
2940
|
});
|
|
@@ -3053,16 +3007,14 @@ class STSWorkerManager {
|
|
|
3053
3007
|
if (workerEx.worker) {
|
|
3054
3008
|
setTimeout(() => {
|
|
3055
3009
|
workerEx.worker.terminate();
|
|
3056
|
-
__privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
|
|
3057
3010
|
if (__privateGet(this, _workersEx)[workerEx.id]) {
|
|
3058
3011
|
delete __privateGet(this, _workersEx)[workerEx.id];
|
|
3059
|
-
__privateGet(this, _debug2).call(this, chalk.magenta(`STSWorkerManager:stsWorkerEx.worker.on(exit): Worker: [${workerEx.id}] has been removed from the worker collection.`));
|
|
3060
3012
|
}
|
|
3061
3013
|
}, 500);
|
|
3062
3014
|
}
|
|
3063
3015
|
return retVal;
|
|
3064
3016
|
} catch (error) {
|
|
3065
|
-
__privateGet(this,
|
|
3017
|
+
__privateGet(this, _error2).call(this, `TerminateWorker(): Error: [${error}]`);
|
|
3066
3018
|
return [];
|
|
3067
3019
|
}
|
|
3068
3020
|
});
|
|
@@ -3272,7 +3224,6 @@ class STSWorkerManager {
|
|
|
3272
3224
|
__privateAdd(this, _PostMessageToWorkerGetRunners, async (workerEx, command) => {
|
|
3273
3225
|
return new Promise((resolve, reject) => {
|
|
3274
3226
|
try {
|
|
3275
|
-
__privateGet(this, _debug2).call(this, `#PostMessageToWorkerGetRunners`);
|
|
3276
3227
|
const messageId = v4();
|
|
3277
3228
|
__privateGet(this, _messages)[messageId] = {
|
|
3278
3229
|
timeout: setTimeout(() => {
|
|
@@ -3409,6 +3360,7 @@ _logMessage2 = new WeakMap();
|
|
|
3409
3360
|
_debug2 = new WeakMap();
|
|
3410
3361
|
_error2 = new WeakMap();
|
|
3411
3362
|
_warn2 = new WeakMap();
|
|
3363
|
+
_silly = new WeakMap();
|
|
3412
3364
|
_processLoopExecutor2 = new WeakMap();
|
|
3413
3365
|
_SetRunnerIntoWorker = new WeakMap();
|
|
3414
3366
|
_ProcessTelemetry = new WeakMap();
|