@nsshunt/stsrunnerframework 1.0.71 → 1.0.73
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 +79 -68
- package/dist/stsrunnerframework.mjs.map +1 -1
- package/dist/stsrunnerframework.umd.js +79 -68
- package/dist/stsrunnerframework.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/commonTypes.d.ts +1 -2
- package/types/commonTypes.d.ts.map +1 -1
- package/types/workerManager.d.ts +2 -1
- 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,
|
|
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, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn, CreateRunnerCopy_fn, CreateWorkerCopy_fn, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2;
|
|
13
13
|
import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
|
|
14
14
|
import { Gauge } from "@nsshunt/stsobservability";
|
|
15
15
|
const URI_BASE_VUEUTILS = "/";
|
|
@@ -2048,20 +2048,11 @@ class STSWorkerManager {
|
|
|
2048
2048
|
const runnerEx = workerEx.runnersEx[removeList[i].runnerId];
|
|
2049
2049
|
if (runnerEx) {
|
|
2050
2050
|
if (runnerEx.publishInstrumentController) {
|
|
2051
|
-
|
|
2051
|
+
__privateGet(this, _debug2).call(this, chalk.grey(`Ending publish for runner: [${JSON.stringify(runnerEx.asyncRunnerContext)}]`));
|
|
2052
2052
|
await runnerEx.publishInstrumentController.EndPublish();
|
|
2053
2053
|
await Sleep(250);
|
|
2054
2054
|
}
|
|
2055
|
-
const runner =
|
|
2056
|
-
id: runnerEx.id,
|
|
2057
|
-
asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
|
|
2058
|
-
instrumentData: { ...runnerEx.instrumentData },
|
|
2059
|
-
iteration: runnerEx.iteration,
|
|
2060
|
-
options: { ...runnerEx.options },
|
|
2061
|
-
runnerHistory: [...runnerEx.runnerHistory],
|
|
2062
|
-
state: runnerEx.state,
|
|
2063
|
-
workerId: runnerEx.workerId
|
|
2064
|
-
};
|
|
2055
|
+
const runner = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
|
|
2065
2056
|
__privateGet(this, _archiveList).push(runner);
|
|
2066
2057
|
if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
|
|
2067
2058
|
__privateGet(this, _archiveList).shift();
|
|
@@ -2070,6 +2061,9 @@ class STSWorkerManager {
|
|
|
2070
2061
|
}
|
|
2071
2062
|
}
|
|
2072
2063
|
}
|
|
2064
|
+
for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
|
|
2065
|
+
__privateGet(this, _debug2).call(this, chalk.grey(`STSWorkerManager:#processLoopExecutor(): Remaining runners from worker: [${workerEx.id}]: [${Object.keys(workerEx.runnersEx).length}]`));
|
|
2066
|
+
}
|
|
2073
2067
|
setTimeout(__privateGet(this, _processLoopExecutor2), 1e3);
|
|
2074
2068
|
}, 100);
|
|
2075
2069
|
} else {
|
|
@@ -2097,7 +2091,6 @@ class STSWorkerManager {
|
|
|
2097
2091
|
id: workerId,
|
|
2098
2092
|
worker: workerFactory.createWorkerThreadWorker(),
|
|
2099
2093
|
messagePort: port1,
|
|
2100
|
-
state: IWorkerState.starting,
|
|
2101
2094
|
workerThreadWorkerOptions: workerFactory.workerThreadWorkerOptions,
|
|
2102
2095
|
runnersEx: {},
|
|
2103
2096
|
runnersEvents: {},
|
|
@@ -2169,17 +2162,11 @@ class STSWorkerManager {
|
|
|
2169
2162
|
const publishMessagePayload2 = data;
|
|
2170
2163
|
switch (publishMessagePayload2.command) {
|
|
2171
2164
|
case eIWMessageCommands.MessagePortResponse:
|
|
2172
|
-
|
|
2165
|
+
__privateGet(this, _debug2).call(this, `AddWorker:processMessage(): eIWMessageCommands.MessagePortResponse`);
|
|
2173
2166
|
break;
|
|
2174
2167
|
case eIWMessageCommands.InstrumentTelemetry:
|
|
2175
2168
|
__privateGet(this, _ProcessTelemetry).call(this, stsWorkerEx, publishMessagePayload2.payload);
|
|
2176
2169
|
break;
|
|
2177
|
-
/*
|
|
2178
|
-
case eIWMessageCommands.Completed :
|
|
2179
|
-
//this.#debug(`AddWorker::eIWMessageCommands.InstrumentTelemetry`);
|
|
2180
|
-
this.#ProcessCompleted(stsWorkerEx, publishMessagePayload.payload as ITestRunnerTelemetryPayload);
|
|
2181
|
-
break;
|
|
2182
|
-
*/
|
|
2183
2170
|
case eIWMessageCommands.RunnerStateChange:
|
|
2184
2171
|
__privateGet(this, _RunnerStateChange).call(this, stsWorkerEx, publishMessagePayload2.payload);
|
|
2185
2172
|
break;
|
|
@@ -2219,7 +2206,7 @@ class STSWorkerManager {
|
|
|
2219
2206
|
});
|
|
2220
2207
|
__privateAdd(this, _SetRunnerIntoWorker, (workerEx, runnerEx) => {
|
|
2221
2208
|
const payload = {
|
|
2222
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2209
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2223
2210
|
};
|
|
2224
2211
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.AddRunner, payload);
|
|
2225
2212
|
});
|
|
@@ -2257,6 +2244,9 @@ class STSWorkerManager {
|
|
|
2257
2244
|
if (workerEx.runnersEx[runner.id]) {
|
|
2258
2245
|
const runnerEx = workerEx.runnersEx[runner.id];
|
|
2259
2246
|
runnerEx.state = runner.state;
|
|
2247
|
+
if (!runnerEx.runnerHistory) {
|
|
2248
|
+
runnerEx.runnerHistory = [];
|
|
2249
|
+
}
|
|
2260
2250
|
runnerEx.runnerHistory.push({
|
|
2261
2251
|
eventDate: /* @__PURE__ */ new Date(),
|
|
2262
2252
|
runner: { ...runner }
|
|
@@ -2356,61 +2346,59 @@ class STSWorkerManager {
|
|
|
2356
2346
|
});
|
|
2357
2347
|
__privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
|
|
2358
2348
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
|
|
2359
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2349
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2360
2350
|
});
|
|
2361
2351
|
return true;
|
|
2362
2352
|
});
|
|
2363
2353
|
__privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
|
|
2364
2354
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
|
|
2365
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2355
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2366
2356
|
});
|
|
2367
2357
|
return true;
|
|
2368
2358
|
});
|
|
2369
2359
|
__privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
|
|
2370
2360
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
|
|
2371
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2361
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2372
2362
|
});
|
|
2373
2363
|
return true;
|
|
2374
2364
|
});
|
|
2375
2365
|
__privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
|
|
2376
2366
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
|
|
2377
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2367
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2378
2368
|
});
|
|
2379
2369
|
return true;
|
|
2380
2370
|
});
|
|
2381
2371
|
__privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
|
|
2382
2372
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
|
|
2383
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2373
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2384
2374
|
});
|
|
2385
2375
|
return true;
|
|
2386
2376
|
});
|
|
2387
2377
|
__privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
|
|
2388
2378
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
|
|
2389
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2379
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2390
2380
|
});
|
|
2391
2381
|
return true;
|
|
2392
2382
|
});
|
|
2393
2383
|
__privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
|
|
2394
2384
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
|
|
2395
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2385
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2396
2386
|
});
|
|
2397
2387
|
return true;
|
|
2398
2388
|
});
|
|
2399
2389
|
__privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
|
|
2400
2390
|
try {
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
await Promise.all(promArray);
|
|
2413
|
-
}
|
|
2391
|
+
const promArray = [];
|
|
2392
|
+
const ids = Object.keys(workerEx.runnersEx);
|
|
2393
|
+
ids.forEach((id) => {
|
|
2394
|
+
const runnerEx = workerEx.runnersEx[id];
|
|
2395
|
+
if (options) {
|
|
2396
|
+
promArray.push(command(workerEx, runnerEx, options));
|
|
2397
|
+
} else {
|
|
2398
|
+
promArray.push(command(workerEx, runnerEx));
|
|
2399
|
+
}
|
|
2400
|
+
});
|
|
2401
|
+
await Promise.all(promArray);
|
|
2414
2402
|
return true;
|
|
2415
2403
|
} catch (error) {
|
|
2416
2404
|
console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
@@ -2437,19 +2425,17 @@ class STSWorkerManager {
|
|
|
2437
2425
|
});
|
|
2438
2426
|
__privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
|
|
2439
2427
|
try {
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
await Promise.all(promArray);
|
|
2452
|
-
}
|
|
2428
|
+
const promArray = [];
|
|
2429
|
+
const ids = Object.keys(workerEx.runnersEx);
|
|
2430
|
+
ids.forEach((id) => {
|
|
2431
|
+
const runnerEx = workerEx.runnersEx[id];
|
|
2432
|
+
if (executionProfile) {
|
|
2433
|
+
promArray.push(command(workerEx, runnerEx, executionProfile));
|
|
2434
|
+
} else {
|
|
2435
|
+
promArray.push(command(workerEx, runnerEx));
|
|
2436
|
+
}
|
|
2437
|
+
});
|
|
2438
|
+
await Promise.all(promArray);
|
|
2453
2439
|
return true;
|
|
2454
2440
|
} catch (error) {
|
|
2455
2441
|
console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
@@ -2462,14 +2448,12 @@ class STSWorkerManager {
|
|
|
2462
2448
|
});
|
|
2463
2449
|
__privateAdd(this, _TerminateWorker, async (workerEx) => {
|
|
2464
2450
|
try {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
} else {
|
|
2472
|
-
}
|
|
2451
|
+
await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
|
|
2452
|
+
if (workerEx.worker) {
|
|
2453
|
+
workerEx.worker.terminate();
|
|
2454
|
+
__privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
|
|
2455
|
+
delete __privateGet(this, _workersEx)[workerEx.id];
|
|
2456
|
+
} else {
|
|
2473
2457
|
}
|
|
2474
2458
|
return true;
|
|
2475
2459
|
} catch (error) {
|
|
@@ -2480,7 +2464,7 @@ class STSWorkerManager {
|
|
|
2480
2464
|
__privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
|
|
2481
2465
|
runnerEx.options.executionProfile = { ...executionProfile };
|
|
2482
2466
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
|
|
2483
|
-
runner: __privateMethod(this, _STSWorkerManager_instances,
|
|
2467
|
+
runner: __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx)
|
|
2484
2468
|
});
|
|
2485
2469
|
return true;
|
|
2486
2470
|
});
|
|
@@ -2577,6 +2561,13 @@ class STSWorkerManager {
|
|
|
2577
2561
|
}
|
|
2578
2562
|
__privateGet(this, _processLoopExecutor2).call(this);
|
|
2579
2563
|
}
|
|
2564
|
+
get Workers() {
|
|
2565
|
+
const retVal = {};
|
|
2566
|
+
for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
|
|
2567
|
+
retVal[workerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateWorkerCopy_fn).call(this, workerEx);
|
|
2568
|
+
}
|
|
2569
|
+
return retVal;
|
|
2570
|
+
}
|
|
2580
2571
|
get WorkersEx() {
|
|
2581
2572
|
return __privateGet(this, _workersEx);
|
|
2582
2573
|
}
|
|
@@ -2595,19 +2586,39 @@ _options2 = new WeakMap();
|
|
|
2595
2586
|
_STSInstrumentController = new WeakMap();
|
|
2596
2587
|
_telemetryProcessor = new WeakMap();
|
|
2597
2588
|
_archiveList = new WeakMap();
|
|
2598
|
-
_processLoopExecutor2 = new WeakMap();
|
|
2599
|
-
_debug2 = new WeakMap();
|
|
2600
2589
|
_STSWorkerManager_instances = new WeakSet();
|
|
2601
|
-
|
|
2590
|
+
CreateRunnerCopyNoHistory_fn = function(runnerEx) {
|
|
2602
2591
|
return {
|
|
2603
2592
|
id: runnerEx.id,
|
|
2604
2593
|
asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
|
|
2605
|
-
options: { ...runnerEx.options },
|
|
2606
2594
|
instrumentData: { ...runnerEx.instrumentData },
|
|
2607
2595
|
iteration: runnerEx.iteration,
|
|
2608
|
-
|
|
2596
|
+
options: { ...runnerEx.options },
|
|
2597
|
+
state: runnerEx.state,
|
|
2598
|
+
workerId: runnerEx.workerId
|
|
2609
2599
|
};
|
|
2610
2600
|
};
|
|
2601
|
+
CreateRunnerCopy_fn = function(runnerEx) {
|
|
2602
|
+
const retVal = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopyNoHistory_fn).call(this, runnerEx);
|
|
2603
|
+
if (runnerEx.runnerHistory) {
|
|
2604
|
+
retVal.runnerHistory = [...runnerEx.runnerHistory];
|
|
2605
|
+
}
|
|
2606
|
+
return retVal;
|
|
2607
|
+
};
|
|
2608
|
+
CreateWorkerCopy_fn = function(workerEx) {
|
|
2609
|
+
const { id, workerThreadWorkerOptions, runnersEx } = workerEx;
|
|
2610
|
+
const workerCopy = {
|
|
2611
|
+
id,
|
|
2612
|
+
workerThreadWorkerOptions: { ...workerThreadWorkerOptions },
|
|
2613
|
+
runners: {}
|
|
2614
|
+
};
|
|
2615
|
+
for (const [, runnerEx] of Object.entries(runnersEx)) {
|
|
2616
|
+
workerCopy.runners[runnerEx.id] = __privateMethod(this, _STSWorkerManager_instances, CreateRunnerCopy_fn).call(this, runnerEx);
|
|
2617
|
+
}
|
|
2618
|
+
return workerCopy;
|
|
2619
|
+
};
|
|
2620
|
+
_processLoopExecutor2 = new WeakMap();
|
|
2621
|
+
_debug2 = new WeakMap();
|
|
2611
2622
|
_SetRunnerIntoWorker = new WeakMap();
|
|
2612
2623
|
_ProcessTelemetry = new WeakMap();
|
|
2613
2624
|
_EmitEvent = new WeakMap();
|