@nsshunt/stsrunnerframework 1.0.82 → 1.0.84

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, _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;
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, _StopRunnerByRunnerId, _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 = "/";
@@ -1538,25 +1538,30 @@ class WorkerInstance {
1538
1538
  }
1539
1539
  });
1540
1540
  __privateAdd(this, _processLoopExecutor, async () => {
1541
- const removeList = [];
1542
- const promArray = [];
1543
- for (const [, runner] of Object.entries(__privateGet(this, _runners))) {
1544
- if (runner.runner.state === IRunnerState.completed || runner.runner.state === IRunnerState.error || runner.runner.state === IRunnerState.stopped || runner.runner.state === IRunnerState.terminated) {
1545
- promArray.push(__privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.RemoveRunnerFromCollection, runner.runner.id));
1546
- removeList.push(runner.runner.id);
1547
- }
1548
- }
1549
- if (promArray.length > 0) {
1550
- await Promise.all(promArray);
1551
- setTimeout(() => {
1552
- __privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Removing runners from collection: [${removeList}]`));
1553
- for (let i = 0; i < removeList.length; i++) {
1554
- delete __privateGet(this, _runners)[removeList[i]];
1541
+ try {
1542
+ const removeList = [];
1543
+ const promArray = [];
1544
+ for (const [, runner] of Object.entries(__privateGet(this, _runners))) {
1545
+ if (runner.runner.state === IRunnerState.completed || runner.runner.state === IRunnerState.error || runner.runner.state === IRunnerState.stopped || runner.runner.state === IRunnerState.terminated) {
1546
+ promArray.push(__privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.RemoveRunnerFromCollection, runner.runner.id));
1547
+ removeList.push(runner.runner.id);
1555
1548
  }
1556
- __privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Remaining Runner Count: [${Object.keys(__privateGet(this, _runners)).length}]`));
1549
+ }
1550
+ if (promArray.length > 0) {
1551
+ await Promise.all(promArray);
1552
+ setTimeout(() => {
1553
+ __privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Removing runners from collection: [${removeList}]`));
1554
+ for (let i = 0; i < removeList.length; i++) {
1555
+ delete __privateGet(this, _runners)[removeList[i]];
1556
+ }
1557
+ __privateGet(this, _debug).call(this, chalk.grey(`WorkerInstance:#processLoopExecutor(): Remaining Runner Count: [${Object.keys(__privateGet(this, _runners)).length}]`));
1558
+ setTimeout(__privateGet(this, _processLoopExecutor), 1e3);
1559
+ }, 100);
1560
+ } else {
1557
1561
  setTimeout(__privateGet(this, _processLoopExecutor), 1e3);
1558
- }, 100);
1559
- } else {
1562
+ }
1563
+ } catch (error) {
1564
+ console.error(`#processLoopExecutor(): [${error}]`);
1560
1565
  setTimeout(__privateGet(this, _processLoopExecutor), 1e3);
1561
1566
  }
1562
1567
  });
@@ -1572,200 +1577,369 @@ class WorkerInstance {
1572
1577
  __privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.InstrumentTelemetry, id);
1573
1578
  });
