@nsshunt/stsrunnerframework 1.0.80 → 1.0.82

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.
@@ -2049,8 +2049,7 @@ class STSWorkerManager {
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
- await runnerEx.publishInstrumentController.EndPublish();
2053
- await Sleep(250);
2052
+ runnerEx.publishInstrumentController.EndPublish();
2054
2053
  }
2055
2054
  const runner = this.CreateRunnerCopy(runnerEx);
2056
2055
  __privateGet(this, _archiveList).push(runner);
@@ -2073,6 +2072,22 @@ class STSWorkerManager {
2073
2072
  __privateAdd(this, _debug2, (message) => {
2074
2073
  console.log(chalk.cyan(`pid: [${process.pid}] STSWorkerManager::${message}`));
2075
2074
  });
2075
+ __publicField(this, "GetWorkers", () => {
2076
+ const retVal = {};
2077
+ for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2078
+ retVal[workerEx.id] = this.CreateWorkerCopy(workerEx);
2079
+ }
2080
+ return retVal;
2081
+ });
2082
+ __publicField(this, "GetArchiveList", () => {
2083
+ return __privateGet(this, _archiveList);
2084
+ });
2085
+ __publicField(this, "GetWorker", (workerId) => {
2086
+ return this.CreateWorkerCopy(__privateGet(this, _workersEx)[workerId]);
2087
+ });
2088
+ __publicField(this, "GetRunner", (workerId, runnerId) => {
2089
+ return this.CreateRunnerCopy(__privateGet(this, _workersEx)[workerId].runnersEx[runnerId]);
2090
+ });
2076
2091
  __publicField(this, "AddWorker", (workerOptions, useWorkerFactory) => {
2077
2092
  let workerFactory;
2078
2093
  if (useWorkerFactory) {
@@ -2107,14 +2122,14 @@ class STSWorkerManager {
2107
2122
  ExecuteRunner: (runner) => __privateGet(this, _ExecuteRunner2).call(this, stsWorkerEx, runner),
2108
2123
  UpdateOptionsRunner: (runner, executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, stsWorkerEx, runner, executionProfile),
2109
2124
  // Commands to execute on all runners
2110
- Start: async () => __privateGet(this, _StartWorker).call(this, stsWorkerEx),
2111
- Stop: async () => __privateGet(this, _StopWorker).call(this, stsWorkerEx),
2112
- Pause: async () => __privateGet(this, _PauseWorker).call(this, stsWorkerEx),
2113
- Resume: async () => __privateGet(this, _ResumeWorker).call(this, stsWorkerEx),
2114
- Terminate: async () => __privateGet(this, _TerminateWorker).call(this, stsWorkerEx),
2115
- Reset: async () => __privateGet(this, _ResetWorker).call(this, stsWorkerEx),
2116
- Execute: async () => __privateGet(this, _ExecuteWorker).call(this, stsWorkerEx),
2117
- UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptionsWorker).call(this, stsWorkerEx, executionProfile)
2125
+ Start: () => __privateGet(this, _StartWorker).call(this, stsWorkerEx),
2126
+ Stop: () => __privateGet(this, _StopWorker).call(this, stsWorkerEx),
2127
+ Pause: () => __privateGet(this, _PauseWorker).call(this, stsWorkerEx),
2128
+ Resume: () => __privateGet(this, _ResumeWorker).call(this, stsWorkerEx),
2129
+ Terminate: () => __privateGet(this, _TerminateWorker).call(this, stsWorkerEx),
2130
+ Reset: () => __privateGet(this, _ResetWorker).call(this, stsWorkerEx),
2131
+ Execute: () => __privateGet(this, _ExecuteWorker).call(this, stsWorkerEx),
2132
+ UpdateOptions: (executionProfile) => __privateGet(this, _UpdateOptionsWorker).call(this, stsWorkerEx, executionProfile)
2118
2133
  };
2119
2134
  if (__privateGet(this, _STSInstrumentController)) {
2120
2135
  __privateGet(this, _STSInstrumentController).LogEx(chalk.yellow(`pid: [${process.pid}] Creating new worker: [${stsWorkerEx.id}]`));
@@ -2187,7 +2202,7 @@ class STSWorkerManager {
2187
2202
  processMessage(publishMessagePayload);
2188
2203
  });
2189
2204
  } else {
2190
- stsWorkerEx.messagePort.onmessage = async (data) => {
2205
+ stsWorkerEx.messagePort.onmessage = (data) => {
2191
2206
  publishMessagePayload = data.data;
2192
2207
  processMessage(publishMessagePayload);
2193
2208
  };
@@ -2311,14 +2326,14 @@ class STSWorkerManager {
2311
2326
  rx: 0,
2312
2327
  tx: 0
2313
2328
  },
2314
- Start: async () => __privateGet(this, _StartRunner2).call(this, workerEx, runnerEx),
2315
- Stop: async () => __privateGet(this, _StopRunner2).call(this, workerEx, runnerEx),
2316
- Pause: async () => __privateGet(this, _PauseRunner2).call(this, workerEx, runnerEx),
2317
- Resume: async () => __privateGet(this, _ResumeRunner2).call(this, workerEx, runnerEx),
2318
- Reset: async () => __privateGet(this, _ResetRunner2).call(this, workerEx, runnerEx),
2319
- Execute: async () => __privateGet(this, _ExecuteRunner2).call(this, workerEx, runnerEx),
2320
- Terminate: async () => __privateGet(this, _TerminateRunner2).call(this, workerEx, runnerEx),
2321
- UpdateOptions: async (executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, workerEx, runnerEx, executionProfile),
2329
+ Start: () => __privateGet(this, _StartRunner2).call(this, workerEx, runnerEx),
2330
+ Stop: () => __privateGet(this, _StopRunner2).call(this, workerEx, runnerEx),
2331
+ Pause: () => __privateGet(this, _PauseRunner2).call(this, workerEx, runnerEx),
2332
+ Resume: () => __privateGet(this, _ResumeRunner2).call(this, workerEx, runnerEx),
2333
+ Reset: () => __privateGet(this, _ResetRunner2).call(this, workerEx, runnerEx),
2334
+ Execute: () => __privateGet(this, _ExecuteRunner2).call(this, workerEx, runnerEx),
2335
+ Terminate: () => __privateGet(this, _TerminateRunner2).call(this, workerEx, runnerEx),
2336
+ UpdateOptions: (executionProfile) => __privateGet(this, _UpdateOptionsRunner).call(this, workerEx, runnerEx, executionProfile),
2322
2337
  on: (eventName, cb) => {
2323
2338
  if (!workerEx.runnersEvents[runnerEx.id]) {
2324
2339
  workerEx.runnersEvents[runnerEx.id] = [];
@@ -2346,7 +2361,7 @@ class STSWorkerManager {
2346
2361
  __privateGet(this, _debug2).call(this, `#PostMessageToWorker`);
2347
2362
  workerEx.messagePort.postMessage({ command, payload });
2348
2363
  });
2349
- __privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
2364
+ __privateAdd(this, _StartRunner2, (workerEx, runnerEx) => {
2350
2365
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
2351
2366
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2352
2367
  });
@@ -2357,7 +2372,7 @@ class STSWorkerManager {
2357
2372
  result: true
2358
2373
  };
2359
2374
  });
2360
- __privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
2375
+ __privateAdd(this, _ResetRunner2, (workerEx, runnerEx) => {
2361
2376
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
2362
2377
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2363
2378
  });
@@ -2368,7 +2383,7 @@ class STSWorkerManager {
2368
2383
  result: true
2369
2384
  };
2370
2385
  });
