@nsshunt/stsrunnerframework 1.0.101 → 1.0.103

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, _logMessage, _debug, _error, _warn, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _logMessage2, _debug2, _error2, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateOptionsRunner, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _BroadcastCommandToAllRunners, _HandleAllWorkers, _ExecuteCommandOnRunners, _STSWorkerManager_instances, GetRunnersResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _PostMessageToWorkerGetRunners;
12
+ var _collectorCollectorPort, _runners, _options, _workerId, _logMessage, _debug, _error, _warn, _silly, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _PostRunnersToWorkerManager, _StartRunner, _StopRunnerByRunnerId, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _id, _messages, _logMessage2, _debug2, _error2, _warn2, _processLoopExecutor2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitWorkerEvent, _EmitRunnerEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _UpdateOptionsRunner, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _UpdateOptionsWorker, _TerminateWorker, _BroadcastCommandToAllRunners, _HandleAllWorkers, _ExecuteCommandOnRunners, _STSWorkerManager_instances, GetRunnersResponse_fn, _SyncRunnerData, _SyncWorkerDataFromPayload, _SyncWorkerDataFromWorker, _SyncWorkerDataFromWorkers, _PostMessageToWorkerGetRunners;
13
13
  import { defaultLogger, Sleep, ModelDelimeter } from "@nsshunt/stsutils";
14
14
  import { Gauge } from "@nsshunt/stsobservability";
15
15
  const URI_BASE_VUEUTILS = "/";
@@ -1534,6 +1534,7 @@ class WorkerInstance {
1534
1534
  __privateAdd(this, _debug, (message) => __privateGet(this, _logMessage).call(this, defaultLogger.debug, message));
1535
1535
  __privateAdd(this, _error, (error) => __privateGet(this, _logMessage).call(this, defaultLogger.error, error));
1536
1536
  __privateAdd(this, _warn, (message) => __privateGet(this, _logMessage).call(this, defaultLogger.debug, message));
1537
+ __privateAdd(this, _silly, (message) => __privateGet(this, _logMessage).call(this, defaultLogger.silly, message));
1537
1538
  __privateAdd(this, _processLoopExecutor, async () => {
1538
1539
  try {
1539
1540
  const removeList = [];
@@ -1566,10 +1567,6 @@ class WorkerInstance {
1566
1567
  __privateGet(this, _debug).call(this, `GetRandomInt`);
1567
1568
  return Math.floor(Math.random() * Math.floor(max));
1568
1569
  });
1569
- __publicField(this, "StartWork", async (runner) => {
1570
- __privateGet(this, _debug).call(this, `StartWork`);
1571
- return;
1572
- });
1573
1570
  __publicField(this, "PostTelemetryById", (id) => {
1574
1571
  __privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.InstrumentTelemetry, id, false);
1575
1572
  });
@@ -2015,8 +2012,7 @@ class WorkerInstance {
2015
2012
  __privateGet(this, _PostRunnersToWorkerManager).call(this, eIWMessageCommands.GetRunners, payloadMessage);
2016
2013
  break;
2017
2014
  default:
2018
- __privateGet(this, _debug).call(this, `ProcessMessage::default`);
2019
- __privateGet(this, _debug).call(this, `Invalid payloadMessage.command: [${payloadMessage.command}] - Ignoring`);
2015
+ __privateGet(this, _warn).call(this, `ProcessMessage::default: Invalid payloadMessage.command: [${payloadMessage.command}] - Ignoring`);
2020
2016
  }
2021
2017
  } catch (error) {
2022
2018
  __privateGet(this, _error).call(this, `ProcessMessage(): Error: [${error}]`);
@@ -2024,7 +2020,6 @@ class WorkerInstance {
2024
2020
  }
2025
2021
  });
2026
2022
  __privateGet(this, _debug).call(this, `constructor`);
2027
- __privateGet(this, _processLoopExecutor).call(this);
2028
2023
  }