1574
1579
  __privateAdd(this, _SetMessagePort, (workerMessagePort) => {
1575
- __privateGet(this, _debug).call(this, `SetMessagePort`);
1576
- __privateSet(this, _collectorCollectorPort, workerMessagePort.port);
1577
- if (isNode) {
1578
- __privateGet(this, _collectorCollectorPort).on("message", (data) => {
1579
- __privateGet(this, _debug).call(this, `collectorCollectorPort onmessage: ${JSON.stringify(data)}`);
1580
- });
1581
- } else {
1582
- __privateGet(this, _collectorCollectorPort).onmessage = function(data) {
1583
- __privateGet(this, _debug).call(this, `collectorCollectorPort onmessage: ${JSON.stringify(data.data)}`);
1580
+ try {
1581
+ __privateGet(this, _debug).call(this, `SetMessagePort`);
1582
+ __privateSet(this, _collectorCollectorPort, workerMessagePort.port);
1583
+ if (isNode) {
1584
+ __privateGet(this, _collectorCollectorPort).on("message", (data) => {
1585
+ __privateGet(this, _debug).call(this, `collectorCollectorPort onmessage: ${JSON.stringify(data)}`);
1586
+ });
1587
+ } else {
1588
+ __privateGet(this, _collectorCollectorPort).onmessage = function(data) {
1589
+ __privateGet(this, _debug).call(this, `collectorCollectorPort onmessage: ${JSON.stringify(data.data)}`);
1590
+ };
1591
+ }
1592
+ const response = {
1593
+ command: eIWMessageCommands.MessagePortResponse,
1594
+ payload: {}
1584
1595
  };
1596
+ __privateGet(this, _collectorCollectorPort).postMessage(response);
1597
+ } catch (error) {
1598
+ console.error(`#SetMessagePort(): [${error}]`);
1585
1599
  }
1586
- const response = {
1587
- command: eIWMessageCommands.MessagePortResponse,
1588
- payload: {}
1589
- };
1590
- __privateGet(this, _collectorCollectorPort).postMessage(response);
1591
1600
  });
1592
1601
  __publicField(this, "CreateAsyncRunner", (testRunnerTelemetryPayload) => {
1593
1602
  return null;
1594
1603
  });
1595
1604
  __privateAdd(this, _CreateRunnerEx2RunState, async (runner, runnerInstance) => {
1596
- __privateGet(this, _runners)[runner.id] = {
1597
- runner,
1598
- runnerInstance
1599
- };
1600
- __privateGet(this, _runners)[runner.id].runner.iteration = 0;
1601
- __privateGet(this, _UpdateRunnerStateById).call(this, runner.id, IRunnerState.created);
1605
+ try {
1606
+ __privateGet(this, _runners)[runner.id] = {
1607
+ runner,
1608
+ runnerInstance
1609
+ };
1610
+ __privateGet(this, _runners)[runner.id].runner.iteration = 0;
1611
+ __privateGet(this, _UpdateRunnerStateById).call(this, runner.id, IRunnerState.created);
1612
+ } catch (error) {
1613
+ console.error(`#CreateRunnerEx2RunState(): [${error}]`);
1614
+ }
1602
1615
  });
1603
1616
  __privateAdd(this, _UpdateRunnerStateById, (id, state) => {
1604
- __privateGet(this, _runners)[id].runner.state = state;
1605
- __privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.RunnerStateChange, id);
1617
+ try {
1618
+ if (__privateGet(this, _runners)[id]) {
1619
+ __privateGet(this, _runners)[id].runner.state = state;
1620
+ __privateGet(this, _PostMessageToWorkerManagerById).call(this, eIWMessageCommands.RunnerStateChange, id);
1621
+ } else {
1622
+ console.warn(`#UpdateRunnerStateById(): Runner ID: [${id}] not found`);
1623
+ }
1624
+ } catch (error) {
1625
+ console.error(`#UpdateRunnerStateById(): [${error}]`);
1626
+ }
1606
1627
  });
1607
1628
  __privateAdd(this, _GetAllRunners, () => {
1608
1629
  return __privateGet(this, _runners);
1609
1630
  });
1631
+ // If an error occurs or the runner does not exist, treat as cannot execute next iteration
1610
1632
  __privateAdd(this, _CanExecuteNextIterationById, (id) => {
1611
- const state = __privateGet(this, _runners)[id].runner.state;
1612
- if (state === IRunnerState.running) {
1613
- return true;
1633
+ try {
1634
+ if (__privateGet(this, _runners)[id]) {
1635
+ const state = __privateGet(this, _runners)[id].runner.state;
1636
+ if (state === IRunnerState.running) {
1637
+ return true;
1638
+ }
1639
+ return false;
1640
+ } else {
1641
+ console.warn(`#CanExecuteNextIterationById(): Runner ID: [${id}] not found`);
1642
+ return false;
1643
+ }
1644
+ } catch (error) {
1645
+ console.error(`#CanExecuteNextIterationById(): [${error}]`);
1646
+ return false;
1614
1647
  }
1615
- return false;
1616
1648
  });
1649
+ // If an error occurs or the runner does not exist, treat as completed.
1617
1650
  __privateAdd(this, _IsCompletedById, (id) => {
1618
- const state = __privateGet(this, _runners)[id].runner.state;
1619
- if (state === IRunnerState.error || state === IRunnerState.completed || state === IRunnerState.stopped || state === IRunnerState.terminated) {
1651
+ try {
1652
+ if (__privateGet(this, _runners)[id]) {
1653
+ const state = __privateGet(this, _runners)[id].runner.state;
1654
+ if (state === IRunnerState.error || state === IRunnerState.completed || state === IRunnerState.stopped || state === IRunnerState.terminated) {
1655
+ return true;
1656
+ }
1657
+ return false;
1658
+ } else {
1659
+ console.warn(`#IsCompletedById(): Runner ID: [${id}] not found`);
1660
+ return true;
1661
+ }
1662
+ } catch (error) {
1663
+ console.error(`#IsCompletedById(): [${error}]`);
1620
1664
  return true;
1621
1665
  }
1622
- return false;
1623
1666
  });
1624
1667
  __privateAdd(this, _GetRunnerIterationById, (id) => {
1625
- return __privateGet(this, _runners)[id].runner.iteration;
1668
+ try {
1669
+ if (__privateGet(this, _runners)[id]) {
1670
+ return __privateGet(this, _runners)[id].runner.iteration;
1671
+ } else {
1672
+ console.warn(`#GetRunnerIterationById(): Runner ID: [${id}] not found`);
1673
+ return 0;
1674
+ }
1675
+ } catch (error) {
1676
+ console.error(`#GetRunnerIterationById(): [${error}]`);
1677
+ return 0;
1678
+ }
1626
1679
  });
1627
1680
  __privateAdd(this, _ResetRunnerIterationById, (id) => {
1628
- __privateGet(this, _runners)[id].runner.iteration = 0;
1629
- return 0;
1681
+ try {
1682
+ if (__privateGet(this, _runners)[id]) {
1683
+ __privateGet(this, _runners)[id].runner.iteration = 0;
1684
+ return 0;
1685
+ } else {
1686
+ console.warn(`#ResetRunnerIterationById(): Runner ID: [${id}] not found`);
1687
+ return 0;
1688
+ }
1689
+ } catch (error) {
1690
+ console.error(`#ResetRunnerIterationById(): [${error}]`);
1691
+ return 0;
1692
+ }
1630
1693
  });
1631
1694
  __privateAdd(this, _IncRunnerIterationById, (id) => {
1632
- __privateGet(this, _runners)[id].runner.iteration++;
1633
- return __privateGet(this, _runners)[id].runner.iteration;
1695
+ try {
1696
+ if (__privateGet(this, _runners)[id]) {
1697
+ __privateGet(this, _runners)[id].runner.iteration++;
1698
+ return __privateGet(this, _runners)[id].runner.iteration;
1699
+ } else {
1700
+ console.warn(`#IncRunnerIterationById(): Runner ID: [${id}] not found`);
1701
+ return 0;
1702
+ }
1703
+ } catch (error) {
1704
+ console.error(`#IncRunnerIterationById(): [${error}]`);
1705
+ return 0;
1706
+ }
1634
1707
  });
1635
1708
  __privateAdd(this, _GetRunnerInstanceById, (id) => {
1636
- return __privateGet(this, _runners)[id].runnerInstance;
1709
+ try {
1710
+ if (__privateGet(this, _runners)[id]) {
1711
+ return __privateGet(this, _runners)[id].runnerInstance;
1712
+ } else {
1713
+ console.warn(`#GetRunnerInstanceById(): Runner ID: [${id}] not found`);
1714
+ }
1715
+ } catch (error) {
1716
+ console.error(`#GetRunnerInstanceById(): [${error}]`);
1717
+ }
1637
1718
  });
1638
1719
  __privateAdd(this, _GetRunnerExecutionProfileById, (id) => {
1639
- return __privateGet(this, _runners)[id].runner.options.executionProfile;
1720
+ try {
1721
+ if (__privateGet(this, _runners)[id]) {
1722
+ return __privateGet(this, _runners)[id].runner.options.executionProfile;
1723
+ } else {
1724
+ console.warn(`#GetRunnerExecutionProfileById(): Runner ID: [${id}] not found`);
1725
+ }
1726
+ } catch (error) {
1727
+ console.error(`#GetRunnerExecutionProfileById(): [${error}]`);
1728
+ }
1640
1729
  });
1641
1730
  __privateAdd(this, _GetRunnerOptionsById, (id) => {
1642
- return __privateGet(this, _runners)[id].runner.options;
1731
+ try {
1732
+ if (__privateGet(this, _runners)[id]) {
1733
+ return __privateGet(this, _runners)[id].runner.options;
1734
+ } else {
1735
+ console.warn(`#GetRunnerOptionsById(): Runner ID: [${id}] not found`);
1736
+ }
1737
+ } catch (error) {
1738
+ console.error(`#GetRunnerOptionsById(): [${error}]`);
1739
+ }
1643
1740
  });
1644
1741
  __privateAdd(this, _SetRunnerOptionsById, (id, options) => {
1645
- __privateGet(this, _runners)[id].runner.options = { ...options };
1646
- return __privateGet(this, _runners)[id].runner.options;
1742
+ try {
1743
+ if (__privateGet(this, _runners)[id]) {
1744
+ __privateGet(this, _runners)[id].runner.options = { ...options };
1745
+ return __privateGet(this, _runners)[id].runner.options;
1746
+ } else {
1747
+ console.warn(`#SetRunnerOptionsById(): Runner ID: [${id}] not found`);
1748
+ }
1749
+ } catch (error) {
1750
+ console.error(`#SetRunnerOptionsById(): [${error}]`);
1751
+ }
1647
1752
  });
1648
1753
  __privateAdd(this, _AddRunner, (testRunnerTelemetryPayload) => {
1649
- __privateGet(this, _debug).call(this, `AddRunner`);
1650
- const { runner } = testRunnerTelemetryPayload;
1651
- const asyncRunnerInstance = this.CreateAsyncRunner(testRunnerTelemetryPayload);
1652
- if (asyncRunnerInstance) {
1653
- __privateGet(this, _CreateRunnerEx2RunState).call(this, runner, asyncRunnerInstance);
1754
+ try {
1755
+ const { runner } = testRunnerTelemetryPayload;
1756
+ const asyncRunnerInstance = this.CreateAsyncRunner(testRunnerTelemetryPayload);
1757
+ if (asyncRunnerInstance) {
1758
+ __privateGet(this, _CreateRunnerEx2RunState).call(this, runner, asyncRunnerInstance);
1759
+ } else {
1760
+ console.warn(`#AddRunner(): CreateAsyncRunner not defined.`);
1761
+ }
1762
+ return runner;
1763
+ } catch (error) {
1764
+ console.error(`#AddRunner(): [${error}]`);
1654
1765
  }
1655
- return runner;
1656
1766
  });
1657
1767
  __privateAdd(this, _PostMessageToWorkerManagerById, async (command, id) => {
1658
- if (__privateGet(this, _collectorCollectorPort)) {
1659
- if (__privateGet(this, _runners)[id]) {
1660
- const message = {
1661
- command,
1662
- payload: {
1663
- runner: __privateGet(this, _runners)[id].runner
1664
- }
1665
- };
1666
- __privateGet(this, _collectorCollectorPort).postMessage(message);
1667
- await Sleep(0);
1768
+ try {
1769
+ if (__privateGet(this, _collectorCollectorPort)) {
1770
+ if (__privateGet(this, _runners)[id]) {
1771
+ const message = {
1772
+ command,
1773
+ payload: {
1774
+ runner: __privateGet(this, _runners)[id].runner
1775
+ }
1776
+ };
1777
+ __privateGet(this, _collectorCollectorPort).postMessage(message);
1778
+ await Sleep(0);
1779
+ }
1668
1780
  }
1781
+ } catch (error) {
1782
+ console.error(`#PostMessageToWorkerManagerById(): [${error}]`);
1669
1783
  }
1670
1784
  });
1671
1785
  __privateAdd(this, _StartRunner, async (testRunnerTelemetryPayload) => {
1672
- const runnerId = testRunnerTelemetryPayload.runner.id;
1673
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} StartRunner`);
1674
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).StartRunner();
1675
- __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
1676
- const startLoop = /* @__PURE__ */ new Date();
1677
- const ExecuteLoop = async () => {
1678
- let cont = true;
1679
- const { iterations, duration, delayBetweenIterations } = __privateGet(this, _GetRunnerExecutionProfileById).call(this, runnerId);
1680
- if (iterations > 0) {
1681
- cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) < iterations;
1682
- } else if (duration > 0) {
1683
- cont = ((/* @__PURE__ */ new Date()).getTime() - startLoop.getTime()) / 1e3 < duration;
1684
- }
1685
- if (cont) {
1686
- if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
1687
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).Execute(__privateGet(this, _GetRunnerIterationById).call(this, runnerId));
1688
- __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
1689
- }
1690
- if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
1691
- if (delayBetweenIterations > 0) {
1692
- await Sleep(delayBetweenIterations);
1786
+ var _a;
1787
+ try {
1788
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1789
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} StartRunner`);
1790
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.StartRunner());
1791
+ __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
1792
+ const startLoop = /* @__PURE__ */ new Date();
1793
+ const ExecuteLoop = async () => {
1794
+ var _a2, _b;
1795
+ try {
1796
+ let cont = true;
1797
+ const executionProfile = __privateGet(this, _GetRunnerExecutionProfileById).call(this, runnerId);
1798
+ if (executionProfile) {
1799
+ const { iterations, duration, delayBetweenIterations } = executionProfile;
1800
+ if (iterations > 0) {
1801
+ cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) < iterations;
1802
+ } else if (duration > 0) {
1803
+ cont = ((/* @__PURE__ */ new Date()).getTime() - startLoop.getTime()) / 1e3 < duration;
1804
+ }
1805
+ if (cont) {
1806
+ if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
1807
+ await ((_a2 = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a2.Execute(__privateGet(this, _GetRunnerIterationById).call(this, runnerId)));
1808
+ if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
1809
+ __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
1810
+ }
1811
+ }
1812
+ if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
1813
+ if (delayBetweenIterations > 0) {
1814
+ await Sleep(delayBetweenIterations);
1815
+ } else {
1816
+ await __privateMethod(this, _WorkerInstance_instances, SleepImmediate_fn).call(this);
1817
+ }
1818
+ ExecuteLoop();
1819
+ } else {
1820
+ if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
1821
+ await Sleep(50);
1822
+ ExecuteLoop();
1823
+ }
1824
+ }
1825
+ } else {
1826
+ await ((_b = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _b.Completed());
1827
+ __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
1828
+ }
1693
1829
  } else {
1694
- await __privateMethod(this, _WorkerInstance_instances, SleepImmediate_fn).call(this);
1695
- }
1696
- ExecuteLoop();
1697
- } else {
1698
- if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
1699
- await Sleep(50);
1700
- ExecuteLoop();
1830
+ console.warn(`#StartRunner:ExecuteLoop(): Cannot get execution profile for runner: [${runnerId}]`);
1701
1831
  }
1832
+ } catch (error) {
1833
+ console.error(`#StartRunner:ExecuteLoop(): Error: [${error}]`);
1702
1834
  }
1703
- } else {
1704
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).Completed();
1705
- __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
1706
- }
1707
- };
1708
- ExecuteLoop();
1835
+ };
1836
+ ExecuteLoop();
1837
+ } catch (error) {
1838
+ console.error(`#StartRunner(): Error: [${error}]`);
1839
+ }
1709
1840
  });
