@nsshunt/stsrunnerframework 1.0.77 → 1.0.79
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/stsrunnerframework.mjs +67 -97
- package/dist/stsrunnerframework.mjs.map +1 -1
- package/dist/stsrunnerframework.umd.js +67 -97
- package/dist/stsrunnerframework.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/commonTypes.d.ts +19 -8
- package/types/commonTypes.d.ts.map +1 -1
- package/types/workerManager.d.ts +10 -9
- package/types/workerManager.d.ts.map +1 -1
|
@@ -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, _debug, _error, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2,
|
|
12
|
+
var _collectorCollectorPort, _runners, _options, _workerId, _debug, _error, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateOptionsRunner, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _BroadcastCommandToAllRunners, _TerminateWorker, _HandleAllWorkers;
|
|
13
13
|
import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
|
|
14
14
|
import { Gauge } from "@nsshunt/stsobservability";
|
|
15
15
|
const URI_BASE_VUEUTILS = "/";
|
|
@@ -2105,7 +2105,7 @@ class STSWorkerManager {
|
|
|
2105
2105
|
TerminateRunner: (runner) => __privateGet(this, _TerminateRunner2).call(this, stsWorkerEx, runner),
|
|
2106
2106
|
ResetRunner: (runner) => __privateGet(this, _ResetRunner2).call(this, stsWorkerEx, runner),
|
|
2107
2107
|
ExecuteRunner: (runner) => __privateGet(this, _ExecuteRunner2).call(this, stsWorkerEx, runner),
|
|
2108
|
-
UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this,
|
|
2108
|
+
UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, stsWorkerEx, runner, executionProfile),
|
|
2109
2109
|
// Commands to execute on all runners
|
|
2110
2110
|
Start: async () => __privateGet(this, _StartWorker).call(this, stsWorkerEx),
|
|
2111
2111
|
Stop: async () => __privateGet(this, _StopWorker).call(this, stsWorkerEx),
|
|
@@ -2318,7 +2318,7 @@ class STSWorkerManager {
|
|
|
2318
2318
|
Reset: async () => __privateGet(this, _ResetRunner2).call(this, workerEx, runnerEx),
|
|
2319
2319
|
Execute: async () => __privateGet(this, _ExecuteRunner2).call(this, workerEx, runnerEx),
|
|
2320
2320
|
Terminate: async () => __privateGet(this, _TerminateRunner2).call(this, workerEx, runnerEx),
|
|
2321
|
-
UpdateOptions: async (executionProfile) => __privateGet(this,
|
|
2321
|
+
UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, workerEx, runnerEx, executionProfile),
|
|
2322
2322
|
on: (eventName, cb) => {
|
|
2323
2323
|
if (!workerEx.runnersEvents[runnerEx.id]) {
|
|
2324
2324
|
workerEx.runnersEvents[runnerEx.id] = [];
|
|
@@ -2388,24 +2388,12 @@ class STSWorkerManager {
|
|
|
2388
2388
|
});
|
|
2389
2389
|
return true;
|
|
2390
2390
|
});
|
|
2391
|
-
__privateAdd(this,
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
if (options) {
|
|
2398
|
-
promArray.push(command(workerEx, runnerEx, options));
|
|
2399
|
-
} else {
|
|
2400
|
-
promArray.push(command(workerEx, runnerEx));
|
|
2401
|
-
}
|
|
2402
|
-
});
|
|
2403
|
-
await Promise.all(promArray);
|
|
2404
|
-
return true;
|
|
2405
|
-
} catch (error) {
|
|
2406
|
-
console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
2407
|
-
return false;
|
|
2408
|
-
}
|
|
2391
|
+
__privateAdd(this, _UpdateOptionsRunner, async (workerEx, runnerEx, executionProfile) => {
|
|
2392
|
+
runnerEx.options.executionProfile = { ...executionProfile };
|
|
2393
|
+
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
|
|
2394
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2395
|
+
});
|
|
2396
|
+
return true;
|
|
2409
2397
|
});
|
|
2410
2398
|
__privateAdd(this, _PauseWorker, async (workerEx) => {
|
|
2411
2399
|
return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _PauseRunner2));
|
|
@@ -2425,51 +2413,43 @@ class STSWorkerManager {
|
|
|
2425
2413
|
__privateAdd(this, _ExecuteWorker, async (workerEx) => {
|
|
2426
2414
|
return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ExecuteRunner2));
|
|
2427
2415
|
});
|
|
2428
|
-
|
|
2416
|
+
// IExecutionProfile
|
|
2417
|
+
__privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
|
|
2418
|
+
return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptionsRunner), executionProfile);
|
|
2419
|
+
});
|
|
2420
|
+
__privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, executionProfile) => {
|
|
2429
2421
|
try {
|
|
2430
|
-
const
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
await Promise.all(
|
|
2441
|
-
return true;
|
|
2422
|
+
const executeCommand = async (runnerEx) => {
|
|
2423
|
+
const result = executionProfile ? await command(workerEx, runnerEx, executionProfile) : await command(workerEx, runnerEx);
|
|
2424
|
+
return {
|
|
2425
|
+
workerManagerId: __privateGet(this, _id),
|
|
2426
|
+
workerId: workerEx.id,
|
|
2427
|
+
runnerId: runnerEx.id,
|
|
2428
|
+
result
|
|
2429
|
+
};
|
|
2430
|
+
};
|
|
2431
|
+
const promises = Object.values(workerEx.runnersEx).map((runnerEx) => executeCommand(runnerEx));
|
|
2432
|
+
return await Promise.all(promises);
|
|
2442
2433
|
} catch (error) {
|
|
2443
|
-
console.
|
|
2444
|
-
return
|
|
2434
|
+
console.error(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
2435
|
+
return [];
|
|
2445
2436
|
}
|
|
2446
2437
|
});
|
|
2447
|
-
// IExecutionProfile
|
|
2448
|
-
__privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
|
|
2449
|
-
return __privateGet(this, _BroadcastUpdateCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptions2), executionProfile);
|
|
2450
|
-
});
|
|
2451
2438
|
__privateAdd(this, _TerminateWorker, async (workerEx) => {
|
|
2452
2439
|
try {
|
|
2453
|
-
await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
|
|
2440
|
+
const retVal = await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
|
|
2454
2441
|
if (workerEx.worker) {
|
|
2455
2442
|
workerEx.worker.terminate();
|
|
2456
2443
|
__privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
|
|
2457
2444
|
delete __privateGet(this, _workersEx)[workerEx.id];
|
|
2458
2445
|
} else {
|
|
2459
2446
|
}
|
|
2460
|
-
return
|
|
2447
|
+
return retVal;
|
|
2461
2448
|
} catch (error) {
|
|
2462
2449
|
console.log(`Error in STSTestWorker:TerminateWorker: [${error}]`);
|
|
2463
|
-
return
|
|
2450
|
+
return [];
|
|
2464
2451
|
}
|
|
2465
2452
|
});
|
|
2466
|
-
__privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
|
|
2467
|
-
runnerEx.options.executionProfile = { ...executionProfile };
|
|
2468
|
-
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
|
|
2469
|
-
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2470
|
-
});
|
|
2471
|
-
return true;
|
|
2472
|
-
});
|
|
2473
2453
|
__publicField(this, "GetNextAvailableWorker", () => {
|
|
2474
2454
|
let leastRunnerWorker = null;
|
|
2475
2455
|
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
@@ -2496,61 +2476,48 @@ class STSWorkerManager {
|
|
|
2496
2476
|
}
|
|
2497
2477
|
return busyWorker;
|
|
2498
2478
|
});
|
|
2479
|
+
// IExecuteRunnerActionResult[]
|
|
2480
|
+
__privateAdd(this, _HandleAllWorkers, async (action, options) => {
|
|
2481
|
+
const promises = Object.values(this.WorkersEx).map(async (worker) => {
|
|
2482
|
+
if (action === "UpdateOptions") {
|
|
2483
|
+
return {
|
|
2484
|
+
workerManagerId: __privateGet(this, _id),
|
|
2485
|
+
workerId: worker.id,
|
|
2486
|
+
executeRunnerActionResults: await worker[action](options)
|
|
2487
|
+
};
|
|
2488
|
+
} else {
|
|
2489
|
+
return {
|
|
2490
|
+
workerManagerId: __privateGet(this, _id),
|
|
2491
|
+
workerId: worker.id,
|
|
2492
|
+
executeRunnerActionResults: await worker[action]()
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
});
|
|
2496
|
+
return Promise.all(promises);
|
|
2497
|
+
});
|
|
2499
2498
|
__publicField(this, "StartAllWorkers", async () => {
|
|
2500
|
-
|
|
2501
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2502
|
-
promArray.push(stsWorker.Start());
|
|
2503
|
-
}
|
|
2504
|
-
return await Promise.all(promArray);
|
|
2499
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Start");
|
|
2505
2500
|
});
|
|
2506
|
-
__publicField(this, "StopAllWorkers",
|
|
2507
|
-
|
|
2508
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2509
|
-
promArray.push(stsWorker.Stop());
|
|
2510
|
-
}
|
|
2511
|
-
return await Promise.all(promArray);
|
|
2501
|
+
__publicField(this, "StopAllWorkers", () => {
|
|
2502
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Stop");
|
|
2512
2503
|
});
|
|
2513
|
-
__publicField(this, "PauseAllWorkers",
|
|
2514
|
-
|
|
2515
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2516
|
-
promArray.push(stsWorker.Pause());
|
|
2517
|
-
}
|
|
2518
|
-
return await Promise.all(promArray);
|
|
2504
|
+
__publicField(this, "PauseAllWorkers", () => {
|
|
2505
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Pause");
|
|
2519
2506
|
});
|
|
2520
2507
|
__publicField(this, "ResumeAllWorkers", async () => {
|
|
2521
|
-
|
|
2522
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2523
|
-
promArray.push(stsWorker.Resume());
|
|
2524
|
-
}
|
|
2525
|
-
return await Promise.all(promArray);
|
|
2508
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Resume");
|
|
2526
2509
|
});
|
|
2527
2510
|
__publicField(this, "ExecuteAllWorkers", async () => {
|
|
2528
|
-
|
|
2529
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2530
|
-
promArray.push(stsWorker.Execute());
|
|
2531
|
-
}
|
|
2532
|
-
return await Promise.all(promArray);
|
|
2511
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Execute");
|
|
2533
2512
|
});
|
|
2534
2513
|
__publicField(this, "ResetAllWorkers", async () => {
|
|
2535
|
-
|
|
2536
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2537
|
-
promArray.push(stsWorker.Reset());
|
|
2538
|
-
}
|
|
2539
|
-
return await Promise.all(promArray);
|
|
2540
|
-
});
|
|
2541
|
-
__publicField(this, "UpdateAllWorkers", async (options) => {
|
|
2542
|
-
const promArray = [];
|
|
2543
|
-
for (const [, stsWorker] of Object.entries(this.WorkersEx)) {
|
|
2544
|
-
promArray.push(stsWorker.UpdateOptions(options));
|
|
2545
|
-
}
|
|
2546
|
-
return await Promise.all(promArray);
|
|
2514
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Reset");
|
|
2547
2515
|
});
|
|
2548
2516
|
__publicField(this, "TerminateAllWorkers", async () => {
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
return await Promise.all(promArray);
|
|
2517
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "Terminate");
|
|
2518
|
+
});
|
|
2519
|
+
__publicField(this, "UpdateAllWorkers", async (options) => {
|
|
2520
|
+
return __privateGet(this, _HandleAllWorkers).call(this, "UpdateOptions", options);
|
|
2554
2521
|
});
|
|
2555
2522
|
__privateSet(this, _id, v4());
|
|
2556
2523
|
if (options) {
|
|
@@ -2596,6 +2563,9 @@ class STSWorkerManager {
|
|
|
2596
2563
|
}
|
|
2597
2564
|
return workerCopy;
|
|
2598
2565
|
}
|
|
2566
|
+
get id() {
|
|
2567
|
+
return __privateGet(this, _id);
|
|
2568
|
+
}
|
|
2599
2569
|
get Workers() {
|
|
2600
2570
|
const retVal = {};
|
|
2601
2571
|
for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
|
|
@@ -2639,17 +2609,17 @@ _StopRunner2 = new WeakMap();
|
|
|
2639
2609
|
_TerminateRunner2 = new WeakMap();
|
|
2640
2610
|
_PauseRunner2 = new WeakMap();
|
|
2641
2611
|
_ResumeRunner2 = new WeakMap();
|
|
2642
|
-
|
|
2612
|
+
_UpdateOptionsRunner = new WeakMap();
|
|
2643
2613
|
_PauseWorker = new WeakMap();
|
|
2644
2614
|
_ResumeWorker = new WeakMap();
|
|
2645
2615
|
_StopWorker = new WeakMap();
|
|
2646
2616
|
_StartWorker = new WeakMap();
|
|
2647
2617
|
_ResetWorker = new WeakMap();
|
|
2648
2618
|
_ExecuteWorker = new WeakMap();
|
|
2649
|
-
_BroadcastUpdateCommandToAllRunners = new WeakMap();
|
|
2650
2619
|
_UpdateOptionsWorker = new WeakMap();
|
|
2620
|
+
_BroadcastCommandToAllRunners = new WeakMap();
|
|
2651
2621
|
_TerminateWorker = new WeakMap();
|
|
2652
|
-
|
|
2622
|
+
_HandleAllWorkers = new WeakMap();
|
|
2653
2623
|
export {
|
|
2654
2624
|
IRunnerState,
|
|
2655
2625
|
IWorkerState,
|