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