@nrwl/nx-cloud 13.2.0 → 13.2.1
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/run-group.api.js +1 -65
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -138
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -166
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -113
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -158
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -79
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -239
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -130
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -306
- package/package.json +1 -1
|
@@ -1,130 +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.createStartRequest = exports.DistributedExecutionApi = 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, unparse } = require('../../../utilities/nx-imports');
|
|
17
|
-
class DistributedExecutionApi {
|
|
18
|
-
constructor(options) {
|
|
19
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
20
|
-
}
|
|
21
|
-
start(params) {
|
|
22
|
-
var _a;
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStart');
|
|
25
|
-
let resp;
|
|
26
|
-
try {
|
|
27
|
-
resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/start', params));
|
|
28
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
32
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
33
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
34
|
-
throw e;
|
|
35
|
-
}
|
|
36
|
-
if (!resp.data.enabled) {
|
|
37
|
-
throw new Error(`Workspace is disabled. Cannot perform distributed task executions.`);
|
|
38
|
-
}
|
|
39
|
-
if (resp.data.error) {
|
|
40
|
-
throw new Error(resp.data.error);
|
|
41
|
-
}
|
|
42
|
-
return resp.data.id;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
status(id) {
|
|
46
|
-
var _a;
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStatus');
|
|
49
|
-
try {
|
|
50
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/status', {
|
|
51
|
-
id,
|
|
52
|
-
}));
|
|
53
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
54
|
-
return resp.data;
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
58
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
59
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
60
|
-
output.error({
|
|
61
|
-
title: e.message,
|
|
62
|
-
});
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
completeRunGroupWithError(runGroup, error) {
|
|
68
|
-
var _a;
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
|
|
71
|
-
try {
|
|
72
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
73
|
-
runGroup: runGroup,
|
|
74
|
-
criticalErrorMessage: error,
|
|
75
|
-
}), 3);
|
|
76
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
80
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
81
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.DistributedExecutionApi = DistributedExecutionApi;
|
|
87
|
-
function createStartRequest(runGroup, task, options) {
|
|
88
|
-
const tasksToExecute = task.map((arr) => {
|
|
89
|
-
return arr.map((t) => {
|
|
90
|
-
return {
|
|
91
|
-
taskId: t.id,
|
|
92
|
-
hash: t.hash,
|
|
93
|
-
projectName: t.target.project,
|
|
94
|
-
target: t.target.target,
|
|
95
|
-
configuration: t.target.configuration || null,
|
|
96
|
-
params: unparse(t.overrides).join(' '),
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
const request = {
|
|
101
|
-
command: (0, environment_1.parseCommand)(),
|
|
102
|
-
branch: (0, environment_1.getBranch)(),
|
|
103
|
-
runGroup,
|
|
104
|
-
tasks: tasksToExecute,
|
|
105
|
-
maxParallel: calculateMaxParallel(options),
|
|
106
|
-
};
|
|
107
|
-
if (environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT) {
|
|
108
|
-
request.agentCount = environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT;
|
|
109
|
-
}
|
|
110
|
-
if (!environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE) {
|
|
111
|
-
request.stopAgentsOnFailure = false;
|
|
112
|
-
}
|
|
113
|
-
return request;
|
|
114
|
-
}
|
|
115
|
-
exports.createStartRequest = createStartRequest;
|
|
116
|
-
function calculateMaxParallel(options) {
|
|
117
|
-
if (options.parallel === 'false' || options.parallel === false) {
|
|
118
|
-
return 1;
|
|
119
|
-
}
|
|
120
|
-
else if (options.parallel === 'true' || options.parallel === true) {
|
|
121
|
-
return Number(options.maxParallel || 3);
|
|
122
|
-
}
|
|
123
|
-
else if (options.parallel === undefined) {
|
|
124
|
-
return options.maxParallel ? Number(options.maxParallel) : 3;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
return Number(options.parallel) || 3;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=distributed-execution.api.js.map
|
|
1
|
+
const a6_0x12aa=['project','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','target','mapRespToPerfEntry','then','createStartRequest','done','axiosMultipleTries','agentCount','../../../utilities/environment','data','/nx-cloud/executions/complete-run-group','join','__awaiter','../../../utilities/axios','completeRunGroup','status','map','apiAxiosInstance','dteStatus','exit','../../../utilities/nx-imports','true','parseCommand','createApiAxiosInstance','RUNNER_FAILURE_PERF_ENTRY','/nx-cloud/executions/status','error','dteStart','hash','recordMetric','../../../utilities/metric-logger','next','parallel','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','configuration','axiosException','response','value','message','maxParallel','stopAgentsOnFailure','post','Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.','completeRunGroupWithError','overrides','createMetricRecorder','false'];(function(_0x354bce,_0x12aa3c){const _0x3964b4=function(_0x2085d3){while(--_0x2085d3){_0x354bce['push'](_0x354bce['shift']());}};_0x3964b4(++_0x12aa3c);}(a6_0x12aa,0x144));const a6_0x3964=function(_0x354bce,_0x12aa3c){_0x354bce=_0x354bce-0x0;let _0x3964b4=a6_0x12aa[_0x354bce];return _0x3964b4;};'use strict';var __awaiter=this&&this[a6_0x3964('0x19')]||function(_0x34da2c,_0x39c1fc,_0x4dba28,_0x3eda65){function _0x29a295(_0xa5eaad){return _0xa5eaad instanceof _0x4dba28?_0xa5eaad:new _0x4dba28(function(_0x49215b){_0x49215b(_0xa5eaad);});}return new(_0x4dba28||(_0x4dba28=Promise))(function(_0x181f54,_0x2f8e55){function _0x2c31de(_0x3358ef){try{_0x2e8ce8(_0x3eda65['next'](_0x3358ef));}catch(_0x5a6ab1){_0x2f8e55(_0x5a6ab1);}}function _0x3aedd8(_0x3ee8b7){try{_0x2e8ce8(_0x3eda65['throw'](_0x3ee8b7));}catch(_0x59587a){_0x2f8e55(_0x59587a);}}function _0x2e8ce8(_0x466b1b){_0x466b1b[a6_0x3964('0x12')]?_0x181f54(_0x466b1b[a6_0x3964('0x2')]):_0x29a295(_0x466b1b[a6_0x3964('0x2')])[a6_0x3964('0x10')](_0x2c31de,_0x3aedd8);}_0x2e8ce8((_0x3eda65=_0x3eda65['apply'](_0x34da2c,_0x39c1fc||[]))[a6_0x3964('0x2c')]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]});exports[a6_0x3964('0x11')]=exports['DistributedExecutionApi']=void 0x0;const axios_1=require(a6_0x3964('0x1a'));const environment_1=require(a6_0x3964('0x15'));const metric_logger_1=require(a6_0x3964('0x2b'));const {output,unparse}=require(a6_0x3964('0x21'));class DistributedExecutionApi{constructor(_0x4417d0){this[a6_0x3964('0x1e')]=(0x0,axios_1[a6_0x3964('0x24')])(_0x4417d0);}['start'](_0x54523b){var _0x3aeb77;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x13062d=(0x0,metric_logger_1['createMetricRecorder'])(a6_0x3964('0x28'));let _0x562e6;try{_0x562e6=yield(0x0,axios_1[a6_0x3964('0x13')])(()=>this[a6_0x3964('0x1e')]['post']('/nx-cloud/executions/start',_0x54523b));_0x13062d[a6_0x3964('0x2a')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x562e6));}catch(_0x36575a){_0x13062d[a6_0x3964('0x2a')](((_0x3aeb77=_0x36575a===null||_0x36575a===void 0x0?void 0x0:_0x36575a['axiosException'])===null||_0x3aeb77===void 0x0?void 0x0:_0x3aeb77['response'])?(0x0,metric_logger_1[a6_0x3964('0xf')])(_0x36575a[a6_0x3964('0x0')]['response']):metric_logger_1[a6_0x3964('0x25')]);throw _0x36575a;}if(!_0x562e6[a6_0x3964('0x16')]['enabled']){throw new Error(a6_0x3964('0x7'));}if(_0x562e6[a6_0x3964('0x16')][a6_0x3964('0x27')]){throw new Error(_0x562e6[a6_0x3964('0x16')][a6_0x3964('0x27')]);}return _0x562e6['data']['id'];});}[a6_0x3964('0x1c')](_0x55a267){var _0x58b7ce;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x47b324=(0x0,metric_logger_1[a6_0x3964('0xa')])(a6_0x3964('0x1f'));try{const _0x5f2a26=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a6_0x3964('0x1e')][a6_0x3964('0x6')](a6_0x3964('0x26'),{'id':_0x55a267}));_0x47b324[a6_0x3964('0x2a')]((0x0,metric_logger_1[a6_0x3964('0xf')])(_0x5f2a26));return _0x5f2a26[a6_0x3964('0x16')];}catch(_0x54532f){_0x47b324[a6_0x3964('0x2a')](((_0x58b7ce=_0x54532f===null||_0x54532f===void 0x0?void 0x0:_0x54532f[a6_0x3964('0x0')])===null||_0x58b7ce===void 0x0?void 0x0:_0x58b7ce[a6_0x3964('0x1')])?(0x0,metric_logger_1[a6_0x3964('0xf')])(_0x54532f['axiosException'][a6_0x3964('0x1')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output[a6_0x3964('0x27')]({'title':_0x54532f[a6_0x3964('0x3')]});process[a6_0x3964('0x20')](0x1);}});}[a6_0x3964('0x8')](_0x452dac,_0x199aca){var _0xef9ce9;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x275a48=(0x0,metric_logger_1[a6_0x3964('0xa')])(a6_0x3964('0x1b'));try{const _0x44d2ab=yield(0x0,axios_1[a6_0x3964('0x13')])(()=>this[a6_0x3964('0x1e')][a6_0x3964('0x6')](a6_0x3964('0x17'),{'runGroup':_0x452dac,'criticalErrorMessage':_0x199aca}),0x3);_0x275a48['recordMetric']((0x0,metric_logger_1[a6_0x3964('0xf')])(_0x44d2ab));}catch(_0x12a042){_0x275a48[a6_0x3964('0x2a')](((_0xef9ce9=_0x12a042===null||_0x12a042===void 0x0?void 0x0:_0x12a042[a6_0x3964('0x0')])===null||_0xef9ce9===void 0x0?void 0x0:_0xef9ce9[a6_0x3964('0x1')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x12a042[a6_0x3964('0x0')][a6_0x3964('0x1')]):metric_logger_1[a6_0x3964('0x25')]);}});}}exports['DistributedExecutionApi']=DistributedExecutionApi;function createStartRequest(_0x513b9a,_0x3ca0df,_0x811966){const _0xc1933=_0x3ca0df[a6_0x3964('0x1d')](_0x580409=>{return _0x580409[a6_0x3964('0x1d')](_0x11f065=>{return{'taskId':_0x11f065['id'],'hash':_0x11f065[a6_0x3964('0x29')],'projectName':_0x11f065[a6_0x3964('0xe')][a6_0x3964('0xc')],'target':_0x11f065['target'][a6_0x3964('0xe')],'configuration':_0x11f065[a6_0x3964('0xe')][a6_0x3964('0x2f')]||null,'params':unparse(_0x11f065[a6_0x3964('0x9')])[a6_0x3964('0x18')]('\x20')};});});const _0x59ab0e={'command':(0x0,environment_1[a6_0x3964('0x23')])(),'branch':(0x0,environment_1['getBranch'])(),'runGroup':_0x513b9a,'tasks':_0xc1933,'maxParallel':calculateMaxParallel(_0x811966)};if(environment_1[a6_0x3964('0xd')]){_0x59ab0e[a6_0x3964('0x14')]=environment_1[a6_0x3964('0xd')];}if(!environment_1[a6_0x3964('0x2e')]){_0x59ab0e[a6_0x3964('0x5')]=![];}return _0x59ab0e;}exports[a6_0x3964('0x11')]=createStartRequest;function calculateMaxParallel(_0xdfc91a){if(_0xdfc91a[a6_0x3964('0x2d')]===a6_0x3964('0xb')||_0xdfc91a[a6_0x3964('0x2d')]===![]){return 0x1;}else if(_0xdfc91a['parallel']===a6_0x3964('0x22')||_0xdfc91a[a6_0x3964('0x2d')]===!![]){return Number(_0xdfc91a[a6_0x3964('0x4')]||0x3);}else if(_0xdfc91a[a6_0x3964('0x2d')]===undefined){return _0xdfc91a['maxParallel']?Number(_0xdfc91a[a6_0x3964('0x4')]):0x3;}else{return Number(_0xdfc91a['parallel'])||0x3;}}
|
|
@@ -1,306 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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.TaskGraphCreator = exports.nxCloudDistributedTasksRunner = void 0;
|
|
13
|
-
const Observable_1 = require("rxjs/internal/Observable");
|
|
14
|
-
const stripJsonComments = require("strip-json-comments");
|
|
15
|
-
const fs_1 = require("fs");
|
|
16
|
-
const distributed_execution_api_1 = require("./distributed-execution.api");
|
|
17
|
-
const file_storage_1 = require("../../file-storage/file-storage");
|
|
18
|
-
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
19
|
-
const waiter_1 = require("../../../utilities/waiter");
|
|
20
|
-
const environment_1 = require("../../../utilities/environment");
|
|
21
|
-
const print_run_group_error_1 = require("../../error/print-run-group-error");
|
|
22
|
-
const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
|
|
23
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
24
|
-
const { output, getDependencyConfigs, getOutputs, unparse, Cache, } = require('../../../utilities/nx-imports');
|
|
25
|
-
class NoopLifeCycle {
|
|
26
|
-
scheduleTask(task) { }
|
|
27
|
-
startTask(task) { }
|
|
28
|
-
endTask(task, code) { }
|
|
29
|
-
}
|
|
30
|
-
function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString()));
|
|
33
|
-
const stages = new TaskOrderer(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).splitTasksIntoStages(tasks);
|
|
34
|
-
const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, stages, options));
|
|
35
|
-
return yield processTasks(api, fileStorage, cache, options, id, tasks, context);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const processedTasks = {};
|
|
41
|
-
const failIfNumberOfCompletedTasksDoesNotChangeIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
|
|
42
|
-
const waiter = new waiter_1.Waiter();
|
|
43
|
-
while (true) {
|
|
44
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
45
|
-
output.note({
|
|
46
|
-
title: 'Waiting...',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
yield waiter.wait();
|
|
50
|
-
const r = yield api.status(executionId);
|
|
51
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
52
|
-
output.note({
|
|
53
|
-
title: `Status update`,
|
|
54
|
-
bodyLines: [
|
|
55
|
-
`executionId: ${executionId}`,
|
|
56
|
-
`executionStatus: ${r.executionStatus}`,
|
|
57
|
-
`number of completed tasks: ${r.completedTasks.length}`,
|
|
58
|
-
`error: ${r.criticalErrorMessage}`,
|
|
59
|
-
],
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (r.criticalErrorMessage) {
|
|
63
|
-
output.error({
|
|
64
|
-
title: 'Distributed Execution Terminated',
|
|
65
|
-
bodyLines: ['Error:', r.criticalErrorMessage],
|
|
66
|
-
});
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
failIfNumberOfCompletedTasksDoesNotChangeIn30Mins(r.completedTasks.length);
|
|
70
|
-
for (const t of r.completedTasks) {
|
|
71
|
-
if (processedTasks[t.taskId])
|
|
72
|
-
continue;
|
|
73
|
-
yield processTask(fileStorage, cache, context, options, tasks, t);
|
|
74
|
-
waiter.reset();
|
|
75
|
-
processedTasks[t.taskId] = true;
|
|
76
|
-
}
|
|
77
|
-
if (r.executionStatus === 'COMPLETED') {
|
|
78
|
-
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function processTask(fileStorage, cache, context, options, tasks, completedTask) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
86
|
-
output.note({
|
|
87
|
-
title: `Processing task ${completedTask.taskId}`,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
|
|
91
|
-
if (!matchingTask) {
|
|
92
|
-
throw new Error(`Found unknown task: ${completedTask.taskId}`);
|
|
93
|
-
}
|
|
94
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
95
|
-
output.note({
|
|
96
|
-
title: `Retrieving artifacts from ${completedTask.url}`,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
|
|
100
|
-
const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
|
|
101
|
-
const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
|
|
102
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
103
|
-
output.note({
|
|
104
|
-
title: `Extracting artifacts`,
|
|
105
|
-
bodyLines: outputs,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
|
|
109
|
-
output.logCommand(getCommand(matchingTask));
|
|
110
|
-
process.stdout.write(cachedResult.terminalOutput);
|
|
111
|
-
output.addVerticalSeparator();
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function getCommand(task) {
|
|
115
|
-
const args = unparse(task.overrides || {});
|
|
116
|
-
const config = task.target.configuration
|
|
117
|
-
? `:${task.target.configuration}`
|
|
118
|
-
: '';
|
|
119
|
-
return [
|
|
120
|
-
'nx',
|
|
121
|
-
'run',
|
|
122
|
-
`${task.target.project}:${task.target.target}${config}`,
|
|
123
|
-
...args,
|
|
124
|
-
].join(' ');
|
|
125
|
-
}
|
|
126
|
-
const nxCloudDistributedTasksRunner = (tasks, options, context) => {
|
|
127
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
128
|
-
output.note({
|
|
129
|
-
title: 'Starting distributed command execution',
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
options.lifeCycle = new NoopLifeCycle();
|
|
133
|
-
const runGroup = (0, environment_1.getRunGroup)();
|
|
134
|
-
if (!runGroup) {
|
|
135
|
-
(0, print_run_group_error_1.printRunGroupError)();
|
|
136
|
-
return process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
|
|
139
|
-
const fileStorage = new file_storage_1.FileStorage(encryption);
|
|
140
|
-
const cache = new Cache(options);
|
|
141
|
-
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
|
|
142
|
-
runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks)
|
|
143
|
-
.then((r) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
if (r.commandStatus === 0) {
|
|
145
|
-
output.success({
|
|
146
|
-
title: 'Successfully completed running the command.',
|
|
147
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
output.error({
|
|
152
|
-
title: 'Command execution failed.',
|
|
153
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
157
|
-
process.exit(r.commandStatus);
|
|
158
|
-
}))
|
|
159
|
-
.catch((e) => {
|
|
160
|
-
output.error({
|
|
161
|
-
title: 'Unable to complete a run.',
|
|
162
|
-
bodyLines: [e.message],
|
|
163
|
-
});
|
|
164
|
-
if (e.axiosException) {
|
|
165
|
-
console.log(e.axiosException);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
console.log(e);
|
|
169
|
-
}
|
|
170
|
-
api
|
|
171
|
-
.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`)
|
|
172
|
-
.finally(() => process.exit(1));
|
|
173
|
-
});
|
|
174
|
-
return new Observable_1.Observable(() => { });
|
|
175
|
-
};
|
|
176
|
-
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
|
|
177
|
-
class TaskOrderer {
|
|
178
|
-
constructor(projectGraph, defaultTargetDependencies) {
|
|
179
|
-
this.projectGraph = projectGraph;
|
|
180
|
-
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
181
|
-
}
|
|
182
|
-
splitTasksIntoStages(tasks) {
|
|
183
|
-
if (tasks.length === 0)
|
|
184
|
-
return [];
|
|
185
|
-
const stages = [];
|
|
186
|
-
const taskGraph = this.createTaskGraph(tasks);
|
|
187
|
-
const notStagedTaskIds = new Set(tasks.map((t) => t.id));
|
|
188
|
-
let stageIndex = 0;
|
|
189
|
-
// Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
|
|
190
|
-
while (notStagedTaskIds.size > 0) {
|
|
191
|
-
const currentStage = (stages[stageIndex] = []);
|
|
192
|
-
for (const taskId of notStagedTaskIds) {
|
|
193
|
-
let ready = true;
|
|
194
|
-
for (const dependency of taskGraph.dependencies[taskId]) {
|
|
195
|
-
if (notStagedTaskIds.has(dependency)) {
|
|
196
|
-
// dependency has not been staged yet, this task is not ready to be staged.
|
|
197
|
-
ready = false;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
// Some dependency still has not been staged, skip it for now, it will be processed again
|
|
202
|
-
if (!ready) {
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
// All the dependencies have been staged, let's stage it.
|
|
206
|
-
const task = taskGraph.tasks[taskId];
|
|
207
|
-
currentStage.push(task);
|
|
208
|
-
}
|
|
209
|
-
// Remove the entire new stage of tasks from the list
|
|
210
|
-
for (const task of currentStage) {
|
|
211
|
-
notStagedTaskIds.delete(task.id);
|
|
212
|
-
}
|
|
213
|
-
stageIndex++;
|
|
214
|
-
}
|
|
215
|
-
return stages;
|
|
216
|
-
}
|
|
217
|
-
createTaskGraph(tasks) {
|
|
218
|
-
const t = new TaskGraphCreator(this.projectGraph, this.defaultTargetDependencies);
|
|
219
|
-
return t.createTaskGraph(tasks);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
class TaskGraphCreator {
|
|
223
|
-
constructor(projectGraph, defaultTargetDependencies) {
|
|
224
|
-
this.projectGraph = projectGraph;
|
|
225
|
-
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
226
|
-
}
|
|
227
|
-
createTaskGraph(tasks) {
|
|
228
|
-
const graph = {
|
|
229
|
-
roots: [],
|
|
230
|
-
tasks: {},
|
|
231
|
-
dependencies: {},
|
|
232
|
-
};
|
|
233
|
-
for (const task of tasks) {
|
|
234
|
-
this.addTaskToGraph(task, graph);
|
|
235
|
-
const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
|
|
236
|
-
if (!dependencyConfigs) {
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
|
|
240
|
-
}
|
|
241
|
-
graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
|
|
242
|
-
return graph;
|
|
243
|
-
}
|
|
244
|
-
addTaskDependencies(task, dependencyConfigs, tasks, graph) {
|
|
245
|
-
for (const dependencyConfig of dependencyConfigs) {
|
|
246
|
-
if (dependencyConfig.projects === 'self') {
|
|
247
|
-
for (const t of tasks) {
|
|
248
|
-
if (t.target.project === task.target.project &&
|
|
249
|
-
t.target.target === dependencyConfig.target) {
|
|
250
|
-
graph.dependencies[task.id].push(t.id);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
else if (dependencyConfig.projects === 'dependencies') {
|
|
255
|
-
const seen = new Set();
|
|
256
|
-
this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
addDependencies(project, target, tasks, graph, taskId, seen) {
|
|
261
|
-
seen.add(project);
|
|
262
|
-
const dependencies = this.projectGraph.dependencies[project];
|
|
263
|
-
if (dependencies) {
|
|
264
|
-
const projectDependencies = dependencies.map((dependency) => dependency.target);
|
|
265
|
-
for (const projectDependency of projectDependencies) {
|
|
266
|
-
if (seen.has(projectDependency)) {
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
const dependency = this.findTask({ project: projectDependency, target }, tasks);
|
|
270
|
-
if (dependency) {
|
|
271
|
-
if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
|
|
272
|
-
graph.dependencies[taskId].push(dependency.id);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
findTask({ project, target }, tasks) {
|
|
282
|
-
return tasks.find((t) => t.target.project === project && t.target.target === target);
|
|
283
|
-
}
|
|
284
|
-
addTaskToGraph(task, graph) {
|
|
285
|
-
graph.tasks[task.id] = task;
|
|
286
|
-
graph.dependencies[task.id] = [];
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
exports.TaskGraphCreator = TaskGraphCreator;
|
|
290
|
-
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
|
|
291
|
-
var _a, _b;
|
|
292
|
-
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
|
|
293
|
-
const strictlyOrderedTargets = runnerOptions
|
|
294
|
-
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
|
|
295
|
-
: [];
|
|
296
|
-
// Strictly Ordered Targets depend on their dependencies
|
|
297
|
-
for (const target of strictlyOrderedTargets) {
|
|
298
|
-
defaults[target] = defaults[target] || [];
|
|
299
|
-
defaults[target].push({
|
|
300
|
-
target,
|
|
301
|
-
projects: 'dependencies',
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
return defaults;
|
|
305
|
-
}
|
|
306
|
-
//# sourceMappingURL=distributed-execution.runner.js.map
|
|
1
|
+
const a7_0x1262=['targetDependencies','parse','./distributed-execution.api','error:\x20','commandStatus','COMPLETED','criticalErrorMessage','join','run','completeRunGroupWithError','value','DistributedExecutionApi','size','url','addTaskDependencies','Unable\x20to\x20complete\x20a\x20run.','FileStorage','executionId:\x20','reset','roots','then','Waiting...','VERBOSE_LOGGING','addTaskToGraph','length','axiosException','status','Command\x20execution\x20failed.','tasks','Waiter','throw','exit','See\x20run\x20details\x20at\x20','message','Processing\x20task\x20','configuration','indexOf','createTaskGraph','terminalOutput','retrieve','projectGraph','addDependencies','nxCloudDistributedTasksRunner','add','../../file-storage/file-storage','Distributed\x20Execution\x20Terminated','TaskGraphCreator','./node_modules/.cache/nx','next','defineProperty','map','project','build','lifeCycle','executionStatus','overrides','Found\x20unknown\x20task:\x20','error','get','dependencies','Status\x20update','done','catch','wait','hash','../../../utilities/nx-imports','__esModule','taskId','projects','Error:','log','../../file-storage/e2e-encryption','../../error/print-run-group-error','ENCRYPTION_KEY','completedTasks','defaultTargetDependencies','E2EEncryption','delete','submitRunMetrics','logCommand','stdout','Extracting\x20artifacts','../../../utilities/create-no-new-messages-timeout','printRunGroupError','finally','cacheDirectory','runUrl','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','getRunGroup','push','executionStatus:\x20','createNoNewMessagesTimeout','find','../../../utilities/environment','number\x20of\x20completed\x20tasks:\x20','splitTasksIntoStages','assign','strictlyOrderedTargets','Observable','../../../utilities/metric-logger','strip-json-comments','target','__awaiter','encryptionKey','note','start','apply','endTask','success'];(function(_0x857951,_0x1262b2){const _0x4eac35=function(_0x4518ba){while(--_0x4518ba){_0x857951['push'](_0x857951['shift']());}};_0x4eac35(++_0x1262b2);}(a7_0x1262,0x87));const a7_0x4eac=function(_0x857951,_0x1262b2){_0x857951=_0x857951-0x0;let _0x4eac35=a7_0x1262[_0x857951];return _0x4eac35;};'use strict';var __awaiter=this&&this[a7_0x4eac('0x4c')]||function(_0x37205a,_0xc83eb9,_0x48dd20,_0x55696e){function _0x41d6c7(_0x1b5ef9){return _0x1b5ef9 instanceof _0x48dd20?_0x1b5ef9:new _0x48dd20(function(_0x3f4cb1){_0x3f4cb1(_0x1b5ef9);});}return new(_0x48dd20||(_0x48dd20=Promise))(function(_0x5c2504,_0x4f58a5){function _0x547e4a(_0x2dbc30){try{_0x53efb0(_0x55696e['next'](_0x2dbc30));}catch(_0x2968ab){_0x4f58a5(_0x2968ab);}}function _0x26364f(_0x5d9838){try{_0x53efb0(_0x55696e[a7_0x4eac('0x4')](_0x5d9838));}catch(_0x43564d){_0x4f58a5(_0x43564d);}}function _0x53efb0(_0x2d0356){_0x2d0356[a7_0x4eac('0x23')]?_0x5c2504(_0x2d0356[a7_0x4eac('0x5d')]):_0x41d6c7(_0x2d0356[a7_0x4eac('0x5d')])[a7_0x4eac('0x67')](_0x547e4a,_0x26364f);}_0x53efb0((_0x55696e=_0x55696e[a7_0x4eac('0x50')](_0x37205a,_0xc83eb9||[]))[a7_0x4eac('0x16')]());});};Object[a7_0x4eac('0x17')](exports,a7_0x4eac('0x28'),{'value':!![]});exports[a7_0x4eac('0x14')]=exports['nxCloudDistributedTasksRunner']=void 0x0;const Observable_1=require('rxjs/internal/Observable');const stripJsonComments=require(a7_0x4eac('0x4a'));const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x4eac('0x55'));const file_storage_1=require(a7_0x4eac('0x12'));const e2e_encryption_1=require(a7_0x4eac('0x2d'));const waiter_1=require('../../../utilities/waiter');const environment_1=require(a7_0x4eac('0x43'));const print_run_group_error_1=require(a7_0x4eac('0x2e'));const create_no_new_messages_timeout_1=require(a7_0x4eac('0x38'));const metric_logger_1=require(a7_0x4eac('0x49'));const {output,getDependencyConfigs,getOutputs,unparse,Cache}=require(a7_0x4eac('0x27'));class NoopLifeCycle{['scheduleTask'](_0x3ea615){}['startTask'](_0x26f83c){}[a7_0x4eac('0x51')](_0x74e1d2,_0x36cf54){}}function runDistributedExecution(_0x30080b,_0x4dba9b,_0x46571b,_0x5de3ed,_0x5abcb6,_0x143c99,_0x4dad1b){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x245bb6=JSON[a7_0x4eac('0x54')](stripJsonComments((0x0,fs_1['readFileSync'])('nx.json')['toString']()));const _0x1c8873=new TaskOrderer(_0x46571b[a7_0x4eac('0xe')],getDefaultDependencyConfigs(_0x245bb6,_0x4dba9b))[a7_0x4eac('0x45')](_0x4dad1b);const _0x27ee49=yield _0x30080b[a7_0x4eac('0x4f')]((0x0,distributed_execution_api_1['createStartRequest'])(_0x143c99,_0x1c8873,_0x4dba9b));return yield processTasks(_0x30080b,_0x5de3ed,_0x5abcb6,_0x4dba9b,_0x27ee49,_0x4dad1b,_0x46571b);});}function processTasks(_0x5c0371,_0x1baa9b,_0x16bcf8,_0x4130a2,_0xee56f4,_0x337971,_0x5ebf56){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1732b5={};const _0x4d21c4=(0x0,create_no_new_messages_timeout_1[a7_0x4eac('0x41')])();const _0x3c2ff3=new waiter_1[(a7_0x4eac('0x3'))]();while(!![]){if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x68')});}yield _0x3c2ff3[a7_0x4eac('0x25')]();const _0x45a8bd=yield _0x5c0371[a7_0x4eac('0x0')](_0xee56f4);if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a7_0x4eac('0x22'),'bodyLines':[a7_0x4eac('0x64')+_0xee56f4,a7_0x4eac('0x40')+_0x45a8bd[a7_0x4eac('0x1c')],a7_0x4eac('0x44')+_0x45a8bd[a7_0x4eac('0x30')]['length'],a7_0x4eac('0x56')+_0x45a8bd['criticalErrorMessage']]});}if(_0x45a8bd[a7_0x4eac('0x59')]){output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x13'),'bodyLines':[a7_0x4eac('0x2b'),_0x45a8bd[a7_0x4eac('0x59')]]});process['exit'](0x1);}_0x4d21c4(_0x45a8bd[a7_0x4eac('0x30')][a7_0x4eac('0x6b')]);for(const _0x2180a8 of _0x45a8bd['completedTasks']){if(_0x1732b5[_0x2180a8[a7_0x4eac('0x29')]])continue;yield processTask(_0x1baa9b,_0x16bcf8,_0x5ebf56,_0x4130a2,_0x337971,_0x2180a8);_0x3c2ff3[a7_0x4eac('0x65')]();_0x1732b5[_0x2180a8[a7_0x4eac('0x29')]]=!![];}if(_0x45a8bd[a7_0x4eac('0x1c')]===a7_0x4eac('0x58')){return{'commandStatus':_0x45a8bd['commandStatus'],'runUrl':_0x45a8bd[a7_0x4eac('0x3c')]};}}});}function processTask(_0x2cb77a,_0xb8d4d8,_0x160844,_0x4f2c5a,_0x60be7e,_0x55435f){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x8')+_0x55435f[a7_0x4eac('0x29')]});}const _0x39d589=_0x60be7e[a7_0x4eac('0x42')](_0x557dde=>_0x55435f['taskId']===_0x557dde['id']);if(!_0x39d589){throw new Error(a7_0x4eac('0x1e')+_0x55435f[a7_0x4eac('0x29')]);}if(environment_1['VERBOSE_LOGGING']){output['note']({'title':'Retrieving\x20artifacts\x20from\x20'+_0x55435f[a7_0x4eac('0x60')]});}yield _0x2cb77a[a7_0x4eac('0xd')](_0x55435f[a7_0x4eac('0x26')],_0x55435f[a7_0x4eac('0x60')],_0x4f2c5a[a7_0x4eac('0x3b')]||a7_0x4eac('0x15'));const _0x40613a=yield _0xb8d4d8[a7_0x4eac('0x20')](Object[a7_0x4eac('0x46')](Object[a7_0x4eac('0x46')]({},_0x39d589),{'hash':_0x55435f['hash']}));const _0x10c51a=getOutputs(_0x160844['projectGraph']['nodes'],_0x39d589);if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x37'),'bodyLines':_0x10c51a});}yield _0xb8d4d8['copyFilesFromCache'](_0x55435f[a7_0x4eac('0x26')],_0x40613a,_0x10c51a);output[a7_0x4eac('0x35')](getCommand(_0x39d589));process[a7_0x4eac('0x36')]['write'](_0x40613a[a7_0x4eac('0xc')]);output['addVerticalSeparator']();});}function getCommand(_0x35ccc3){const _0x126b68=unparse(_0x35ccc3[a7_0x4eac('0x1d')]||{});const _0x92528=_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x9')]?':'+_0x35ccc3['target'][a7_0x4eac('0x9')]:'';return['nx',a7_0x4eac('0x5b'),_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]+':'+_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]+_0x92528,..._0x126b68][a7_0x4eac('0x5a')]('\x20');}const nxCloudDistributedTasksRunner=(_0x1cb758,_0x2c5638,_0x7b53a1)=>{if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':'Starting\x20distributed\x20command\x20execution'});}_0x2c5638[a7_0x4eac('0x1b')]=new NoopLifeCycle();const _0x487171=(0x0,environment_1[a7_0x4eac('0x3e')])();if(!_0x487171){(0x0,print_run_group_error_1[a7_0x4eac('0x39')])();return process['exit'](0x1);}const _0x5644fe=new e2e_encryption_1[(a7_0x4eac('0x32'))](environment_1[a7_0x4eac('0x2f')]||_0x2c5638[a7_0x4eac('0x4d')]);const _0x5f28f0=new file_storage_1[(a7_0x4eac('0x63'))](_0x5644fe);const _0x1681c8=new Cache(_0x2c5638);const _0xdf5c8=new distributed_execution_api_1[(a7_0x4eac('0x5e'))](_0x2c5638);runDistributedExecution(_0xdf5c8,_0x2c5638,_0x7b53a1,_0x5f28f0,_0x1681c8,_0x487171,_0x1cb758)[a7_0x4eac('0x67')](_0xfd2d6b=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0xfd2d6b[a7_0x4eac('0x57')]===0x0){output[a7_0x4eac('0x52')]({'title':'Successfully\x20completed\x20running\x20the\x20command.','bodyLines':[a7_0x4eac('0x6')+_0xfd2d6b[a7_0x4eac('0x3c')]]});}else{output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x1'),'bodyLines':[a7_0x4eac('0x6')+_0xfd2d6b['runUrl']]});}yield(0x0,metric_logger_1[a7_0x4eac('0x34')])(_0x2c5638);process[a7_0x4eac('0x5')](_0xfd2d6b[a7_0x4eac('0x57')]);}))[a7_0x4eac('0x24')](_0x18d3ab=>{output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x62'),'bodyLines':[_0x18d3ab[a7_0x4eac('0x7')]]});if(_0x18d3ab[a7_0x4eac('0x6c')]){console[a7_0x4eac('0x2c')](_0x18d3ab[a7_0x4eac('0x6c')]);}else{console[a7_0x4eac('0x2c')](_0x18d3ab);}_0xdf5c8[a7_0x4eac('0x5c')](_0x487171,a7_0x4eac('0x3d')+_0x18d3ab['message']+'\x22')[a7_0x4eac('0x3a')](()=>process['exit'](0x1));});return new Observable_1[(a7_0x4eac('0x48'))](()=>{});};exports[a7_0x4eac('0x10')]=nxCloudDistributedTasksRunner;class TaskOrderer{constructor(_0x5aba69,_0x5c93f8){this[a7_0x4eac('0xe')]=_0x5aba69;this[a7_0x4eac('0x31')]=_0x5c93f8;}[a7_0x4eac('0x45')](_0x13e31a){if(_0x13e31a['length']===0x0)return[];const _0x1dfc6a=[];const _0x5c03cd=this['createTaskGraph'](_0x13e31a);const _0x5f022a=new Set(_0x13e31a['map'](_0x2b5d24=>_0x2b5d24['id']));let _0x179440=0x0;while(_0x5f022a[a7_0x4eac('0x5f')]>0x0){const _0x255725=_0x1dfc6a[_0x179440]=[];for(const _0x412c50 of _0x5f022a){let _0x137cf4=!![];for(const _0x485c5b of _0x5c03cd[a7_0x4eac('0x21')][_0x412c50]){if(_0x5f022a['has'](_0x485c5b)){_0x137cf4=![];break;}}if(!_0x137cf4){continue;}const _0x23fcbb=_0x5c03cd[a7_0x4eac('0x2')][_0x412c50];_0x255725[a7_0x4eac('0x3f')](_0x23fcbb);}for(const _0x4c95fa of _0x255725){_0x5f022a[a7_0x4eac('0x33')](_0x4c95fa['id']);}_0x179440++;}return _0x1dfc6a;}['createTaskGraph'](_0x301da9){const _0x52b26f=new TaskGraphCreator(this[a7_0x4eac('0xe')],this[a7_0x4eac('0x31')]);return _0x52b26f[a7_0x4eac('0xb')](_0x301da9);}}class TaskGraphCreator{constructor(_0xb73ede,_0x3b69e5){this[a7_0x4eac('0xe')]=_0xb73ede;this[a7_0x4eac('0x31')]=_0x3b69e5;}['createTaskGraph'](_0x599736){const _0x4ca1e9={'roots':[],'tasks':{},'dependencies':{}};for(const _0x249d0b of _0x599736){this[a7_0x4eac('0x6a')](_0x249d0b,_0x4ca1e9);const _0x1a93b0=getDependencyConfigs(_0x249d0b['target'],this[a7_0x4eac('0x31')],this[a7_0x4eac('0xe')]);if(!_0x1a93b0){continue;}this[a7_0x4eac('0x61')](_0x249d0b,_0x1a93b0,_0x599736,_0x4ca1e9);}_0x4ca1e9[a7_0x4eac('0x66')]=Object['keys'](_0x4ca1e9[a7_0x4eac('0x21')])['filter'](_0x31a255=>_0x4ca1e9[a7_0x4eac('0x21')][_0x31a255][a7_0x4eac('0x6b')]===0x0);return _0x4ca1e9;}[a7_0x4eac('0x61')](_0x3d5898,_0x1f63cb,_0x5af7a3,_0x4000b4){for(const _0x3f139 of _0x1f63cb){if(_0x3f139[a7_0x4eac('0x2a')]==='self'){for(const _0x264d7a of _0x5af7a3){if(_0x264d7a[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]===_0x3d5898[a7_0x4eac('0x4b')]['project']&&_0x264d7a[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]===_0x3f139[a7_0x4eac('0x4b')]){_0x4000b4[a7_0x4eac('0x21')][_0x3d5898['id']][a7_0x4eac('0x3f')](_0x264d7a['id']);}}}else if(_0x3f139[a7_0x4eac('0x2a')]==='dependencies'){const _0x128ff2=new Set();this[a7_0x4eac('0xf')](_0x3d5898[a7_0x4eac('0x4b')][a7_0x4eac('0x19')],_0x3f139[a7_0x4eac('0x4b')],_0x5af7a3,_0x4000b4,_0x3d5898['id'],_0x128ff2);}}}[a7_0x4eac('0xf')](_0x47d3ad,_0x4fa4ac,_0x32ed3c,_0x3a21e6,_0x52c421,_0x2fe424){_0x2fe424[a7_0x4eac('0x11')](_0x47d3ad);const _0x25c08e=this[a7_0x4eac('0xe')][a7_0x4eac('0x21')][_0x47d3ad];if(_0x25c08e){const _0x5eedf8=_0x25c08e[a7_0x4eac('0x18')](_0x557183=>_0x557183[a7_0x4eac('0x4b')]);for(const _0x18a81c of _0x5eedf8){if(_0x2fe424['has'](_0x18a81c)){continue;}const _0x2c704d=this['findTask']({'project':_0x18a81c,'target':_0x4fa4ac},_0x32ed3c);if(_0x2c704d){if(_0x3a21e6[a7_0x4eac('0x21')][_0x52c421][a7_0x4eac('0xa')](_0x2c704d['id'])===-0x1){_0x3a21e6[a7_0x4eac('0x21')][_0x52c421][a7_0x4eac('0x3f')](_0x2c704d['id']);}}else{this[a7_0x4eac('0xf')](_0x18a81c,_0x4fa4ac,_0x32ed3c,_0x3a21e6,_0x52c421,_0x2fe424);}}}}['findTask']({project,target},_0x4dca16){return _0x4dca16[a7_0x4eac('0x42')](_0x5f5103=>_0x5f5103[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]===project&&_0x5f5103[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]===target);}[a7_0x4eac('0x6a')](_0x297c9e,_0x369d12){_0x369d12[a7_0x4eac('0x2')][_0x297c9e['id']]=_0x297c9e;_0x369d12['dependencies'][_0x297c9e['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;function getDefaultDependencyConfigs(_0x541013,_0x2bbc68){var _0x54883f,_0x3e0231;const _0x4ebc90=(_0x54883f=_0x541013[a7_0x4eac('0x53')])!==null&&_0x54883f!==void 0x0?_0x54883f:{};const _0xb1e16=_0x2bbc68?(_0x3e0231=_0x2bbc68[a7_0x4eac('0x47')])!==null&&_0x3e0231!==void 0x0?_0x3e0231:[a7_0x4eac('0x1a')]:[];for(const _0x8438ef of _0xb1e16){_0x4ebc90[_0x8438ef]=_0x4ebc90[_0x8438ef]||[];_0x4ebc90[_0x8438ef][a7_0x4eac('0x3f')]({'target':_0x8438ef,'projects':a7_0x4eac('0x21')});}return _0x4ebc90;}
|