@nrwl/nx-cloud 14.5.0-beta.4 → 14.5.2
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/lib/core/api/error-reporter.api.js +1 -36
- package/lib/core/api/run-group.api.js +1 -68
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -156
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -284
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -113
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -167
- package/lib/core/runners/cloud-enabled/id-generator.js +1 -16
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -79
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -263
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -143
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -220
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +1 -37
- package/lib/core/runners/distributed-execution/task-graph-creator.js +1 -77
- package/package.json +1 -1
|
@@ -1,113 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CloudRemoteCache = void 0;
|
|
13
|
-
const environment_1 = require("../../../utilities/environment");
|
|
14
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
15
|
-
class CloudRemoteCache {
|
|
16
|
-
constructor(messages, api, runContext, fileStorage) {
|
|
17
|
-
this.messages = messages;
|
|
18
|
-
this.api = api;
|
|
19
|
-
this.runContext = runContext;
|
|
20
|
-
this.fileStorage = fileStorage;
|
|
21
|
-
this.storeRequests = [];
|
|
22
|
-
}
|
|
23
|
-
retrieve(hash, cacheDirectory) {
|
|
24
|
-
var _a;
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
if (this.messages.cacheError)
|
|
27
|
-
return false;
|
|
28
|
-
const hashUrls = yield this.hashUrls(hash);
|
|
29
|
-
if (!hashUrls || !hashUrls.get) {
|
|
30
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
31
|
-
output.note({ title: `Nx Cloud: Cache miss ${hash}.` });
|
|
32
|
-
}
|
|
33
|
-
this.runContext.statuses[hash] = 'cache-miss';
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
yield this.fileStorage.retrieve(hash, hashUrls.get, cacheDirectory);
|
|
38
|
-
this.runContext.statuses[hash] = 'remote-cache-hit';
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
catch (ee) {
|
|
42
|
-
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
43
|
-
if (e.response && e.response.status === 404) {
|
|
44
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
45
|
-
output.note({ title: `Nx Cloud: Cache miss ${hash}. Status 404.` });
|
|
46
|
-
}
|
|
47
|
-
// cache miss. print nothing
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
51
|
-
}
|
|
52
|
-
this.runContext.statuses[hash] = 'cache-miss';
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
store(hash, cacheDirectory) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
if (this.messages.cacheError)
|
|
60
|
-
return false;
|
|
61
|
-
const res = Promise.resolve().then(() => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a;
|
|
63
|
-
const hashUrls = yield this.hashUrls(hash);
|
|
64
|
-
if (!hashUrls)
|
|
65
|
-
return false;
|
|
66
|
-
if (!hashUrls.put) {
|
|
67
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
68
|
-
output.note({
|
|
69
|
-
title: `Nx Cloud: Skipping storing ${hash}. Read only token is used.`,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
catch (ee) {
|
|
79
|
-
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
80
|
-
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
this.storeRequests.push(res);
|
|
85
|
-
return res;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
hashUrls(hash) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
if (hash in this.runContext.requests) {
|
|
91
|
-
return (yield this.runContext.requests[hash])[hash];
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
|
|
95
|
-
.filter((t) => !this.runContext.requests[t.hash])
|
|
96
|
-
.map((t) => t.hash);
|
|
97
|
-
if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
|
|
98
|
-
scheduledTaskHashesWithoutRequests.push(hash);
|
|
99
|
-
}
|
|
100
|
-
const request = this.api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, scheduledTaskHashesWithoutRequests);
|
|
101
|
-
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
|
|
102
|
-
this.runContext.requests[taskHash] = request;
|
|
103
|
-
});
|
|
104
|
-
return (yield request)[hash];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
waitForStoreRequestsToComplete() {
|
|
109
|
-
return Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.CloudRemoteCache = CloudRemoteCache;
|
|
113
|
-
//# sourceMappingURL=cloud-remote-cache.js.map
|
|
1
|
+
const a2_0x349c=['__esModule','retrieve','push','status','cacheError','statuses','storage','forEach','cache-miss','response','store','done','apply','reduce','__awaiter','throw','then','.\x20Status\x20404.','indexOf','api','storeRequests','startRun','filter','VERBOSE_LOGGING','../../../utilities/environment','Nx\x20Cloud:\x20Cache\x20miss\x20','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','hashUrls','note','put','requests','waitForStoreRequestsToComplete','messages','value','.\x20Read\x20only\x20token\x20is\x20used.','axiosException','get','runContext','defineProperty','hash','scheduledTasks','fileStorage','Nx\x20Cloud:\x20Skipping\x20storing\x20','CloudRemoteCache','next','../../../utilities/nx-imports','all'];(function(_0x47d4ad,_0x349cbc){const _0x462321=function(_0x28de76){while(--_0x28de76){_0x47d4ad['push'](_0x47d4ad['shift']());}};_0x462321(++_0x349cbc);}(a2_0x349c,0x192));const a2_0x4623=function(_0x47d4ad,_0x349cbc){_0x47d4ad=_0x47d4ad-0x0;let _0x462321=a2_0x349c[_0x47d4ad];return _0x462321;};'use strict';var __awaiter=this&&this[a2_0x4623('0x23')]||function(_0x330bb2,_0x44eb69,_0xf196f,_0x385a59){function _0x261171(_0x32714f){return _0x32714f instanceof _0xf196f?_0x32714f:new _0xf196f(function(_0x1a3c85){_0x1a3c85(_0x32714f);});}return new(_0xf196f||(_0xf196f=Promise))(function(_0x58f982,_0x4e8172){function _0x59eceb(_0x390b87){try{_0x25d4b9(_0x385a59['next'](_0x390b87));}catch(_0x436d3b){_0x4e8172(_0x436d3b);}}function _0x4b6e67(_0x5de4d9){try{_0x25d4b9(_0x385a59[a2_0x4623('0x24')](_0x5de4d9));}catch(_0x5dd297){_0x4e8172(_0x5dd297);}}function _0x25d4b9(_0x3e0c37){_0x3e0c37[a2_0x4623('0x20')]?_0x58f982(_0x3e0c37[a2_0x4623('0x7')]):_0x261171(_0x3e0c37[a2_0x4623('0x7')])['then'](_0x59eceb,_0x4b6e67);}_0x25d4b9((_0x385a59=_0x385a59[a2_0x4623('0x21')](_0x330bb2,_0x44eb69||[]))[a2_0x4623('0x12')]());});};Object[a2_0x4623('0xc')](exports,a2_0x4623('0x15'),{'value':!![]});exports['CloudRemoteCache']=void 0x0;const environment_1=require(a2_0x4623('0x2d'));const {output}=require(a2_0x4623('0x13'));class CloudRemoteCache{constructor(_0x8d1d3e,_0x314933,_0x5bae65,_0xecf458){this['messages']=_0x8d1d3e;this[a2_0x4623('0x28')]=_0x314933;this['runContext']=_0x5bae65;this[a2_0x4623('0xf')]=_0xecf458;this[a2_0x4623('0x29')]=[];}[a2_0x4623('0x16')](_0x2542b6,_0x5784e8){var _0x41e94c;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x4623('0x6')][a2_0x4623('0x19')])return![];const _0x17e5b4=yield this['hashUrls'](_0x2542b6);if(!_0x17e5b4||!_0x17e5b4[a2_0x4623('0xa')]){if(environment_1['VERBOSE_LOGGING']){output[a2_0x4623('0x2')]({'title':a2_0x4623('0x2e')+_0x2542b6+'.'});}this['runContext'][a2_0x4623('0x1a')][_0x2542b6]='cache-miss';return![];}try{yield this[a2_0x4623('0xf')][a2_0x4623('0x16')](_0x2542b6,_0x17e5b4['get'],_0x5784e8);this[a2_0x4623('0xb')][a2_0x4623('0x1a')][_0x2542b6]='remote-cache-hit';return!![];}catch(_0x196eff){const _0x382f1e=(_0x41e94c=_0x196eff['axiosException'])!==null&&_0x41e94c!==void 0x0?_0x41e94c:_0x196eff;if(_0x382f1e[a2_0x4623('0x1e')]&&_0x382f1e['response'][a2_0x4623('0x18')]===0x194){if(environment_1['VERBOSE_LOGGING']){output[a2_0x4623('0x2')]({'title':a2_0x4623('0x2e')+_0x2542b6+a2_0x4623('0x26')});}}else{this[a2_0x4623('0x6')][a2_0x4623('0x19')]=this['messages']['extractErrorMessage'](_0x382f1e,a2_0x4623('0x1b'));}this['runContext']['statuses'][_0x2542b6]=a2_0x4623('0x1d');return![];}});}[a2_0x4623('0x1f')](_0x7e6bf,_0x21f024){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x4623('0x6')]['cacheError'])return![];const _0x5372ef=Promise['resolve']()[a2_0x4623('0x25')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x3c6c48;const _0x5af889=yield this[a2_0x4623('0x1')](_0x7e6bf);if(!_0x5af889)return![];if(!_0x5af889[a2_0x4623('0x3')]){if(environment_1[a2_0x4623('0x2c')]){output[a2_0x4623('0x2')]({'title':a2_0x4623('0x10')+_0x7e6bf+a2_0x4623('0x8')});}return!![];}try{yield this[a2_0x4623('0xf')][a2_0x4623('0x1f')](_0x7e6bf,_0x5af889[a2_0x4623('0x3')],_0x21f024);return!![];}catch(_0x2a3285){const _0x6f6c38=(_0x3c6c48=_0x2a3285[a2_0x4623('0x9')])!==null&&_0x3c6c48!==void 0x0?_0x3c6c48:_0x2a3285;this[a2_0x4623('0x6')][a2_0x4623('0x19')]=this[a2_0x4623('0x6')]['extractErrorMessage'](_0x6f6c38,a2_0x4623('0x1b'));return![];}}));this['storeRequests'][a2_0x4623('0x17')](_0x5372ef);return _0x5372ef;});}['hashUrls'](_0x25e43f){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x25e43f in this[a2_0x4623('0xb')][a2_0x4623('0x4')]){return(yield this['runContext'][a2_0x4623('0x4')][_0x25e43f])[_0x25e43f];}else{const _0x577ca7=this['runContext'][a2_0x4623('0xe')][a2_0x4623('0x2b')](_0x1b87ef=>!this['runContext']['requests'][_0x1b87ef[a2_0x4623('0xd')]])['map'](_0x58c366=>_0x58c366[a2_0x4623('0xd')]);if(_0x577ca7[a2_0x4623('0x27')](_0x25e43f)===-0x1){_0x577ca7[a2_0x4623('0x17')](_0x25e43f);}const _0x4dd7b4=this['api'][a2_0x4623('0x2a')](environment_1[a2_0x4623('0x0')],_0x577ca7);_0x577ca7[a2_0x4623('0x1c')](_0x38fc9e=>{this[a2_0x4623('0xb')][a2_0x4623('0x4')][_0x38fc9e]=_0x4dd7b4;});return(yield _0x4dd7b4)[_0x25e43f];}});}[a2_0x4623('0x5')](){return Promise[a2_0x4623('0x14')](this[a2_0x4623('0x29')])[a2_0x4623('0x25')](_0x48370f=>_0x48370f[a2_0x4623('0x22')]((_0x26949e,_0x4b56fe)=>_0x26949e&&_0x4b56fe,!![]));}}exports[a2_0x4623('0x11')]=CloudRemoteCache;
|
|
@@ -1,167 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CloudRunApi = void 0;
|
|
13
|
-
const axios_1 = require("../../../utilities/axios");
|
|
14
|
-
const environment_1 = require("../../../utilities/environment");
|
|
15
|
-
const fs_1 = require("fs");
|
|
16
|
-
const zlib_1 = require("zlib");
|
|
17
|
-
const util_1 = require("util");
|
|
18
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
19
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
20
|
-
class CloudRunApi {
|
|
21
|
-
constructor(messages, runContext, options, machineInfo) {
|
|
22
|
-
this.messages = messages;
|
|
23
|
-
this.runContext = runContext;
|
|
24
|
-
this.machineInfo = machineInfo;
|
|
25
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
26
|
-
}
|
|
27
|
-
startRun(distributedExecutionId, hashes) {
|
|
28
|
-
var _a;
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('startRun');
|
|
31
|
-
try {
|
|
32
|
-
const request = {
|
|
33
|
-
meta: {
|
|
34
|
-
nxCloudVersion: this.nxCloudVersion(),
|
|
35
|
-
},
|
|
36
|
-
branch: (0, environment_1.getBranch)(),
|
|
37
|
-
runGroup: (0, environment_1.getRunGroup)(),
|
|
38
|
-
distributedExecutionId,
|
|
39
|
-
hashes,
|
|
40
|
-
};
|
|
41
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
42
|
-
output.note({
|
|
43
|
-
title: 'RunStart',
|
|
44
|
-
bodyLines: ['\n' + JSON.stringify(request, null, 2)],
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/start', request));
|
|
48
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
49
|
-
if (resp.data && resp.data.message) {
|
|
50
|
-
this.messages.message = resp.data.message;
|
|
51
|
-
}
|
|
52
|
-
if (!resp.data || !resp.data.urls) {
|
|
53
|
-
this.messages.apiError = `Invalid Nx Cloud response: ${JSON.stringify(resp.data)}`;
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
return resp.data.urls;
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
60
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
61
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
62
|
-
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
|
|
63
|
-
return {};
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
createReqBody(run, tasks, linkId) {
|
|
68
|
-
const uncompressedReqBody = {
|
|
69
|
-
meta: {
|
|
70
|
-
nxCloudVersion: this.nxCloudVersion(),
|
|
71
|
-
},
|
|
72
|
-
tasks,
|
|
73
|
-
run,
|
|
74
|
-
linkId,
|
|
75
|
-
machineInfo: this.machineInfo,
|
|
76
|
-
};
|
|
77
|
-
return JSON.stringify(uncompressedReqBody);
|
|
78
|
-
}
|
|
79
|
-
endRun(run, tasks, linkId) {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
// API is not working, don't make the end request
|
|
83
|
-
if (this.messages.apiError)
|
|
84
|
-
return false;
|
|
85
|
-
let uncompressedBodyString = this.createReqBody(run, tasks, linkId);
|
|
86
|
-
// if the req body is > 20mb, remove hashDetails
|
|
87
|
-
if (uncompressedBodyString.length > 20 * 1000 * 1000) {
|
|
88
|
-
uncompressedBodyString = this.createReqBody(run, tasks.map((t) => (Object.assign(Object.assign({}, t), { hashDetails: undefined }))));
|
|
89
|
-
}
|
|
90
|
-
const uncompressedBuffer = Buffer.from(uncompressedBodyString);
|
|
91
|
-
const compressedBuffer = yield (0, util_1.promisify)(zlib_1.gzip)(uncompressedBuffer);
|
|
92
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('endRun');
|
|
93
|
-
try {
|
|
94
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
95
|
-
const t = tasks.map((tt) => {
|
|
96
|
-
return Object.assign(Object.assign({}, tt), { terminalOutput: tt.terminalOutput
|
|
97
|
-
? `${tt.terminalOutput.slice(0, 20)}...`
|
|
98
|
-
: undefined });
|
|
99
|
-
});
|
|
100
|
-
output.note({
|
|
101
|
-
title: 'RunEnd. Completed tasks',
|
|
102
|
-
bodyLines: ['\n' + JSON.stringify(t, null, 2)],
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/end', compressedBuffer, {
|
|
106
|
-
headers: Object.assign(Object.assign({}, this.apiAxiosInstance.defaults.headers), { 'Content-Encoding': 'gzip', 'Content-Type': 'application/octet-stream' }),
|
|
107
|
-
}));
|
|
108
|
-
if (resp) {
|
|
109
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
110
|
-
if (resp.data && resp.data.runUrl && resp.data.status === 'success') {
|
|
111
|
-
this.runContext.runUrl = resp.data.runUrl;
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
if (resp.data && resp.data.status) {
|
|
115
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data.message)}`;
|
|
116
|
-
}
|
|
117
|
-
else if (resp.data && typeof resp.data === 'string') {
|
|
118
|
-
if (resp.data !== 'success') {
|
|
119
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
|
|
124
|
-
}
|
|
125
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
126
|
-
output.note({
|
|
127
|
-
title: 'Invalid end run response',
|
|
128
|
-
bodyLines: [JSON.stringify(resp.data, null, 2)],
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
output.error({
|
|
134
|
-
title: 'Nx Cloud: Unknown Error Occurred',
|
|
135
|
-
bodyLines: [
|
|
136
|
-
'Run completion responded with `undefined`.',
|
|
137
|
-
'Run Details:',
|
|
138
|
-
JSON.stringify(run, null, 2),
|
|
139
|
-
'Stack Trace:',
|
|
140
|
-
JSON.stringify(new Error().stack, null, 2),
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
catch (ee) {
|
|
147
|
-
recorder.recordMetric(((_a = ee === null || ee === void 0 ? void 0 : ee.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
148
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(ee.axiosException.response)
|
|
149
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
150
|
-
const e = (_b = ee.axiosException) !== null && _b !== void 0 ? _b : ee;
|
|
151
|
-
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
nxCloudVersion() {
|
|
157
|
-
try {
|
|
158
|
-
const v = JSON.parse((0, fs_1.readFileSync)(`package.json`).toString());
|
|
159
|
-
return v.devDependencies['@nrwl/nx-cloud'];
|
|
160
|
-
}
|
|
161
|
-
catch (e) {
|
|
162
|
-
return 'unknown';
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.CloudRunApi = CloudRunApi;
|
|
167
|
-
//# sourceMappingURL=cloud-run.api.js.map
|
|
1
|
+
const a3_0x254d=['defaults','post','endRun','then','message','Nx\x20Cloud:\x20Unknown\x20Error\x20Occurred','axiosException','...','../../../utilities/nx-imports','headers','value','extractErrorMessage','axiosMultipleTries','mapRespToPerfEntry','response','/nx-cloud/runs/end','Invalid\x20end\x20run\x20response:\x20','CloudRunApi','assign','apiError','slice','__awaiter','runContext','getRunGroup','createMetricRecorder','messages','map','Run\x20Details:','status','createApiAxiosInstance','startRun','urls','next','gzip','RunStart','createReqBody','data','string','apply','promisify','throw','defineProperty','readFileSync','/nx-cloud/runs/start','devDependencies','zlib','Run\x20completion\x20responded\x20with\x20`undefined`.','VERBOSE_LOGGING','package.json','length','RUNNER_FAILURE_PERF_ENTRY','__esModule','getBranch','apiAxiosInstance','recordMetric','RunEnd.\x20Completed\x20tasks','stringify','success','from','api','machineInfo','error','Stack\x20Trace:','note','../../../utilities/metric-logger','nxCloudVersion','Invalid\x20end\x20run\x20response','terminalOutput'];(function(_0x55f62b,_0x254d49){const _0x8bc5a=function(_0x1f9e76){while(--_0x1f9e76){_0x55f62b['push'](_0x55f62b['shift']());}};_0x8bc5a(++_0x254d49);}(a3_0x254d,0x1cd));const a3_0x8bc5=function(_0x55f62b,_0x254d49){_0x55f62b=_0x55f62b-0x0;let _0x8bc5a=a3_0x254d[_0x55f62b];return _0x8bc5a;};'use strict';var __awaiter=this&&this[a3_0x8bc5('0x24')]||function(_0x165a10,_0xbb948a,_0x4981db,_0x13eb78){function _0x29f9c0(_0x5a51d9){return _0x5a51d9 instanceof _0x4981db?_0x5a51d9:new _0x4981db(function(_0xa2fae3){_0xa2fae3(_0x5a51d9);});}return new(_0x4981db||(_0x4981db=Promise))(function(_0x4e23d2,_0x59dfcd){function _0x29c706(_0x5a609e){try{_0xadef8f(_0x13eb78['next'](_0x5a609e));}catch(_0x46ca87){_0x59dfcd(_0x46ca87);}}function _0x4e2030(_0x2a5f04){try{_0xadef8f(_0x13eb78[a3_0x8bc5('0x37')](_0x2a5f04));}catch(_0x96005c){_0x59dfcd(_0x96005c);}}function _0xadef8f(_0x19fa77){_0x19fa77['done']?_0x4e23d2(_0x19fa77[a3_0x8bc5('0x19')]):_0x29f9c0(_0x19fa77['value'])[a3_0x8bc5('0x12')](_0x29c706,_0x4e2030);}_0xadef8f((_0x13eb78=_0x13eb78[a3_0x8bc5('0x35')](_0x165a10,_0xbb948a||[]))[a3_0x8bc5('0x2f')]());});};Object[a3_0x8bc5('0x38')](exports,a3_0x8bc5('0x42'),{'value':!![]});exports[a3_0x8bc5('0x20')]=void 0x0;const axios_1=require('../../../utilities/axios');const environment_1=require('../../../utilities/environment');const fs_1=require('fs');const zlib_1=require(a3_0x8bc5('0x3c'));const util_1=require('util');const metric_logger_1=require(a3_0x8bc5('0xb'));const {output}=require(a3_0x8bc5('0x17'));class CloudRunApi{constructor(_0x60a04d,_0x3369d4,_0x4e96d5,_0x395fbc){this[a3_0x8bc5('0x28')]=_0x60a04d;this[a3_0x8bc5('0x25')]=_0x3369d4;this[a3_0x8bc5('0x7')]=_0x395fbc;this[a3_0x8bc5('0x0')]=(0x0,axios_1[a3_0x8bc5('0x2c')])(_0x4e96d5);}[a3_0x8bc5('0x2d')](_0xb20716,_0x356414){var _0x15d294;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x352c7f=(0x0,metric_logger_1[a3_0x8bc5('0x27')])(a3_0x8bc5('0x2d'));try{const _0x536ec7={'meta':{'nxCloudVersion':this[a3_0x8bc5('0xc')]()},'branch':(0x0,environment_1[a3_0x8bc5('0x43')])(),'runGroup':(0x0,environment_1[a3_0x8bc5('0x26')])(),'distributedExecutionId':_0xb20716,'hashes':_0x356414};if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a3_0x8bc5('0x31'),'bodyLines':['\x0a'+JSON[a3_0x8bc5('0x3')](_0x536ec7,null,0x2)]});}const _0x5c6385=yield(0x0,axios_1[a3_0x8bc5('0x1b')])(()=>this[a3_0x8bc5('0x0')][a3_0x8bc5('0x10')](a3_0x8bc5('0x3a'),_0x536ec7));_0x352c7f['recordMetric']((0x0,metric_logger_1[a3_0x8bc5('0x1c')])(_0x5c6385));if(_0x5c6385[a3_0x8bc5('0x33')]&&_0x5c6385['data'][a3_0x8bc5('0x13')]){this[a3_0x8bc5('0x28')]['message']=_0x5c6385['data'][a3_0x8bc5('0x13')];}if(!_0x5c6385[a3_0x8bc5('0x33')]||!_0x5c6385[a3_0x8bc5('0x33')]['urls']){this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]='Invalid\x20Nx\x20Cloud\x20response:\x20'+JSON[a3_0x8bc5('0x3')](_0x5c6385[a3_0x8bc5('0x33')]);return{};}return _0x5c6385[a3_0x8bc5('0x33')][a3_0x8bc5('0x2e')];}catch(_0xcbaa96){_0x352c7f[a3_0x8bc5('0x1')](((_0x15d294=_0xcbaa96===null||_0xcbaa96===void 0x0?void 0x0:_0xcbaa96[a3_0x8bc5('0x15')])===null||_0x15d294===void 0x0?void 0x0:_0x15d294[a3_0x8bc5('0x1d')])?(0x0,metric_logger_1[a3_0x8bc5('0x1c')])(_0xcbaa96[a3_0x8bc5('0x15')]['response']):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]=this[a3_0x8bc5('0x28')][a3_0x8bc5('0x1a')](_0xcbaa96,a3_0x8bc5('0x6'));return{};}});}['createReqBody'](_0x3b05e5,_0x1a29e6,_0x429dec){const _0x373c67={'meta':{'nxCloudVersion':this['nxCloudVersion']()},'tasks':_0x1a29e6,'run':_0x3b05e5,'linkId':_0x429dec,'machineInfo':this[a3_0x8bc5('0x7')]};return JSON[a3_0x8bc5('0x3')](_0x373c67);}['endRun'](_0x448bb7,_0x59922c,_0x1a39f8){var _0x22e89f,_0x2af338;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')])return![];let _0x319700=this[a3_0x8bc5('0x32')](_0x448bb7,_0x59922c,_0x1a39f8);if(_0x319700[a3_0x8bc5('0x40')]>0x14*0x3e8*0x3e8){_0x319700=this['createReqBody'](_0x448bb7,_0x59922c['map'](_0x5540af=>Object[a3_0x8bc5('0x21')](Object['assign']({},_0x5540af),{'hashDetails':undefined})));}const _0xe5085=Buffer[a3_0x8bc5('0x5')](_0x319700);const _0x145ed7=yield(0x0,util_1[a3_0x8bc5('0x36')])(zlib_1[a3_0x8bc5('0x30')])(_0xe5085);const _0x34fd1d=(0x0,metric_logger_1['createMetricRecorder'])(a3_0x8bc5('0x11'));try{if(environment_1['VERBOSE_LOGGING']){const _0x2781e1=_0x59922c[a3_0x8bc5('0x29')](_0x1a134c=>{return Object['assign'](Object['assign']({},_0x1a134c),{'terminalOutput':_0x1a134c[a3_0x8bc5('0xe')]?_0x1a134c[a3_0x8bc5('0xe')][a3_0x8bc5('0x23')](0x0,0x14)+a3_0x8bc5('0x16'):undefined});});output['note']({'title':a3_0x8bc5('0x2'),'bodyLines':['\x0a'+JSON[a3_0x8bc5('0x3')](_0x2781e1,null,0x2)]});}const _0x5683e8=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a3_0x8bc5('0x0')][a3_0x8bc5('0x10')](a3_0x8bc5('0x1e'),_0x145ed7,{'headers':Object['assign'](Object[a3_0x8bc5('0x21')]({},this['apiAxiosInstance'][a3_0x8bc5('0xf')][a3_0x8bc5('0x18')]),{'Content-Encoding':a3_0x8bc5('0x30'),'Content-Type':'application/octet-stream'})}));if(_0x5683e8){_0x34fd1d[a3_0x8bc5('0x1')]((0x0,metric_logger_1[a3_0x8bc5('0x1c')])(_0x5683e8));if(_0x5683e8[a3_0x8bc5('0x33')]&&_0x5683e8[a3_0x8bc5('0x33')]['runUrl']&&_0x5683e8[a3_0x8bc5('0x33')]['status']==='success'){this['runContext']['runUrl']=_0x5683e8[a3_0x8bc5('0x33')]['runUrl'];return!![];}if(_0x5683e8[a3_0x8bc5('0x33')]&&_0x5683e8['data'][a3_0x8bc5('0x2b')]){this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]=a3_0x8bc5('0x1f')+JSON[a3_0x8bc5('0x3')](_0x5683e8[a3_0x8bc5('0x33')][a3_0x8bc5('0x13')]);}else if(_0x5683e8[a3_0x8bc5('0x33')]&&typeof _0x5683e8[a3_0x8bc5('0x33')]===a3_0x8bc5('0x34')){if(_0x5683e8['data']!==a3_0x8bc5('0x4')){this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]='Invalid\x20end\x20run\x20response:\x20'+JSON[a3_0x8bc5('0x3')](_0x5683e8[a3_0x8bc5('0x33')]);}}else{this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]=a3_0x8bc5('0x1f')+JSON[a3_0x8bc5('0x3')](_0x5683e8[a3_0x8bc5('0x33')]);}if(environment_1[a3_0x8bc5('0x3e')]){output[a3_0x8bc5('0xa')]({'title':a3_0x8bc5('0xd'),'bodyLines':[JSON['stringify'](_0x5683e8[a3_0x8bc5('0x33')],null,0x2)]});}}else{output[a3_0x8bc5('0x8')]({'title':a3_0x8bc5('0x14'),'bodyLines':[a3_0x8bc5('0x3d'),a3_0x8bc5('0x2a'),JSON[a3_0x8bc5('0x3')](_0x448bb7,null,0x2),a3_0x8bc5('0x9'),JSON[a3_0x8bc5('0x3')](new Error()['stack'],null,0x2)]});}return![];}catch(_0x2f9391){_0x34fd1d['recordMetric'](((_0x22e89f=_0x2f9391===null||_0x2f9391===void 0x0?void 0x0:_0x2f9391[a3_0x8bc5('0x15')])===null||_0x22e89f===void 0x0?void 0x0:_0x22e89f[a3_0x8bc5('0x1d')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x2f9391['axiosException']['response']):metric_logger_1[a3_0x8bc5('0x41')]);const _0x4a8ac1=(_0x2af338=_0x2f9391[a3_0x8bc5('0x15')])!==null&&_0x2af338!==void 0x0?_0x2af338:_0x2f9391;this[a3_0x8bc5('0x28')][a3_0x8bc5('0x22')]=this[a3_0x8bc5('0x28')]['extractErrorMessage'](_0x4a8ac1,a3_0x8bc5('0x6'));return![];}});}[a3_0x8bc5('0xc')](){try{const _0x27d77e=JSON['parse']((0x0,fs_1[a3_0x8bc5('0x39')])(a3_0x8bc5('0x3f'))['toString']());return _0x27d77e[a3_0x8bc5('0x3b')]['@nrwl/nx-cloud'];}catch(_0x36c8d0){return'unknown';}}}exports[a3_0x8bc5('0x20')]=CloudRunApi;
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateUniqueLinkId = void 0;
|
|
4
|
-
const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
5
|
-
const digits = '0123456789';
|
|
6
|
-
const lower = upper.toLowerCase();
|
|
7
|
-
const alphanum = upper + lower + digits;
|
|
8
|
-
function generateUniqueLinkId() {
|
|
9
|
-
let res = '';
|
|
10
|
-
for (let i = 0; i < 10; ++i) {
|
|
11
|
-
res += alphanum[Math.floor(Math.random() * alphanum.length)];
|
|
12
|
-
}
|
|
13
|
-
return res;
|
|
14
|
-
}
|
|
15
|
-
exports.generateUniqueLinkId = generateUniqueLinkId;
|
|
16
|
-
//# sourceMappingURL=id-generator.js.map
|
|
1
|
+
const a4_0x2db1=['floor','defineProperty','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789','random','generateUniqueLinkId','__esModule','length','toLowerCase'];(function(_0x342f5d,_0x2db1e1){const _0x33ebf4=function(_0x114549){while(--_0x114549){_0x342f5d['push'](_0x342f5d['shift']());}};_0x33ebf4(++_0x2db1e1);}(a4_0x2db1,0x13f));const a4_0x33eb=function(_0x342f5d,_0x2db1e1){_0x342f5d=_0x342f5d-0x0;let _0x33ebf4=a4_0x2db1[_0x342f5d];return _0x33ebf4;};'use strict';Object[a4_0x33eb('0x6')](exports,a4_0x33eb('0x2'),{'value':!![]});exports[a4_0x33eb('0x1')]=void 0x0;const upper=a4_0x33eb('0x7');const digits=a4_0x33eb('0x8');const lower=upper[a4_0x33eb('0x4')]();const alphanum=upper+lower+digits;function generateUniqueLinkId(){let _0x122a22='';for(let _0x156c53=0x0;_0x156c53<0xa;++_0x156c53){_0x122a22+=alphanum[Math[a4_0x33eb('0x5')](Math[a4_0x33eb('0x0')]()*alphanum[a4_0x33eb('0x3')])];}return _0x122a22;}exports['generateUniqueLinkId']=generateUniqueLinkId;
|
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DistributedAgentApi = void 0;
|
|
13
|
-
const axios_1 = require("../../../utilities/axios");
|
|
14
|
-
const environment_1 = require("../../../utilities/environment");
|
|
15
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
16
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
17
|
-
class DistributedAgentApi {
|
|
18
|
-
constructor(options, runGroup, agentName) {
|
|
19
|
-
this.runGroup = runGroup;
|
|
20
|
-
this.agentName = agentName;
|
|
21
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
22
|
-
}
|
|
23
|
-
tasks(executionId, statusCode, completedTasks) {
|
|
24
|
-
var _a;
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dtePollTasks');
|
|
27
|
-
try {
|
|
28
|
-
const res = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/tasks', {
|
|
29
|
-
runGroup: this.runGroup,
|
|
30
|
-
agentName: this.agentName,
|
|
31
|
-
executionId,
|
|
32
|
-
statusCode,
|
|
33
|
-
completedTasks,
|
|
34
|
-
}));
|
|
35
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(res));
|
|
36
|
-
return res.data;
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
40
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
41
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
42
|
-
throw e;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
completeRunGroupWithError(error) {
|
|
47
|
-
var _a;
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
50
|
-
output.note({
|
|
51
|
-
title: 'Completing run group with an error',
|
|
52
|
-
bodyLines: [`runGroup: ${this.runGroup}`, `error: ${error}`],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
|
|
56
|
-
try {
|
|
57
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
58
|
-
runGroup: this.runGroup,
|
|
59
|
-
agentName: this.agentName,
|
|
60
|
-
criticalErrorMessage: error,
|
|
61
|
-
}));
|
|
62
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
63
|
-
output.note({
|
|
64
|
-
title: 'Completed run group with an error',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
71
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
72
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
73
|
-
console.error(e);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.DistributedAgentApi = DistributedAgentApi;
|
|
79
|
-
//# sourceMappingURL=distributed-agent.api.js.map
|
|
1
|
+
const a5_0x1117=['recordMetric','mapRespToPerfEntry','/nx-cloud/executions/complete-run-group','../../../utilities/metric-logger','agentName','next','__esModule','RUNNER_FAILURE_PERF_ENTRY','runGroup:\x20','VERBOSE_LOGGING','__awaiter','Completed\x20run\x20group\x20with\x20an\x20error','tasks','axiosMultipleTries','createMetricRecorder','defineProperty','note','apply','value','response','error','../../../utilities/nx-imports','../../../utilities/axios','post','apiAxiosInstance','Completing\x20run\x20group\x20with\x20an\x20error','../../../utilities/environment','runGroup','done','throw','completeRunGroup','axiosException','dtePollTasks','DistributedAgentApi'];(function(_0x5c16e8,_0x1117c3){const _0x55269d=function(_0x25d23c){while(--_0x25d23c){_0x5c16e8['push'](_0x5c16e8['shift']());}};_0x55269d(++_0x1117c3);}(a5_0x1117,0x1e7));const a5_0x5526=function(_0x5c16e8,_0x1117c3){_0x5c16e8=_0x5c16e8-0x0;let _0x55269d=a5_0x1117[_0x5c16e8];return _0x55269d;};'use strict';var __awaiter=this&&this[a5_0x5526('0x21')]||function(_0x22457e,_0xc68f0b,_0x2abf36,_0x245b57){function _0x4f078b(_0x2efe4f){return _0x2efe4f instanceof _0x2abf36?_0x2efe4f:new _0x2abf36(function(_0x351034){_0x351034(_0x2efe4f);});}return new(_0x2abf36||(_0x2abf36=Promise))(function(_0xf91ff8,_0x22fdea){function _0x1dff55(_0x2c83d5){try{_0x2be3f9(_0x245b57[a5_0x5526('0x1c')](_0x2c83d5));}catch(_0x50e883){_0x22fdea(_0x50e883);}}function _0x57e5b3(_0x308696){try{_0x2be3f9(_0x245b57[a5_0x5526('0x12')](_0x308696));}catch(_0x246949){_0x22fdea(_0x246949);}}function _0x2be3f9(_0x32544f){_0x32544f[a5_0x5526('0x11')]?_0xf91ff8(_0x32544f[a5_0x5526('0x7')]):_0x4f078b(_0x32544f[a5_0x5526('0x7')])['then'](_0x1dff55,_0x57e5b3);}_0x2be3f9((_0x245b57=_0x245b57[a5_0x5526('0x6')](_0x22457e,_0xc68f0b||[]))[a5_0x5526('0x1c')]());});};Object[a5_0x5526('0x4')](exports,a5_0x5526('0x1d'),{'value':!![]});exports['DistributedAgentApi']=void 0x0;const axios_1=require(a5_0x5526('0xb'));const environment_1=require(a5_0x5526('0xf'));const metric_logger_1=require(a5_0x5526('0x1a'));const {output}=require(a5_0x5526('0xa'));class DistributedAgentApi{constructor(_0x4f06fa,_0x11e735,_0x2c980b){this[a5_0x5526('0x10')]=_0x11e735;this['agentName']=_0x2c980b;this[a5_0x5526('0xd')]=(0x0,axios_1['createApiAxiosInstance'])(_0x4f06fa);}[a5_0x5526('0x1')](_0x30b4ff,_0x486fc9,_0x2c728b){var _0xcff1ca;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1612d5=(0x0,metric_logger_1[a5_0x5526('0x3')])(a5_0x5526('0x15'));try{const _0x3432c1=yield(0x0,axios_1[a5_0x5526('0x2')])(()=>this[a5_0x5526('0xd')][a5_0x5526('0xc')]('/nx-cloud/executions/tasks',{'runGroup':this[a5_0x5526('0x10')],'agentName':this[a5_0x5526('0x1b')],'executionId':_0x30b4ff,'statusCode':_0x486fc9,'completedTasks':_0x2c728b}));_0x1612d5['recordMetric']((0x0,metric_logger_1[a5_0x5526('0x18')])(_0x3432c1));return _0x3432c1['data'];}catch(_0x480e60){_0x1612d5[a5_0x5526('0x17')](((_0xcff1ca=_0x480e60===null||_0x480e60===void 0x0?void 0x0:_0x480e60[a5_0x5526('0x14')])===null||_0xcff1ca===void 0x0?void 0x0:_0xcff1ca[a5_0x5526('0x8')])?(0x0,metric_logger_1[a5_0x5526('0x18')])(_0x480e60[a5_0x5526('0x14')][a5_0x5526('0x8')]):metric_logger_1[a5_0x5526('0x1e')]);throw _0x480e60;}});}['completeRunGroupWithError'](_0x43997d){var _0x1773de;return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a5_0x5526('0x20')]){output[a5_0x5526('0x5')]({'title':a5_0x5526('0xe'),'bodyLines':[a5_0x5526('0x1f')+this[a5_0x5526('0x10')],'error:\x20'+_0x43997d]});}const _0x5bad55=(0x0,metric_logger_1['createMetricRecorder'])(a5_0x5526('0x13'));try{const _0x3a582c=yield(0x0,axios_1[a5_0x5526('0x2')])(()=>this['apiAxiosInstance'][a5_0x5526('0xc')](a5_0x5526('0x19'),{'runGroup':this['runGroup'],'agentName':this['agentName'],'criticalErrorMessage':_0x43997d}));if(environment_1[a5_0x5526('0x20')]){output[a5_0x5526('0x5')]({'title':a5_0x5526('0x0')});}_0x5bad55[a5_0x5526('0x17')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x3a582c));}catch(_0x187e60){_0x5bad55[a5_0x5526('0x17')](((_0x1773de=_0x187e60===null||_0x187e60===void 0x0?void 0x0:_0x187e60['axiosException'])===null||_0x1773de===void 0x0?void 0x0:_0x1773de[a5_0x5526('0x8')])?(0x0,metric_logger_1[a5_0x5526('0x18')])(_0x187e60[a5_0x5526('0x14')][a5_0x5526('0x8')]):metric_logger_1[a5_0x5526('0x1e')]);console[a5_0x5526('0x9')](_0x187e60);}});}}exports[a5_0x5526('0x16')]=DistributedAgentApi;
|