2371
- __privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
2386
+ __privateAdd(this, _ExecuteRunner2, (workerEx, runnerEx) => {
2372
2387
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
2373
2388
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2374
2389
  });
@@ -2379,7 +2394,7 @@ class STSWorkerManager {
2379
2394
  result: true
2380
2395
  };
2381
2396
  });
2382
- __privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
2397
+ __privateAdd(this, _StopRunner2, (workerEx, runnerEx) => {
2383
2398
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
2384
2399
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2385
2400
  });
@@ -2390,7 +2405,7 @@ class STSWorkerManager {
2390
2405
  result: true
2391
2406
  };
2392
2407
  });
2393
- __privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
2408
+ __privateAdd(this, _TerminateRunner2, (workerEx, runnerEx) => {
2394
2409
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
2395
2410
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2396
2411
  });
@@ -2401,7 +2416,7 @@ class STSWorkerManager {
2401
2416
  result: true
2402
2417
  };
2403
2418
  });
2404
- __privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
2419
+ __privateAdd(this, _PauseRunner2, (workerEx, runnerEx) => {
2405
2420
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
2406
2421
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2407
2422
  });
@@ -2412,7 +2427,7 @@ class STSWorkerManager {
2412
2427
  result: true
2413
2428
  };
2414
2429
  });