2029
2024
  get CollectorCollectorPort() {
2030
2025
  return __privateGet(this, _collectorCollectorPort);
@@ -2041,6 +2036,7 @@ _logMessage = new WeakMap();
2041
2036
  _debug = new WeakMap();
2042
2037
  _error = new WeakMap();
2043
2038
  _warn = new WeakMap();
2039
+ _silly = new WeakMap();
2044
2040
  _processLoopExecutor = new WeakMap();
2045
2041
  _SetMessagePort = new WeakMap();
2046
2042
  _CreateRunnerEx2RunState = new WeakMap();
@@ -2232,6 +2228,7 @@ class STSWorkerManager {
2232
2228
  });
2233
2229
  __privateAdd(this, _debug2, (message) => __privateGet(this, _logMessage2).call(this, defaultLogger.debug, message));
2234
2230
  __privateAdd(this, _error2, (error) => __privateGet(this, _logMessage2).call(this, defaultLogger.error, error));
2231
+ __privateAdd(this, _warn2, (error) => __privateGet(this, _logMessage2).call(this, defaultLogger.warn, error));
2235
2232
  __privateAdd(this, _processLoopExecutor2, async () => {
2236
2233
  const removeList = [];
2237
2234
  for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
@@ -2288,8 +2285,8 @@ class STSWorkerManager {
2288
2285
  }
2289
2286
  return retVal;
2290
2287
  });
2291
- __publicField(this, "GetArchiveList", () => {
2292
- return __privateGet(this, _archiveList);
2288
+ __publicField(this, "GetArchiveList", (tag) => {
2289
+ return __privateGet(this, _archiveList).filter((runner) => tag.localeCompare("") === 0 ? true : runner.options.tag.localeCompare(tag) === 0);
2293
2290
  });
2294
2291
  __publicField(this, "GetWorker", async (workerId) => {
2295
2292
  await __privateGet(this, _SyncWorkerDataFromWorker).call(this, __privateGet(this, _workersEx)[workerId]);
@@ -2353,8 +2350,7 @@ class STSWorkerManager {
2353
2350
  if (__privateGet(this, _STSInstrumentController)) {
2354
2351
  __privateGet(this, _STSInstrumentController).LogEx(chalk.yellow(`pid: [${process.pid}] Creating new worker: [${stsWorkerEx.id}]`));
2355
2352
  }
2356
- __privateGet(this, _debug2).call(this, `Adding worker: [${stsWorkerEx.id}]`);
2357
- __privateGet(this, _debug2).call(this, `AddWorker::workerThreadWorkerOptions: [${stsWorkerEx.id}]`);
2353
+ __privateGet(this, _debug2).call(this, `AddWorker::workerThreadWorkerOptions: Worker ID: [${stsWorkerEx.id}] Options: [${stsWorkerEx.options}]`);
2358
2354
  if (stsWorkerEx.options.mocked) {
2359
2355
  stsWorkerEx.worker.SetPort({
2360
2356
  command: eIWMessageCommands.MessagePort,
@@ -2434,16 +2430,12 @@ class STSWorkerManager {
2434
2430
  __privateGet(this, _RunnerStateChange).call(this, stsWorkerEx, publishMessagePayload2.payload);
2435
2431
  break;
2436
2432
  case eIWMessageCommands.RemoveRunnerFromCollection:
2437
- __privateGet(this, _debug2).call(this, `AddWorker:processMessage():eIWMessageCommands.RemoveRunnerFromCollection`);
2438
- __privateGet(this, _debug2).call(this, `${JSON.stringify(publishMessagePayload2.payload)}`);
2439
2433
  __privateGet(this, _RemoveRunnerFromCollection).call(this, stsWorkerEx, publishMessagePayload2.payload);
2440
2434
  case eIWMessageCommands.GetRunners:
2441
- __privateGet(this, _debug2).call(this, `AddWorker:processMessage():eIWMessageCommands.GetRunners`);
2442
- __privateGet(this, _debug2).call(this, `${JSON.stringify(publishMessagePayload2.payload)}`);
2443
2435
  __privateMethod(this, _STSWorkerManager_instances, GetRunnersResponse_fn).call(this, stsWorkerEx, publishMessagePayload2.payload);
2444
2436
  break;
2445
2437
  default:
2446
- __privateGet(this, _debug2).call(this, `processMessage::default`);
2438
+ __privateGet(this, _warn2).call(this, `processMessage::default: Command Not Found: [${publishMessagePayload2.command}]`);
2447
2439
  }
2448
2440
  };
2449
2441
  let publishMessagePayload;
@@ -2512,6 +2504,7 @@ class STSWorkerManager {
2512
2504
  const { runner } = payloadContents;
2513
2505
  if (workerEx.runnersEx[runner.id]) {
2514
2506
  const runnerEx = workerEx.runnersEx[runner.id];
2507
+ const previousState = runnerEx.state;
2515
2508
  runnerEx.state = runner.state;
2516
2509
  if (!runnerEx.runnerHistory) {
2517
2510
  runnerEx.runnerHistory = [];
@@ -2521,11 +2514,7 @@ class STSWorkerManager {
2521
2514
  runner: { ...runner }
2522
2515
  });
2523
2516
  __privateGet(this, _SyncRunnerData).call(this, runnerEx, runner);
2524
- __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): Worker: [${workerEx.id}] Runner: [${runner.id}]`);
2525
- __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): --> Runner iteration (payload): [${runner.iteration}]`);
2526
- __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): --> Runner instrumentData.requestCount (payload): [${runner.instrumentData.requestCount}]`);
2527
- __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): --> Runner iteration (in-memory graph): [${runnerEx.iteration}]`);
2528
- __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): --> Runner instrumentData.requestCount (payload): [${runnerEx.instrumentData.requestCount}]`);
2517
+ __privateGet(this, _debug2).call(this, `STSWorkerManager:#RunnerStateChange(): Worker: [${workerEx.id}] Runner: [${runner.id}] Previous State: [${previousState}] State: [${runner.state}]`);
2529
2518
  __privateGet(this, _EmitRunnerEvent).call(this, "StateChange", workerEx, runner.id);
2530
2519
  }
2531
2520
  });
@@ -2937,7 +2926,6 @@ class STSWorkerManager {
2937
2926
  __privateSet(this, _STSInstrumentController, __privateGet(this, _options2).publishInstrumentController);
2938
2927
  __privateSet(this, _telemetryProcessor, new TelemetryProcessor());
2939
2928
  }
2940
- __privateGet(this, _processLoopExecutor2).call(this);
2941
2929
  }