1710
- __privateAdd(this, _StopRunnerByRunnerById, async (id) => {
1711
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${id}]`)} StopRunner`);
1712
- await __privateGet(this, _GetRunnerInstanceById).call(this, id).StopRunner();
1713
- await __privateGet(this, _UpdateRunnerStateById).call(this, id, IRunnerState.stopped);
1841
+ __privateAdd(this, _StopRunnerByRunnerId, async (id) => {
1842
+ var _a;
1843
+ try {
1844
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${id}]`)} StopRunner`);
1845
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, id)) == null ? void 0 : _a.StopRunner());
1846
+ await __privateGet(this, _UpdateRunnerStateById).call(this, id, IRunnerState.stopped);
1847
+ } catch (error) {
1848
+ console.error(`#StopRunnerByRunnerId(): Error: [${error}]`);
1849
+ }
1714
1850
  });
1715
1851
  __privateAdd(this, _StopAllRunners, async (testRunnerTelemetryPayload) => {
1716
- __privateGet(this, _debug).call(this, `StopAllRunners`);
1717
- const promArray = [];
1718
- for (const [, runner] of Object.entries(__privateGet(this, _GetAllRunners))) {
1719
- promArray.push(__privateGet(this, _StopRunnerByRunnerById).call(this, runner.id));
1852
+ try {
1853
+ __privateGet(this, _debug).call(this, `StopAllRunners`);
1854
+ const promArray = [];
1855
+ for (const [, runner] of Object.entries(__privateGet(this, _GetAllRunners))) {
1856
+ promArray.push(__privateGet(this, _StopRunnerByRunnerId).call(this, runner.id));
1857
+ }
1858
+ await Promise.all(promArray);
1859
+ await Sleep(0);
1860
+ } catch (error) {
1861
+ console.error(`#StopAllRunners(): Error: [${error}]`);
1720
1862
  }
1721
- await Promise.all(promArray);
1722
- await Sleep(0);
1723
1863
  });
1724
1864
  __privateAdd(this, _StopRunner, async (testRunnerTelemetryPayload) => {
1725
- await __privateGet(this, _StopRunnerByRunnerById).call(this, testRunnerTelemetryPayload.runner.id);
1865
+ try {
1866
+ await __privateGet(this, _StopRunnerByRunnerId).call(this, testRunnerTelemetryPayload.runner.id);
1867
+ } catch (error) {
1868
+ console.error(`#StopRunner(): Error: [${error}]`);
1869
+ }
1726
1870
  });
1727
1871
  __privateAdd(this, _TerminateRunner, async (testRunnerTelemetryPayload) => {
1728
- const runnerId = testRunnerTelemetryPayload.runner.id;
1729
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} TerminateRunner`);
1730
- const retVal = await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).TerminateRunner();
1731
- await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.terminated);
1732
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} TerminateRunner Result = [${retVal}]`);
1872
+ var _a;
1873
+ try {
1874
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1875
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} TerminateRunner`);
1876
+ const retVal = await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.TerminateRunner());
1877
+ await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.terminated);
1878
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} TerminateRunner Result = [${retVal}]`);
1879
+ } catch (error) {
1880
+ console.error(`#TerminateRunner(): Error: [${error}]`);
1881
+ }
1733
1882
  });