2415
- __privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
2430
+ __privateAdd(this, _ResumeRunner2, (workerEx, runnerEx) => {
2416
2431
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
2417
2432
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
2418
2433
  });
@@ -2423,7 +2438,7 @@ class STSWorkerManager {
2423
2438
  result: true
2424
2439
  };
2425
2440
  });
2426
- __privateAdd(this, _UpdateOptionsRunner, async (workerEx, runnerEx, executionProfile) => {
2441
+ __privateAdd(this, _UpdateOptionsRunner, (workerEx, runnerEx, executionProfile) => {
2427
2442
  runnerEx.options.executionProfile = { ...executionProfile };
2428
2443
  __privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
2429
2444
  runner: this.CreateRunnerCopyNoHistory(runnerEx)
@@ -2435,32 +2450,32 @@ class STSWorkerManager {
2435
2450
  result: true
2436
2451
  };
2437
2452
  });
2438
- __privateAdd(this, _PauseWorker, async (workerEx) => {
2453
+ __privateAdd(this, _PauseWorker, (workerEx) => {
2439
2454
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _PauseRunner2));
2440
2455
  });
2441
- __privateAdd(this, _ResumeWorker, async (workerEx) => {
2456
+ __privateAdd(this, _ResumeWorker, (workerEx) => {
2442
2457
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ResumeRunner2));
2443
2458
  });
2444
- __privateAdd(this, _StopWorker, async (workerEx) => {
2459
+ __privateAdd(this, _StopWorker, (workerEx) => {
2445
2460
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _StopRunner2));
2446
2461
  });
2447
- __privateAdd(this, _StartWorker, async (workerEx) => {
2462
+ __privateAdd(this, _StartWorker, (workerEx) => {
2448
2463
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _StartRunner2));
2449
2464
  });
2450
- __privateAdd(this, _ResetWorker, async (workerEx) => {
2465
+ __privateAdd(this, _ResetWorker, (workerEx) => {
2451
2466
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ResetRunner2));
2452
2467
  });
2453
- __privateAdd(this, _ExecuteWorker, async (workerEx) => {
2468
+ __privateAdd(this, _ExecuteWorker, (workerEx) => {
2454
2469
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _ExecuteRunner2));
2455
2470
  });
2456
2471
  // IExecutionProfile
2457
- __privateAdd(this, _UpdateOptionsWorker, async (workerEx, executionProfile) => {
2472
+ __privateAdd(this, _UpdateOptionsWorker, (workerEx, executionProfile) => {
2458
2473
  return __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _UpdateOptionsRunner), executionProfile);
2459
2474
  });
2460
- __privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, executionProfile) => {
2475
+ __privateAdd(this, _BroadcastCommandToAllRunners, (workerEx, command, executionProfile) => {
2461
2476
  try {
2462
- const executeCommand = async (runnerEx) => {
2463
- const result = executionProfile ? await command(workerEx, runnerEx, executionProfile) : await command(workerEx, runnerEx);
2477
+ const executeCommand = (runnerEx) => {
2478
+ const result = executionProfile ? command(workerEx, runnerEx, executionProfile) : command(workerEx, runnerEx);
2464
2479
  return {
2465
2480
  workerManagerId: __privateGet(this, _id),
2466
2481
  workerId: workerEx.id,
@@ -2468,16 +2483,15 @@ class STSWorkerManager {
2468
2483
  result
2469
2484
  };
2470
2485
  };
2471
- const promises = Object.values(workerEx.runnersEx).map((runnerEx) => executeCommand(runnerEx));
2472
- return await Promise.all(promises);
2486
+ return Object.values(workerEx.runnersEx).map((runnerEx) => executeCommand(runnerEx));
2473
2487
  } catch (error) {
2474
2488
  console.error(`Error in STSTestWorker:WorkerCommand: [${error}]`);
2475
2489
  return [];
2476
2490
  }
2477
2491
  });
2478
- __privateAdd(this, _TerminateWorker, async (workerEx) => {
2492
+ __privateAdd(this, _TerminateWorker, (workerEx) => {
2479
2493
  try {
2480
- const retVal = await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2494
+ const retVal = __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
2481
2495
  if (workerEx.worker) {
2482
2496
  workerEx.worker.terminate();
2483
2497
  __privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
@@ -2517,25 +2531,25 @@ class STSWorkerManager {
2517
2531
  return busyWorker;
2518
2532
  });
2519
2533
  // IExecuteRunnerActionResult[]
2520
- __privateAdd(this, _HandleAllWorkers, async (action, options) => {
2521
- const promises = Object.values(this.WorkersEx).map(async (worker) => {
2534
+ __privateAdd(this, _HandleAllWorkers, (action, options) => {
2535
+ const retVal = Object.values(this.WorkersEx).map((worker) => {
2522
2536
  if (action === "UpdateOptions") {
2523
2537
  return {
2524
2538
  workerManagerId: __privateGet(this, _id),
2525
2539
  workerId: worker.id,
2526
- executeRunnerActionResults: await worker[action](options)
2540
+ executeRunnerActionResults: worker[action](options)
2527
2541
  };
2528
2542
  } else {
2529
2543
  return {
2530
2544
  workerManagerId: __privateGet(this, _id),
2531
2545
  workerId: worker.id,
2532
- executeRunnerActionResults: await worker[action]()
2546
+ executeRunnerActionResults: worker[action]()
2533
2547
  };
2534
2548
  }
2535
2549
  });
2536
- return Promise.all(promises);
2550
+ return retVal;
2537
2551
  });
2538
- __publicField(this, "StartAllWorkers", async () => {
2552
+ __publicField(this, "StartAllWorkers", () => {
2539
2553
  return __privateGet(this, _HandleAllWorkers).call(this, "Start");
2540
2554
  });
2541
2555
  __publicField(this, "StopAllWorkers", () => {
@@ -2544,19 +2558,19 @@ class STSWorkerManager {
2544
2558
  __publicField(this, "PauseAllWorkers", () => {
2545
2559
  return __privateGet(this, _HandleAllWorkers).call(this, "Pause");
2546
2560
  });
2547
- __publicField(this, "ResumeAllWorkers", async () => {
2561
+ __publicField(this, "ResumeAllWorkers", () => {
2548
2562
  return __privateGet(this, _HandleAllWorkers).call(this, "Resume");
2549
2563
  });
2550
- __publicField(this, "ExecuteAllWorkers", async () => {
2564
+ __publicField(this, "ExecuteAllWorkers", () => {
2551
2565
  return __privateGet(this, _HandleAllWorkers).call(this, "Execute");
2552
2566
  });
2553
- __publicField(this, "ResetAllWorkers", async () => {
2567
+ __publicField(this, "ResetAllWorkers", () => {
2554
2568
  return __privateGet(this, _HandleAllWorkers).call(this, "Reset");
2555
2569
  });
2556
- __publicField(this, "TerminateAllWorkers", async () => {
2570
+ __publicField(this, "TerminateAllWorkers", () => {
2557
2571
  return __privateGet(this, _HandleAllWorkers).call(this, "Terminate");
2558
2572
  });
2559
- __publicField(this, "UpdateAllWorkers", async (options) => {
2573
+ __publicField(this, "UpdateAllWorkers", (options) => {
2560
2574
  return __privateGet(this, _HandleAllWorkers).call(this, "UpdateOptions", options);
2561
2575
  });
2562
2576
  __privateSet(this, _id, v4());
@@ -2606,19 +2620,9 @@ class STSWorkerManager {
2606
2620
  get id() {
2607
2621
  return __privateGet(this, _id);
2608
2622
  }
2609
- get Workers() {
2610
- const retVal = {};
2611
- for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
2612
- retVal[workerEx.id] = this.CreateWorkerCopy(workerEx);
2613
- }
2614
- return retVal;
2615
- }
2616
2623
  get WorkersEx() {
2617
2624
  return __privateGet(this, _workersEx);
2618
2625
  }
2619
- get archiveList() {
2620
- return __privateGet(this, _archiveList);
2621
- }
2622
2626
  get Options() {
2623
2627
  return __privateGet(this, _options2);
2624
2628
  }