@nrwl/nx-cloud 15.1.0-beta.3 → 15.1.0
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 -92
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -305
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -117
- 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 -80
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -293
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -143
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -241
- 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,117 +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}.`,
|
|
70
|
-
bodyLines: [
|
|
71
|
-
`There are several reasons why this can happen.`,
|
|
72
|
-
`Maybe you are using a read-only token or the artifact has already being uploaded.`,
|
|
73
|
-
],
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
catch (ee) {
|
|
83
|
-
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
84
|
-
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
this.storeRequests.push(res);
|
|
89
|
-
return res;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
hashUrls(hash) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
if (hash in this.runContext.requests) {
|
|
95
|
-
return (yield this.runContext.requests[hash])[hash];
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
|
|
99
|
-
.filter((t) => !this.runContext.requests[t.hash])
|
|
100
|
-
.map((t) => t.hash);
|
|
101
|
-
if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
|
|
102
|
-
scheduledTaskHashesWithoutRequests.push(hash);
|
|
103
|
-
}
|
|
104
|
-
const request = this.api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, scheduledTaskHashesWithoutRequests);
|
|
105
|
-
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
|
|
106
|
-
this.runContext.requests[taskHash] = request;
|
|
107
|
-
});
|
|
108
|
-
return (yield request)[hash];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
waitForStoreRequestsToComplete() {
|
|
113
|
-
return Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.CloudRemoteCache = CloudRemoteCache;
|
|
117
|
-
//# sourceMappingURL=cloud-remote-cache.js.map
|
|
1
|
+
const a2_0x85c9=['messages','Maybe\x20you\x20are\x20using\x20a\x20read-only\x20token\x20or\x20the\x20artifact\x20has\x20already\x20being\x20uploaded.','CloudRemoteCache','store','runContext','VERBOSE_LOGGING','then','fileStorage','retrieve','axiosException','../../../utilities/environment','get','done','waitForStoreRequestsToComplete','extractErrorMessage','push','next','__awaiter','response','hashUrls','.\x20Status\x20404.','cacheError','throw','apply','remote-cache-hit','storeRequests','__esModule','storage','put','cache-miss','map','requests','../../../utilities/nx-imports','forEach','statuses','value','hash','scheduledTasks','indexOf','Nx\x20Cloud:\x20Cache\x20miss\x20','defineProperty','resolve'];(function(_0x409448,_0x85c995){const _0xc4d5ce=function(_0x11b979){while(--_0x11b979){_0x409448['push'](_0x409448['shift']());}};_0xc4d5ce(++_0x85c995);}(a2_0x85c9,0x173));const a2_0xc4d5=function(_0x409448,_0x85c995){_0x409448=_0x409448-0x0;let _0xc4d5ce=a2_0x85c9[_0x409448];return _0xc4d5ce;};'use strict';var __awaiter=this&&this[a2_0xc4d5('0x18')]||function(_0xc42938,_0x55b825,_0x4a297e,_0x287f26){function _0x266fa4(_0x41f97d){return _0x41f97d instanceof _0x4a297e?_0x41f97d:new _0x4a297e(function(_0x6e0fcd){_0x6e0fcd(_0x41f97d);});}return new(_0x4a297e||(_0x4a297e=Promise))(function(_0x55208f,_0x3bc300){function _0x5e80ca(_0xa88a05){try{_0x2cce1c(_0x287f26[a2_0xc4d5('0x17')](_0xa88a05));}catch(_0x19efc4){_0x3bc300(_0x19efc4);}}function _0xc93639(_0x2507bf){try{_0x2cce1c(_0x287f26[a2_0xc4d5('0x1d')](_0x2507bf));}catch(_0xc8c28c){_0x3bc300(_0xc8c28c);}}function _0x2cce1c(_0x3f93be){_0x3f93be[a2_0xc4d5('0x13')]?_0x55208f(_0x3f93be[a2_0xc4d5('0x0')]):_0x266fa4(_0x3f93be['value'])[a2_0xc4d5('0xd')](_0x5e80ca,_0xc93639);}_0x2cce1c((_0x287f26=_0x287f26[a2_0xc4d5('0x1e')](_0xc42938,_0x55b825||[]))[a2_0xc4d5('0x17')]());});};Object[a2_0xc4d5('0x5')](exports,a2_0xc4d5('0x21'),{'value':!![]});exports[a2_0xc4d5('0x9')]=void 0x0;const environment_1=require(a2_0xc4d5('0x11'));const {output}=require(a2_0xc4d5('0x27'));class CloudRemoteCache{constructor(_0x27fee2,_0x27a3ac,_0x53a7a4,_0x595119){this[a2_0xc4d5('0x7')]=_0x27fee2;this['api']=_0x27a3ac;this[a2_0xc4d5('0xb')]=_0x53a7a4;this['fileStorage']=_0x595119;this[a2_0xc4d5('0x20')]=[];}[a2_0xc4d5('0xf')](_0x3e61a0,_0x53a13b){var _0x1c4f54;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0xc4d5('0x7')][a2_0xc4d5('0x1c')])return![];const _0xec2b64=yield this[a2_0xc4d5('0x1a')](_0x3e61a0);if(!_0xec2b64||!_0xec2b64['get']){if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a2_0xc4d5('0x4')+_0x3e61a0+'.'});}this[a2_0xc4d5('0xb')][a2_0xc4d5('0x29')][_0x3e61a0]='cache-miss';return![];}try{yield this[a2_0xc4d5('0xe')]['retrieve'](_0x3e61a0,_0xec2b64[a2_0xc4d5('0x12')],_0x53a13b);this[a2_0xc4d5('0xb')][a2_0xc4d5('0x29')][_0x3e61a0]=a2_0xc4d5('0x1f');return!![];}catch(_0x56a0a5){const _0x49dbd0=(_0x1c4f54=_0x56a0a5[a2_0xc4d5('0x10')])!==null&&_0x1c4f54!==void 0x0?_0x1c4f54:_0x56a0a5;if(_0x49dbd0[a2_0xc4d5('0x19')]&&_0x49dbd0[a2_0xc4d5('0x19')]['status']===0x194){if(environment_1[a2_0xc4d5('0xc')]){output['note']({'title':a2_0xc4d5('0x4')+_0x3e61a0+a2_0xc4d5('0x1b')});}}else{this[a2_0xc4d5('0x7')][a2_0xc4d5('0x1c')]=this[a2_0xc4d5('0x7')]['extractErrorMessage'](_0x49dbd0,a2_0xc4d5('0x22'));}this[a2_0xc4d5('0xb')]['statuses'][_0x3e61a0]=a2_0xc4d5('0x24');return![];}});}[a2_0xc4d5('0xa')](_0x115341,_0x4f4904){return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a2_0xc4d5('0x1c')])return![];const _0x1af3fb=Promise[a2_0xc4d5('0x6')]()[a2_0xc4d5('0xd')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x277e37;const _0x4522de=yield this[a2_0xc4d5('0x1a')](_0x115341);if(!_0x4522de)return![];if(!_0x4522de[a2_0xc4d5('0x23')]){if(environment_1[a2_0xc4d5('0xc')]){output['note']({'title':'Nx\x20Cloud:\x20Skipping\x20storing\x20'+_0x115341+'.','bodyLines':['There\x20are\x20several\x20reasons\x20why\x20this\x20can\x20happen.',a2_0xc4d5('0x8')]});}return!![];}try{yield this[a2_0xc4d5('0xe')][a2_0xc4d5('0xa')](_0x115341,_0x4522de[a2_0xc4d5('0x23')],_0x4f4904);return!![];}catch(_0x32b799){const _0x1cb3d6=(_0x277e37=_0x32b799['axiosException'])!==null&&_0x277e37!==void 0x0?_0x277e37:_0x32b799;this[a2_0xc4d5('0x7')][a2_0xc4d5('0x1c')]=this[a2_0xc4d5('0x7')][a2_0xc4d5('0x15')](_0x1cb3d6,'storage');return![];}}));this[a2_0xc4d5('0x20')][a2_0xc4d5('0x16')](_0x1af3fb);return _0x1af3fb;});}[a2_0xc4d5('0x1a')](_0x36c391){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x36c391 in this[a2_0xc4d5('0xb')][a2_0xc4d5('0x26')]){return(yield this[a2_0xc4d5('0xb')]['requests'][_0x36c391])[_0x36c391];}else{const _0x5c83cd=this[a2_0xc4d5('0xb')][a2_0xc4d5('0x2')]['filter'](_0x59d44e=>!this[a2_0xc4d5('0xb')]['requests'][_0x59d44e['hash']])[a2_0xc4d5('0x25')](_0x156b86=>_0x156b86[a2_0xc4d5('0x1')]);if(_0x5c83cd[a2_0xc4d5('0x3')](_0x36c391)===-0x1){_0x5c83cd[a2_0xc4d5('0x16')](_0x36c391);}const _0x450c48=this['api']['startRun'](environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'],_0x5c83cd);_0x5c83cd[a2_0xc4d5('0x28')](_0x4114c3=>{this[a2_0xc4d5('0xb')][a2_0xc4d5('0x26')][_0x4114c3]=_0x450c48;});return(yield _0x450c48)[_0x36c391];}});}[a2_0xc4d5('0x14')](){return Promise['all'](this[a2_0xc4d5('0x20')])[a2_0xc4d5('0xd')](_0x327d1f=>_0x327d1f['reduce']((_0x57c966,_0x426c07)=>_0x57c966&&_0x426c07,!![]));}}exports['CloudRemoteCache']=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.printDuration)('RunStart duration', () => (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.printDuration)('RunEnd duration', () => (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_0xf81b=['/nx-cloud/runs/end','gzip','terminalOutput','util','printDuration','...','@nrwl/nx-cloud','/nx-cloud/runs/start','endRun','startRun','toString','Run\x20Details:','Run\x20completion\x20responded\x20with\x20`undefined`.','__awaiter','stack','apiError','map','../../../utilities/environment','runUrl','apiAxiosInstance','promisify','string','post','defaults','throw','stringify','status','extractErrorMessage','headers','VERBOSE_LOGGING','createMetricRecorder','from','../../../utilities/metric-logger','Nx\x20Cloud:\x20Unknown\x20Error\x20Occurred','RunEnd\x20duration','readFileSync','axiosException','api','response','message','success','../../../utilities/axios','Invalid\x20Nx\x20Cloud\x20response:\x20','CloudRunApi','value','mapRespToPerfEntry','RunStart','length','error','devDependencies','recordMetric','messages','machineInfo','getRunGroup','then','Invalid\x20end\x20run\x20response','runContext','parse','unknown','Stack\x20Trace:','Invalid\x20end\x20run\x20response:\x20','data','createReqBody','note','slice','next','nxCloudVersion','assign','axiosMultipleTries','RUNNER_FAILURE_PERF_ENTRY'];(function(_0x4b38a4,_0xf81b2e){const _0x380cba=function(_0x2809b6){while(--_0x2809b6){_0x4b38a4['push'](_0x4b38a4['shift']());}};_0x380cba(++_0xf81b2e);}(a3_0xf81b,0x1a0));const a3_0x380c=function(_0x4b38a4,_0xf81b2e){_0x4b38a4=_0x4b38a4-0x0;let _0x380cba=a3_0xf81b[_0x4b38a4];return _0x380cba;};'use strict';var __awaiter=this&&this[a3_0x380c('0x11')]||function(_0x168fc7,_0x58b57a,_0x24b06a,_0x4b73a7){function _0x52abfb(_0x3dae64){return _0x3dae64 instanceof _0x24b06a?_0x3dae64:new _0x24b06a(function(_0x5cc347){_0x5cc347(_0x3dae64);});}return new(_0x24b06a||(_0x24b06a=Promise))(function(_0x1fbf8b,_0x7d793c){function _0x190767(_0x2280f0){try{_0x29e293(_0x4b73a7[a3_0x380c('0x45')](_0x2280f0));}catch(_0x2ec946){_0x7d793c(_0x2ec946);}}function _0x2b3d36(_0x2bbfa1){try{_0x29e293(_0x4b73a7[a3_0x380c('0x1c')](_0x2bbfa1));}catch(_0x331b43){_0x7d793c(_0x331b43);}}function _0x29e293(_0x43b3ba){_0x43b3ba['done']?_0x1fbf8b(_0x43b3ba[a3_0x380c('0x30')]):_0x52abfb(_0x43b3ba[a3_0x380c('0x30')])[a3_0x380c('0x3a')](_0x190767,_0x2b3d36);}_0x29e293((_0x4b73a7=_0x4b73a7['apply'](_0x168fc7,_0x58b57a||[]))[a3_0x380c('0x45')]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]});exports[a3_0x380c('0x2f')]=void 0x0;const axios_1=require(a3_0x380c('0x2d'));const environment_1=require(a3_0x380c('0x15'));const fs_1=require('fs');const zlib_1=require('zlib');const util_1=require(a3_0x380c('0x7'));const metric_logger_1=require(a3_0x380c('0x24'));const {output}=require('../../../utilities/nx-imports');class CloudRunApi{constructor(_0x11e1c6,_0x50f5f5,_0x51c601,_0x322617){this['messages']=_0x11e1c6;this[a3_0x380c('0x3c')]=_0x50f5f5;this[a3_0x380c('0x38')]=_0x322617;this[a3_0x380c('0x17')]=(0x0,axios_1['createApiAxiosInstance'])(_0x51c601);}[a3_0x380c('0xd')](_0x18b8f7,_0x54cc2f){var _0x314826;return __awaiter(this,void 0x0,void 0x0,function*(){const _0xb58312=(0x0,metric_logger_1[a3_0x380c('0x22')])(a3_0x380c('0xd'));try{const _0x5e9c8c={'meta':{'nxCloudVersion':this['nxCloudVersion']()},'branch':(0x0,environment_1['getBranch'])(),'runGroup':(0x0,environment_1[a3_0x380c('0x39')])(),'distributedExecutionId':_0x18b8f7,'hashes':_0x54cc2f};if(environment_1[a3_0x380c('0x21')]){output[a3_0x380c('0x43')]({'title':a3_0x380c('0x32'),'bodyLines':['\x0a'+JSON[a3_0x380c('0x1d')](_0x5e9c8c,null,0x2)]});}const _0x2cae67=yield(0x0,axios_1[a3_0x380c('0x8')])('RunStart\x20duration',()=>(0x0,axios_1['axiosMultipleTries'])(()=>this[a3_0x380c('0x17')][a3_0x380c('0x1a')](a3_0x380c('0xb'),_0x5e9c8c)));_0xb58312[a3_0x380c('0x36')]((0x0,metric_logger_1[a3_0x380c('0x31')])(_0x2cae67));if(_0x2cae67['data']&&_0x2cae67[a3_0x380c('0x41')][a3_0x380c('0x2b')]){this[a3_0x380c('0x37')][a3_0x380c('0x2b')]=_0x2cae67[a3_0x380c('0x41')][a3_0x380c('0x2b')];}if(!_0x2cae67['data']||!_0x2cae67[a3_0x380c('0x41')]['urls']){this[a3_0x380c('0x37')][a3_0x380c('0x13')]=a3_0x380c('0x2e')+JSON[a3_0x380c('0x1d')](_0x2cae67[a3_0x380c('0x41')]);return{};}return _0x2cae67[a3_0x380c('0x41')]['urls'];}catch(_0xc11461){_0xb58312[a3_0x380c('0x36')](((_0x314826=_0xc11461===null||_0xc11461===void 0x0?void 0x0:_0xc11461['axiosException'])===null||_0x314826===void 0x0?void 0x0:_0x314826['response'])?(0x0,metric_logger_1[a3_0x380c('0x31')])(_0xc11461[a3_0x380c('0x28')][a3_0x380c('0x2a')]):metric_logger_1[a3_0x380c('0x3')]);this[a3_0x380c('0x37')][a3_0x380c('0x13')]=this[a3_0x380c('0x37')][a3_0x380c('0x1f')](_0xc11461,a3_0x380c('0x29'));return{};}});}[a3_0x380c('0x42')](_0x276715,_0x1698c1,_0x54e7c3){const _0x3f0a76={'meta':{'nxCloudVersion':this[a3_0x380c('0x0')]()},'tasks':_0x1698c1,'run':_0x276715,'linkId':_0x54e7c3,'machineInfo':this['machineInfo']};return JSON[a3_0x380c('0x1d')](_0x3f0a76);}[a3_0x380c('0xc')](_0x546927,_0x43a4dc,_0x28cd97){var _0x472366,_0x2b1275;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages']['apiError'])return![];let _0xb4b993=this['createReqBody'](_0x546927,_0x43a4dc,_0x28cd97);if(_0xb4b993[a3_0x380c('0x33')]>0x14*0x3e8*0x3e8){_0xb4b993=this[a3_0x380c('0x42')](_0x546927,_0x43a4dc[a3_0x380c('0x14')](_0x24d307=>Object['assign'](Object[a3_0x380c('0x1')]({},_0x24d307),{'hashDetails':undefined})));}const _0x4950b1=Buffer[a3_0x380c('0x23')](_0xb4b993);const _0x263746=yield(0x0,util_1[a3_0x380c('0x18')])(zlib_1[a3_0x380c('0x5')])(_0x4950b1);const _0x3397fc=(0x0,metric_logger_1[a3_0x380c('0x22')])(a3_0x380c('0xc'));try{if(environment_1[a3_0x380c('0x21')]){const _0x24195e=_0x43a4dc[a3_0x380c('0x14')](_0x2692d1=>{return Object[a3_0x380c('0x1')](Object[a3_0x380c('0x1')]({},_0x2692d1),{'terminalOutput':_0x2692d1[a3_0x380c('0x6')]?_0x2692d1[a3_0x380c('0x6')][a3_0x380c('0x44')](0x0,0x14)+a3_0x380c('0x9'):undefined});});output['note']({'title':'RunEnd.\x20Completed\x20tasks','bodyLines':['\x0a'+JSON['stringify'](_0x24195e,null,0x2)]});}const _0x2d8be0=yield(0x0,axios_1[a3_0x380c('0x8')])(a3_0x380c('0x26'),()=>(0x0,axios_1[a3_0x380c('0x2')])(()=>this['apiAxiosInstance'][a3_0x380c('0x1a')](a3_0x380c('0x4'),_0x263746,{'headers':Object[a3_0x380c('0x1')](Object[a3_0x380c('0x1')]({},this[a3_0x380c('0x17')][a3_0x380c('0x1b')][a3_0x380c('0x20')]),{'Content-Encoding':a3_0x380c('0x5'),'Content-Type':'application/octet-stream'})})));if(_0x2d8be0){_0x3397fc[a3_0x380c('0x36')]((0x0,metric_logger_1[a3_0x380c('0x31')])(_0x2d8be0));if(_0x2d8be0[a3_0x380c('0x41')]&&_0x2d8be0['data']['runUrl']&&_0x2d8be0[a3_0x380c('0x41')][a3_0x380c('0x1e')]===a3_0x380c('0x2c')){this[a3_0x380c('0x3c')][a3_0x380c('0x16')]=_0x2d8be0['data'][a3_0x380c('0x16')];return!![];}if(_0x2d8be0[a3_0x380c('0x41')]&&_0x2d8be0[a3_0x380c('0x41')][a3_0x380c('0x1e')]){this['messages'][a3_0x380c('0x13')]=a3_0x380c('0x40')+JSON[a3_0x380c('0x1d')](_0x2d8be0[a3_0x380c('0x41')][a3_0x380c('0x2b')]);}else if(_0x2d8be0[a3_0x380c('0x41')]&&typeof _0x2d8be0[a3_0x380c('0x41')]===a3_0x380c('0x19')){if(_0x2d8be0[a3_0x380c('0x41')]!==a3_0x380c('0x2c')){this[a3_0x380c('0x37')]['apiError']='Invalid\x20end\x20run\x20response:\x20'+JSON[a3_0x380c('0x1d')](_0x2d8be0['data']);}}else{this[a3_0x380c('0x37')][a3_0x380c('0x13')]=a3_0x380c('0x40')+JSON['stringify'](_0x2d8be0[a3_0x380c('0x41')]);}if(environment_1[a3_0x380c('0x21')]){output[a3_0x380c('0x43')]({'title':a3_0x380c('0x3b'),'bodyLines':[JSON[a3_0x380c('0x1d')](_0x2d8be0[a3_0x380c('0x41')],null,0x2)]});}}else{output[a3_0x380c('0x34')]({'title':a3_0x380c('0x25'),'bodyLines':[a3_0x380c('0x10'),a3_0x380c('0xf'),JSON['stringify'](_0x546927,null,0x2),a3_0x380c('0x3f'),JSON['stringify'](new Error()[a3_0x380c('0x12')],null,0x2)]});}return![];}catch(_0x2eeb02){_0x3397fc[a3_0x380c('0x36')](((_0x472366=_0x2eeb02===null||_0x2eeb02===void 0x0?void 0x0:_0x2eeb02[a3_0x380c('0x28')])===null||_0x472366===void 0x0?void 0x0:_0x472366['response'])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x2eeb02[a3_0x380c('0x28')]['response']):metric_logger_1[a3_0x380c('0x3')]);const _0x1d8ec6=(_0x2b1275=_0x2eeb02[a3_0x380c('0x28')])!==null&&_0x2b1275!==void 0x0?_0x2b1275:_0x2eeb02;this['messages'][a3_0x380c('0x13')]=this[a3_0x380c('0x37')][a3_0x380c('0x1f')](_0x1d8ec6,'api');return![];}});}['nxCloudVersion'](){try{const _0x4d130a=JSON[a3_0x380c('0x3d')]((0x0,fs_1[a3_0x380c('0x27')])('package.json')[a3_0x380c('0xe')]());return _0x4d130a[a3_0x380c('0x35')][a3_0x380c('0xa')];}catch(_0x12211e){return a3_0x380c('0x3e');}}}exports[a3_0x380c('0x2f')]=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_0x4f22=['floor','toLowerCase','ABCDEFGHIJKLMNOPQRSTUVWXYZ','random','__esModule','defineProperty','generateUniqueLinkId'];(function(_0x128200,_0x4f2213){const _0x1d539e=function(_0xff88e5){while(--_0xff88e5){_0x128200['push'](_0x128200['shift']());}};_0x1d539e(++_0x4f2213);}(a4_0x4f22,0x68));const a4_0x1d53=function(_0x128200,_0x4f2213){_0x128200=_0x128200-0x0;let _0x1d539e=a4_0x4f22[_0x128200];return _0x1d539e;};'use strict';Object[a4_0x1d53('0x6')](exports,a4_0x1d53('0x5'),{'value':!![]});exports[a4_0x1d53('0x0')]=void 0x0;const upper=a4_0x1d53('0x3');const digits='0123456789';const lower=upper[a4_0x1d53('0x2')]();const alphanum=upper+lower+digits;function generateUniqueLinkId(){let _0x2dbb3c='';for(let _0x498041=0x0;_0x498041<0xa;++_0x498041){_0x2dbb3c+=alphanum[Math[a4_0x1d53('0x1')](Math[a4_0x1d53('0x4')]()*alphanum['length'])];}return _0x2dbb3c;}exports[a4_0x1d53('0x0')]=generateUniqueLinkId;
|
|
@@ -1,80 +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, targets) {
|
|
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
|
-
targets,
|
|
35
|
-
}));
|
|
36
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(res));
|
|
37
|
-
return res.data;
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
41
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
42
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
43
|
-
throw e;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
completeRunGroupWithError(error) {
|
|
48
|
-
var _a;
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
51
|
-
output.note({
|
|
52
|
-
title: 'Completing run group with an error',
|
|
53
|
-
bodyLines: [`runGroup: ${this.runGroup}`, `error: ${error}`],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
|
|
57
|
-
try {
|
|
58
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
59
|
-
runGroup: this.runGroup,
|
|
60
|
-
agentName: this.agentName,
|
|
61
|
-
criticalErrorMessage: error,
|
|
62
|
-
}));
|
|
63
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
64
|
-
output.note({
|
|
65
|
-
title: 'Completed run group with an error',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
72
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
73
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
74
|
-
console.error(e);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.DistributedAgentApi = DistributedAgentApi;
|
|
80
|
-
//# sourceMappingURL=distributed-agent.api.js.map
|
|
1
|
+
const a5_0x5d60=['post','../../../utilities/axios','done','../../../utilities/metric-logger','recordMetric','note','VERBOSE_LOGGING','__awaiter','/nx-cloud/executions/tasks','DistributedAgentApi','throw','runGroup','error:\x20','createMetricRecorder','next','/nx-cloud/executions/complete-run-group','agentName','__esModule','error','response','apiAxiosInstance','data','completeRunGroupWithError','mapRespToPerfEntry','dtePollTasks','apply','value','Completing\x20run\x20group\x20with\x20an\x20error','RUNNER_FAILURE_PERF_ENTRY','axiosMultipleTries','axiosException','runGroup:\x20'];(function(_0x5995ad,_0x5d6006){const _0x236585=function(_0x4709ae){while(--_0x4709ae){_0x5995ad['push'](_0x5995ad['shift']());}};_0x236585(++_0x5d6006);}(a5_0x5d60,0x1dc));const a5_0x2365=function(_0x5995ad,_0x5d6006){_0x5995ad=_0x5995ad-0x0;let _0x236585=a5_0x5d60[_0x5995ad];return _0x236585;};'use strict';var __awaiter=this&&this[a5_0x2365('0xb')]||function(_0x2455d4,_0x1c8b86,_0x55d712,_0x3d1d46){function _0x57a604(_0x3882ea){return _0x3882ea instanceof _0x55d712?_0x3882ea:new _0x55d712(function(_0x5769a7){_0x5769a7(_0x3882ea);});}return new(_0x55d712||(_0x55d712=Promise))(function(_0x4a2e72,_0x31ad8a){function _0x4d3f95(_0x558a50){try{_0x3b8261(_0x3d1d46[a5_0x2365('0x12')](_0x558a50));}catch(_0x25e6f3){_0x31ad8a(_0x25e6f3);}}function _0x1ac2b0(_0x5e5da2){try{_0x3b8261(_0x3d1d46[a5_0x2365('0xe')](_0x5e5da2));}catch(_0x1bc9d1){_0x31ad8a(_0x1bc9d1);}}function _0x3b8261(_0x2e8f70){_0x2e8f70[a5_0x2365('0x6')]?_0x4a2e72(_0x2e8f70[a5_0x2365('0x1e')]):_0x57a604(_0x2e8f70[a5_0x2365('0x1e')])['then'](_0x4d3f95,_0x1ac2b0);}_0x3b8261((_0x3d1d46=_0x3d1d46[a5_0x2365('0x1d')](_0x2455d4,_0x1c8b86||[]))[a5_0x2365('0x12')]());});};Object['defineProperty'](exports,a5_0x2365('0x15'),{'value':!![]});exports[a5_0x2365('0xd')]=void 0x0;const axios_1=require(a5_0x2365('0x5'));const environment_1=require('../../../utilities/environment');const metric_logger_1=require(a5_0x2365('0x7'));const {output}=require('../../../utilities/nx-imports');class DistributedAgentApi{constructor(_0x9adca1,_0x2ae946,_0x14d1e8){this[a5_0x2365('0xf')]=_0x2ae946;this[a5_0x2365('0x14')]=_0x14d1e8;this['apiAxiosInstance']=(0x0,axios_1['createApiAxiosInstance'])(_0x9adca1);}['tasks'](_0xdb2ce0,_0x313e86,_0x29bb9a,_0x3e2598){var _0xcdbe59;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x2d8b8f=(0x0,metric_logger_1[a5_0x2365('0x11')])(a5_0x2365('0x1c'));try{const _0x4d4572=yield(0x0,axios_1[a5_0x2365('0x1')])(()=>this[a5_0x2365('0x18')][a5_0x2365('0x4')](a5_0x2365('0xc'),{'runGroup':this[a5_0x2365('0xf')],'agentName':this['agentName'],'executionId':_0xdb2ce0,'statusCode':_0x313e86,'completedTasks':_0x29bb9a,'targets':_0x3e2598}));_0x2d8b8f[a5_0x2365('0x8')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x4d4572));return _0x4d4572[a5_0x2365('0x19')];}catch(_0x109d01){_0x2d8b8f['recordMetric'](((_0xcdbe59=_0x109d01===null||_0x109d01===void 0x0?void 0x0:_0x109d01[a5_0x2365('0x2')])===null||_0xcdbe59===void 0x0?void 0x0:_0xcdbe59[a5_0x2365('0x17')])?(0x0,metric_logger_1[a5_0x2365('0x1b')])(_0x109d01[a5_0x2365('0x2')][a5_0x2365('0x17')]):metric_logger_1[a5_0x2365('0x0')]);throw _0x109d01;}});}[a5_0x2365('0x1a')](_0x3cb848){var _0x1e6c6f;return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a5_0x2365('0xa')]){output[a5_0x2365('0x9')]({'title':a5_0x2365('0x1f'),'bodyLines':[a5_0x2365('0x3')+this[a5_0x2365('0xf')],a5_0x2365('0x10')+_0x3cb848]});}const _0x488df5=(0x0,metric_logger_1[a5_0x2365('0x11')])('completeRunGroup');try{const _0x5de60b=yield(0x0,axios_1[a5_0x2365('0x1')])(()=>this[a5_0x2365('0x18')][a5_0x2365('0x4')](a5_0x2365('0x13'),{'runGroup':this[a5_0x2365('0xf')],'agentName':this[a5_0x2365('0x14')],'criticalErrorMessage':_0x3cb848}));if(environment_1[a5_0x2365('0xa')]){output[a5_0x2365('0x9')]({'title':'Completed\x20run\x20group\x20with\x20an\x20error'});}_0x488df5[a5_0x2365('0x8')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x5de60b));}catch(_0x43c5f7){_0x488df5[a5_0x2365('0x8')](((_0x1e6c6f=_0x43c5f7===null||_0x43c5f7===void 0x0?void 0x0:_0x43c5f7[a5_0x2365('0x2')])===null||_0x1e6c6f===void 0x0?void 0x0:_0x1e6c6f['response'])?(0x0,metric_logger_1[a5_0x2365('0x1b')])(_0x43c5f7[a5_0x2365('0x2')]['response']):metric_logger_1[a5_0x2365('0x0')]);console[a5_0x2365('0x16')](_0x43c5f7);}});}}exports[a5_0x2365('0xd')]=DistributedAgentApi;
|