2942
2930
  CreateRunnerCopyNoHistory(runnerEx) {
2943
2931
  return {
@@ -2994,6 +2982,7 @@ _messages = new WeakMap();
2994
2982
  _logMessage2 = new WeakMap();
2995
2983
  _debug2 = new WeakMap();
2996
2984
  _error2 = new WeakMap();
2985
+ _warn2 = new WeakMap();
2997
2986
  _processLoopExecutor2 = new WeakMap();
2998
2987
  _SetRunnerIntoWorker = new WeakMap();
2999
2988
  _ProcessTelemetry = new WeakMap();
@@ -3024,10 +3013,6 @@ _BroadcastCommandToAllRunners = new WeakMap();
3024
3013
  _HandleAllWorkers = new WeakMap();
3025
3014
  _ExecuteCommandOnRunners = new WeakMap();
3026
3015
  _STSWorkerManager_instances = new WeakSet();
3027
- //GetWorkersEx = async (messageId: string, workerEx: IWorkerEx): Promise<IWorkers> => {
3028
- //const retVal2 = await this.#PostMessageToWorkerGetRunners(workerEx, eIWMessageCommands.GetRunners);
3029
- //});
3030
- //}
3031
3016
  GetRunnersResponse_fn = function(stsWorkerEx, payload) {
3032
3017
  try {
3033
3018
  const messageId = payload.messageId;