1734
1883
  __privateAdd(this, _PauseRunner, async (testRunnerTelemetryPayload) => {
1735
- const runnerId = testRunnerTelemetryPayload.runner.id;
1736
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} PauseRunner`);
1737
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).PauseRunner();
1738
- await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1884
+ var _a;
1885
+ try {
1886
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1887
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} PauseRunner`);
1888
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.PauseRunner());
1889
+ await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1890
+ } catch (error) {
1891
+ console.error(`#PauseRunner(): Error: [${error}]`);
1892
+ }
1739
1893
  });
1740
1894
  __privateAdd(this, _ResumeRunner, async (testRunnerTelemetryPayload) => {
1741
- const runnerId = testRunnerTelemetryPayload.runner.id;
1742
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ResumeRunner`);
1743
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).ResumeRunner();
1744
- await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
1895
+ var _a;
1896
+ try {
1897
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1898
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ResumeRunner`);
1899
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.ResumeRunner());
1900
+ await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
1901
+ } catch (error) {
1902
+ console.error(`#ResumeRunner(): Error: [${error}]`);
1903
+ }
1745
1904
  });
1746
1905
  __privateAdd(this, _ResetRunner, async (testRunnerTelemetryPayload) => {
1747
- const runnerId = testRunnerTelemetryPayload.runner.id;
1748
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ResetRunner`);
1749
- __privateGet(this, _ResetRunnerIterationById).call(this, runnerId);
1750
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).ResetRunner();
1751
- await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1906
+ var _a;
1907
+ try {
1908
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1909
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ResetRunner`);
1910
+ __privateGet(this, _ResetRunnerIterationById).call(this, runnerId);
1911
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.ResetRunner());
1912
+ await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1913
+ } catch (error) {
1914
+ console.error(`#ResetRunner(): Error: [${error}]`);
1915
+ }
1752
1916
  });
