@nsshunt/stsrunnerframework 1.0.102 → 1.0.104
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.
|
@@ -1770,6 +1770,8 @@ class WorkerInstance {
|
|
|
1770
1770
|
};
|
|
1771
1771
|
__privateGet(this, _collectorCollectorPort).postMessage(message);
|
|
1772
1772
|
await Sleep(0);
|
|
1773
|
+
} else {
|
|
1774
|
+
__privateGet(this, _warn).call(this, `#PostMessageToWorkerManagerById(): Runner: [${runnerId}] not found`);
|
|
1773
1775
|
}
|
|
1774
1776
|
}
|
|
1775
1777
|
} catch (error) {
|
|
@@ -1798,54 +1800,61 @@ class WorkerInstance {
|
|
|
1798
1800
|
var _a;
|
|
1799
1801
|
try {
|
|
1800
1802
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1801
|
-
__privateGet(this,
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
await ((_a2 = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a2.Execute());
|
|
1820
|
-
if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
|
|
1821
|
-
__privateGet(this, _IncRunnerIterationById).call(this, runnerId);
|
|
1803
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1804
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1805
|
+
if (state === IRunnerState.created) {
|
|
1806
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.StartRunner());
|
|
1807
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
|
|
1808
|
+
await Sleep(0);
|
|
1809
|
+
const startLoop = /* @__PURE__ */ new Date();
|
|
1810
|
+
const ExecuteLoop = async () => {
|
|
1811
|
+
var _a2, _b;
|
|
1812
|
+
try {
|
|
1813
|
+
let cont = true;
|
|
1814
|
+
const executionProfile = __privateGet(this, _GetRunnerExecutionProfileById).call(this, runnerId);
|
|
1815
|
+
if (executionProfile) {
|
|
1816
|
+
const { iterations, duration, delayBetweenIterations } = executionProfile;
|
|
1817
|
+
if (iterations > 0) {
|
|
1818
|
+
cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) < iterations;
|
|
1819
|
+
} else if (duration > 0) {
|
|
1820
|
+
cont = ((/* @__PURE__ */ new Date()).getTime() - startLoop.getTime()) / 1e3 < duration;
|
|
1822
1821
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1822
|
+
if (cont) {
|
|
1823
|
+
if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
|
|
1824
|
+
await ((_a2 = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a2.Execute());
|
|
1825
|
+
if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
|
|
1826
|
+
__privateGet(this, _IncRunnerIterationById).call(this, runnerId);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
if (__privateGet(this, _CanExecuteNextIterationById).call(this, runnerId)) {
|
|
1830
|
+
if (delayBetweenIterations > 0) {
|
|
1831
|
+
await Sleep(delayBetweenIterations);
|
|
1832
|
+
} else {
|
|
1833
|
+
await __privateMethod(this, _WorkerInstance_instances, SleepImmediate_fn).call(this);
|
|
1834
|
+
}
|
|
1835
|
+
ExecuteLoop();
|
|
1836
|
+
} else {
|
|
1837
|
+
if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
|
|
1838
|
+
await Sleep(50);
|
|
1839
|
+
ExecuteLoop();
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1827
1842
|
} else {
|
|
1828
|
-
await
|
|
1843
|
+
await ((_b = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _b.Completed());
|
|
1844
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
|
|
1829
1845
|
}
|
|
1830
|
-
ExecuteLoop();
|
|
1831
1846
|
} else {
|
|
1832
|
-
|
|
1833
|
-
await Sleep(50);
|
|
1834
|
-
ExecuteLoop();
|
|
1835
|
-
}
|
|
1847
|
+
__privateGet(this, _warn).call(this, `#StartRunner:ExecuteLoop(): Cannot get execution profile for runner: [${runnerId}]`);
|
|
1836
1848
|
}
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
|
|
1849
|
+
} catch (error) {
|
|
1850
|
+
__privateGet(this, _error).call(this, `#StartRunner:ExecuteLoop(): Error: [${error}]`);
|
|
1840
1851
|
}
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1844
|
-
} catch (error) {
|
|
1845
|
-
__privateGet(this, _error).call(this, `#StartRunner:ExecuteLoop(): Error: [${error}]`);
|
|
1852
|
+
};
|
|
1853
|
+
ExecuteLoop();
|
|
1846
1854
|
}
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1855
|
+
} else {
|
|
1856
|
+
__privateGet(this, _warn).call(this, `#StartRunner(): Runner: [${runnerId}] not found`);
|
|
1857
|
+
}
|
|
1849
1858
|
} catch (error) {
|
|
1850
1859
|
__privateGet(this, _error).call(this, `#StartRunner(): Error: [${error}]`);
|
|
1851
1860
|
}
|
|
@@ -1853,22 +1862,26 @@ class WorkerInstance {
|
|
|
1853
1862
|
__privateAdd(this, _StopRunnerByRunnerId, async (id) => {
|
|
1854
1863
|
var _a;
|
|
1855
1864
|
try {
|
|
1856
|
-
__privateGet(this,
|
|
1857
|
-
|
|
1858
|
-
|
|
1865
|
+
if (__privateGet(this, _runners)[id]) {
|
|
1866
|
+
const { state } = __privateGet(this, _runners)[id].runner;
|
|
1867
|
+
if (state === IRunnerState.paused || state === IRunnerState.running) {
|
|
1868
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, id)) == null ? void 0 : _a.StopRunner());
|
|
1869
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, id, IRunnerState.stopped);
|
|
1870
|
+
}
|
|
1871
|
+
} else {
|
|
1872
|
+
__privateGet(this, _warn).call(this, `#StopRunnerByRunnerId(): Runner: [${id}] not found`);
|
|
1873
|
+
}
|
|
1859
1874
|
} catch (error) {
|
|
1860
1875
|
__privateGet(this, _error).call(this, `#StopRunnerByRunnerId(): Error: [${error}]`);
|
|
1861
1876
|
}
|
|
1862
1877
|
});
|
|
1863
1878
|
__privateAdd(this, _StopAllRunners, async (testRunnerTelemetryPayload) => {
|
|
1864
1879
|
try {
|
|
1865
|
-
__privateGet(this, _debug).call(this, `StopAllRunners`);
|
|
1866
1880
|
const promArray = [];
|
|
1867
1881
|
for (const [, runner] of Object.entries(__privateGet(this, _GetAllRunners))) {
|
|
1868
1882
|
promArray.push(__privateGet(this, _StopRunnerByRunnerId).call(this, runner.id));
|
|
1869
1883
|
}
|
|
1870
1884
|
await Promise.all(promArray);
|
|
1871
|
-
await Sleep(0);
|
|
1872
1885
|
} catch (error) {
|
|
1873
1886
|
__privateGet(this, _error).call(this, `#StopAllRunners(): Error: [${error}]`);
|
|
1874
1887
|
}
|
|
@@ -1884,10 +1897,15 @@ class WorkerInstance {
|
|
|
1884
1897
|
var _a;
|
|
1885
1898
|
try {
|
|
1886
1899
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1887
|
-
__privateGet(this,
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1900
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1901
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1902
|
+
if (state === IRunnerState.created || state === IRunnerState.paused || state === IRunnerState.running) {
|
|
1903
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.TerminateRunner());
|
|
1904
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.terminated);
|
|
1905
|
+
}
|
|
1906
|
+
} else {
|
|
1907
|
+
__privateGet(this, _warn).call(this, `#TerminateRunner(): Runner: [${runnerId}] not found`);
|
|
1908
|
+
}
|
|
1891
1909
|
} catch (error) {
|
|
1892
1910
|
__privateGet(this, _error).call(this, `#TerminateRunner(): Error: [${error}]`);
|
|
1893
1911
|
}
|
|
@@ -1896,9 +1914,15 @@ class WorkerInstance {
|
|
|
1896
1914
|
var _a;
|
|
1897
1915
|
try {
|
|
1898
1916
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1899
|
-
__privateGet(this,
|
|
1900
|
-
|
|
1901
|
-
|
|
1917
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1918
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1919
|
+
if (state === IRunnerState.running) {
|
|
1920
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.PauseRunner());
|
|
1921
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
|
|
1922
|
+
}
|
|
1923
|
+
} else {
|
|
1924
|
+
__privateGet(this, _warn).call(this, `#PauseRunner(): Runner: [${runnerId}] not found`);
|
|
1925
|
+
}
|
|
1902
1926
|
} catch (error) {
|
|
1903
1927
|
__privateGet(this, _error).call(this, `#PauseRunner(): Error: [${error}]`);
|
|
1904
1928
|
}
|
|
@@ -1907,9 +1931,15 @@ class WorkerInstance {
|
|
|
1907
1931
|
var _a;
|
|
1908
1932
|
try {
|
|
1909
1933
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1910
|
-
__privateGet(this,
|
|
1911
|
-
|
|
1912
|
-
|
|
1934
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1935
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1936
|
+
if (state === IRunnerState.paused) {
|
|
1937
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.ResumeRunner());
|
|
1938
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.running);
|
|
1939
|
+
}
|
|
1940
|
+
} else {
|
|
1941
|
+
__privateGet(this, _warn).call(this, `#ResumeRunner(): Runner: [${runnerId}] not found`);
|
|
1942
|
+
}
|
|
1913
1943
|
} catch (error) {
|
|
1914
1944
|
__privateGet(this, _error).call(this, `#ResumeRunner(): Error: [${error}]`);
|
|
1915
1945
|
}
|
|
@@ -1918,10 +1948,16 @@ class WorkerInstance {
|
|
|
1918
1948
|
var _a;
|
|
1919
1949
|
try {
|
|
1920
1950
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1921
|
-
__privateGet(this,
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1951
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1952
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1953
|
+
if (state === IRunnerState.paused || state === IRunnerState.running) {
|
|
1954
|
+
__privateGet(this, _ResetRunnerIterationById).call(this, runnerId);
|
|
1955
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.ResetRunner());
|
|
1956
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
|
|
1957
|
+
}
|
|
1958
|
+
} else {
|
|
1959
|
+
__privateGet(this, _warn).call(this, `#ResetRunner(): Runner: [${runnerId}] not found`);
|
|
1960
|
+
}
|
|
1925
1961
|
} catch (error) {
|
|
1926
1962
|
__privateGet(this, _error).call(this, `#ResetRunner(): Error: [${error}]`);
|
|
1927
1963
|
}
|
|
@@ -1931,12 +1967,19 @@ class WorkerInstance {
|
|
|
1931
1967
|
var _a;
|
|
1932
1968
|
try {
|
|
1933
1969
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1970
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1971
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1972
|
+
if (state === IRunnerState.paused || state === IRunnerState.created) {
|
|
1973
|
+
const currentIteration = __privateGet(this, _GetRunnerIterationById).call(this, runnerId);
|
|
1974
|
+
__privateGet(this, _debug).call(this, `${chalk.magenta(`runner: [${runnerId}]`)} ExecuteRunner(${currentIteration})`);
|
|
1975
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.Execute());
|
|
1976
|
+
const newIteration = __privateGet(this, _IncRunnerIterationById).call(this, runnerId);
|
|
1977
|
+
__privateGet(this, _debug).call(this, `${chalk.magenta(` --> runner: [${runnerId}]`)} Next iteration number: [${newIteration}] for next Execute or Resume.`);
|
|
1978
|
+
__privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
|
|
1979
|
+
}
|
|
1980
|
+
} else {
|
|
1981
|
+
__privateGet(this, _warn).call(this, `#ExecuteRunner(): Runner: [${runnerId}] not found`);
|
|
1982
|
+
}
|
|
1940
1983
|
} catch (error) {
|
|
1941
1984
|
__privateGet(this, _error).call(this, `#ExecuteRunner(): Error: [${error}]`);
|
|
1942
1985
|
}
|
|
@@ -1945,12 +1988,17 @@ class WorkerInstance {
|
|
|
1945
1988
|
var _a;
|
|
1946
1989
|
try {
|
|
1947
1990
|
const runnerId = testRunnerTelemetryPayload.runner.id;
|
|
1948
|
-
__privateGet(this,
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1991
|
+
if (__privateGet(this, _runners)[runnerId]) {
|
|
1992
|
+
const { state } = __privateGet(this, _runners)[runnerId].runner;
|
|
1993
|
+
if (state === IRunnerState.paused || state === IRunnerState.created || state === IRunnerState.running) {
|
|
1994
|
+
__privateGet(this, _debug).call(this, chalk.cyan(`before: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
|
|
1995
|
+
__privateGet(this, _SetRunnerOptionsById).call(this, runnerId, testRunnerTelemetryPayload.runner.options);
|
|
1996
|
+
__privateGet(this, _debug).call(this, chalk.cyan(`after: [${JSON.stringify(__privateGet(this, _GetRunnerOptionsById).call(this, runnerId))}]`));
|
|
1997
|
+
await ((_a = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _a.UpdateOptions());
|
|
1998
|
+
}
|
|
1999
|
+
} else {
|
|
2000
|
+
__privateGet(this, _warn).call(this, `#UpdateOptions(): Runner: [${runnerId}] not found`);
|
|
2001
|
+
}
|
|
1954
2002
|
} catch (error) {
|
|
1955
2003
|
__privateGet(this, _error).call(this, `#UpdateOptions(): Error: [${error}]`);
|
|
1956
2004
|
}
|
|
@@ -2020,7 +2068,6 @@ class WorkerInstance {
|
|
|
2020
2068
|
}
|
|
2021
2069
|
});
|
|
2022
2070
|
__privateGet(this, _debug).call(this, `constructor`);
|
|
2023
|
-
__privateGet(this, _processLoopExecutor).call(this);
|
|
2024
2071
|
}
|
|
2025
2072
|
get CollectorCollectorPort() {
|
|
2026
2073
|
return __privateGet(this, _collectorCollectorPort);
|
|
@@ -2927,7 +2974,6 @@ class STSWorkerManager {
|
|
|
2927
2974
|
__privateSet(this, _STSInstrumentController, __privateGet(this, _options2).publishInstrumentController);
|
|
2928
2975
|
__privateSet(this, _telemetryProcessor, new TelemetryProcessor());
|
|
2929
2976
|
}
|
|
2930
|
-
__privateGet(this, _processLoopExecutor2).call(this);
|
|
2931
2977
|
}
|
|
2932
2978
|
CreateRunnerCopyNoHistory(runnerEx) {
|
|
2933
2979
|
return {
|