1753
1917
  // Execute a single iteration of this runners work item
1754
1918
  __privateAdd(this, _ExecuteRunner, async (testRunnerTelemetryPayload) => {
1755
- const runnerId = testRunnerTelemetryPayload.runner.id;
1756
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ExecuteRunner`);
1757
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).Execute(__privateGet(this, _GetRunnerIterationById).call(this, runnerId));
1758
- __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
1759
- await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1919
+ var _a;
1920
+ try {
1921
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1922
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ExecuteRunner`);
1923
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.Execute(__privateGet(this, _GetRunnerIterationById).call(this, runnerId)));
1924
+ __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
1925
+ await __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1926
+ } catch (error) {
1927
+ console.error(`#ExecuteRunner(): Error: [${error}]`);
1928
+ }
1760
1929
  });
1761
1930
  __privateAdd(this, _UpdateOptions, async (testRunnerTelemetryPayload) => {
1762
- const runnerId = testRunnerTelemetryPayload.runner.id;
1763
- __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} UpdateOptions`);
1764
- __privateGet(this, _debug).call(this, chalk.cyan(`before: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
1765
- __privateGet(this, _SetRunnerOptionsById).call(this, runnerId, testRunnerTelemetryPayload.runner.options);
1766
- __privateGet(this, _debug).call(this, chalk.cyan(`after: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
1767
- await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).UpdateOptions();
1768
- await Sleep(0);
1931
+ var _a;
1932
+ try {
1933
+ const runnerId = testRunnerTelemetryPayload.runner.id;
1934
+ __privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} UpdateOptions`);
1935
+ __privateGet(this, _debug).call(this, chalk.cyan(`before: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
1936
+ __privateGet(this, _SetRunnerOptionsById).call(this, runnerId, testRunnerTelemetryPayload.runner.options);
1937
+ __privateGet(this, _debug).call(this, chalk.cyan(`after: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
1938
+ await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.UpdateOptions());
1939
+ await Sleep(0);
1940
+ } catch (error) {
1941
+ console.error(`#UpdateOptions(): Error: [${error}]`);
1942
+ }
1769
1943
  });
1770
1944
  // ProcessMessage = async(data: MessageEvent) => { // Browser version
1771
1945
  __publicField(this, "ProcessMessage", async (data) => {
@@ -1824,6 +1998,7 @@ class WorkerInstance {
1824
1998
  __privateGet(this, _debug).call(this, `Invalid payloadMessage.command: [${payloadMessage.command}] - Ignoring`);
1825
1999
  }
1826
2000
  } catch (error) {
2001
+ console.error(`ProcessMessage(): Error: [${error}]`);
1827
2002
  __privateGet(this, _error).call(this, error);
1828
2003
  }
1829
2004
  });
@@ -1866,7 +2041,7 @@ SleepImmediate_fn = function() {
1866
2041
  };
1867
2042
  _PostMessageToWorkerManagerById = new WeakMap();
1868
2043
  _StartRunner = new WeakMap();
1869
- _StopRunnerByRunnerById = new WeakMap();
2044
+ _StopRunnerByRunnerId = new WeakMap();
1870
2045
  _StopAllRunners = new WeakMap();
1871
2046
  _StopRunner = new WeakMap();
1872
2047
  _TerminateRunner = new WeakMap();