@nrwl/nx-cloud 14.0.1-beta.2 → 14.0.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/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-life-cycle.js.map +1 -1
- 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/lib/generators/init/init.js.map +1 -1
- 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_0xc5dd=['parallel','stopAgentsOnFailure','__esModule','../../../utilities/environment','start','createApiAxiosInstance','../../../utilities/metric-logger','mapRespToPerfEntry','post','createStartRequest','defineProperty','data','../../../utilities/nx-imports','apply','agentCount','hash','next','parseCommand','/nx-cloud/executions/start','message','maxParallel','configuration','/nx-cloud/executions/status','../../../utilities/axios','then','axiosException','dteStart','target','false','true','response','completeRunGroupWithError','createMetricRecorder','project','recordMetric','status','DistributedExecutionApi','map','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','exit','axiosMultipleTries','throw','value','overrides','error','RUNNER_FAILURE_PERF_ENTRY','apiAxiosInstance','enabled'];(function(_0x447d48,_0xc5ddee){const _0x1160b9=function(_0x519ddf){while(--_0x519ddf){_0x447d48['push'](_0x447d48['shift']());}};_0x1160b9(++_0xc5ddee);}(a6_0xc5dd,0x183));const a6_0x1160=function(_0x447d48,_0xc5ddee){_0x447d48=_0x447d48-0x0;let _0x1160b9=a6_0xc5dd[_0x447d48];return _0x1160b9;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x3a354a,_0x2c4079,_0xb81785,_0x1456c1){function _0x134a2c(_0xc050df){return _0xc050df instanceof _0xb81785?_0xc050df:new _0xb81785(function(_0x19c6bd){_0x19c6bd(_0xc050df);});}return new(_0xb81785||(_0xb81785=Promise))(function(_0x2ae060,_0x1c2264){function _0x1bb0c7(_0x6ac1dd){try{_0x1776ce(_0x1456c1[a6_0x1160('0xd')](_0x6ac1dd));}catch(_0x12ce83){_0x1c2264(_0x12ce83);}}function _0x386e6d(_0x40952e){try{_0x1776ce(_0x1456c1[a6_0x1160('0x26')](_0x40952e));}catch(_0x91b4f5){_0x1c2264(_0x91b4f5);}}function _0x1776ce(_0x188271){_0x188271['done']?_0x2ae060(_0x188271[a6_0x1160('0x27')]):_0x134a2c(_0x188271[a6_0x1160('0x27')])[a6_0x1160('0x15')](_0x1bb0c7,_0x386e6d);}_0x1776ce((_0x1456c1=_0x1456c1[a6_0x1160('0xa')](_0x3a354a,_0x2c4079||[]))['next']());});};Object[a6_0x1160('0x7')](exports,a6_0x1160('0x2f'),{'value':!![]});exports[a6_0x1160('0x6')]=exports[a6_0x1160('0x21')]=void 0x0;const axios_1=require(a6_0x1160('0x14'));const environment_1=require(a6_0x1160('0x0'));const metric_logger_1=require(a6_0x1160('0x3'));const {output,unparse}=require(a6_0x1160('0x9'));class DistributedExecutionApi{constructor(_0x3e44b7){this['apiAxiosInstance']=(0x0,axios_1[a6_0x1160('0x2')])(_0x3e44b7);}[a6_0x1160('0x1')](_0x14cb69){var _0x4a96eb;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4d5af4=(0x0,metric_logger_1[a6_0x1160('0x1d')])(a6_0x1160('0x17'));let _0x1766b5;try{_0x1766b5=yield(0x0,axios_1[a6_0x1160('0x25')])(()=>this[a6_0x1160('0x2b')][a6_0x1160('0x5')](a6_0x1160('0xf'),_0x14cb69));_0x4d5af4[a6_0x1160('0x1f')]((0x0,metric_logger_1[a6_0x1160('0x4')])(_0x1766b5));}catch(_0x2ba9a7){_0x4d5af4['recordMetric'](((_0x4a96eb=_0x2ba9a7===null||_0x2ba9a7===void 0x0?void 0x0:_0x2ba9a7[a6_0x1160('0x16')])===null||_0x4a96eb===void 0x0?void 0x0:_0x4a96eb[a6_0x1160('0x1b')])?(0x0,metric_logger_1[a6_0x1160('0x4')])(_0x2ba9a7['axiosException'][a6_0x1160('0x1b')]):metric_logger_1[a6_0x1160('0x2a')]);throw _0x2ba9a7;}if(!_0x1766b5['data'][a6_0x1160('0x2c')]){throw new Error('Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.');}if(_0x1766b5[a6_0x1160('0x8')][a6_0x1160('0x29')]){throw new Error(_0x1766b5[a6_0x1160('0x8')][a6_0x1160('0x29')]);}return _0x1766b5[a6_0x1160('0x8')]['id'];});}[a6_0x1160('0x20')](_0x491b61){var _0x161d67;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x16d935=(0x0,metric_logger_1[a6_0x1160('0x1d')])('dteStatus');try{const _0x547b9a=yield(0x0,axios_1[a6_0x1160('0x25')])(()=>this[a6_0x1160('0x2b')][a6_0x1160('0x5')](a6_0x1160('0x13'),{'id':_0x491b61}));_0x16d935[a6_0x1160('0x1f')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x547b9a));return _0x547b9a[a6_0x1160('0x8')];}catch(_0x1a497f){_0x16d935[a6_0x1160('0x1f')](((_0x161d67=_0x1a497f===null||_0x1a497f===void 0x0?void 0x0:_0x1a497f[a6_0x1160('0x16')])===null||_0x161d67===void 0x0?void 0x0:_0x161d67[a6_0x1160('0x1b')])?(0x0,metric_logger_1[a6_0x1160('0x4')])(_0x1a497f[a6_0x1160('0x16')][a6_0x1160('0x1b')]):metric_logger_1[a6_0x1160('0x2a')]);output[a6_0x1160('0x29')]({'title':_0x1a497f[a6_0x1160('0x10')]});process[a6_0x1160('0x24')](0x1);}});}[a6_0x1160('0x1c')](_0x53d0ee,_0x34e085){var _0x408961;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1aef71=(0x0,metric_logger_1[a6_0x1160('0x1d')])('completeRunGroup');try{const _0x4c1a72=yield(0x0,axios_1[a6_0x1160('0x25')])(()=>this[a6_0x1160('0x2b')][a6_0x1160('0x5')]('/nx-cloud/executions/complete-run-group',{'runGroup':_0x53d0ee,'criticalErrorMessage':_0x34e085}),0x3);_0x1aef71[a6_0x1160('0x1f')]((0x0,metric_logger_1[a6_0x1160('0x4')])(_0x4c1a72));}catch(_0x3a71ce){_0x1aef71[a6_0x1160('0x1f')](((_0x408961=_0x3a71ce===null||_0x3a71ce===void 0x0?void 0x0:_0x3a71ce[a6_0x1160('0x16')])===null||_0x408961===void 0x0?void 0x0:_0x408961['response'])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x3a71ce['axiosException'][a6_0x1160('0x1b')]):metric_logger_1[a6_0x1160('0x2a')]);}});}}exports['DistributedExecutionApi']=DistributedExecutionApi;function createStartRequest(_0x164c8d,_0x36fe5c,_0x2a5caa){const _0x160d15=_0x36fe5c['map'](_0x29a5ff=>{return _0x29a5ff[a6_0x1160('0x22')](_0x3d3489=>{return{'taskId':_0x3d3489['id'],'hash':_0x3d3489[a6_0x1160('0xc')],'projectName':_0x3d3489[a6_0x1160('0x18')][a6_0x1160('0x1e')],'target':_0x3d3489[a6_0x1160('0x18')][a6_0x1160('0x18')],'configuration':_0x3d3489[a6_0x1160('0x18')][a6_0x1160('0x12')]||null,'params':unparse(_0x3d3489[a6_0x1160('0x28')])['join']('\x20')};});});const _0x41ad58={'command':(0x0,environment_1[a6_0x1160('0xe')])(),'branch':(0x0,environment_1['getBranch'])(),'runGroup':_0x164c8d,'tasks':_0x160d15,'maxParallel':calculateMaxParallel(_0x2a5caa)};if(environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT']){_0x41ad58[a6_0x1160('0xb')]=environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT'];}if(!environment_1[a6_0x1160('0x23')]){_0x41ad58[a6_0x1160('0x2e')]=![];}return _0x41ad58;}exports[a6_0x1160('0x6')]=createStartRequest;function calculateMaxParallel(_0x52beaf){if(_0x52beaf[a6_0x1160('0x2d')]===a6_0x1160('0x19')||_0x52beaf[a6_0x1160('0x2d')]===![]){return 0x1;}else if(_0x52beaf[a6_0x1160('0x2d')]===a6_0x1160('0x1a')||_0x52beaf['parallel']===!![]){return Number(_0x52beaf[a6_0x1160('0x11')]||0x3);}else if(_0x52beaf[a6_0x1160('0x2d')]===undefined){return _0x52beaf[a6_0x1160('0x11')]?Number(_0x52beaf[a6_0x1160('0x11')]):0x3;}else{return Number(_0x52beaf['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_0x408b=['submitRunMetrics','delete','defaultTargetDependencies','parse','find','createTaskGraph','lifeCycle','__awaiter','Starting\x20distributed\x20command\x20execution','push','map','stdout','value','toString','project','../../file-storage/file-storage','Successfully\x20completed\x20running\x20the\x20command.','overrides','VERBOSE_LOGGING','../../../utilities/metric-logger','projects','Retrieving\x20artifacts\x20from\x20','dependencies','error','url','filter','indexOf','log','addTaskToGraph','defineProperty','length','catch','../../../utilities/environment','scheduleTask','terminalOutput','axiosException','note','throw','findTask','splitTasksIntoStages','reset','configuration','projectGraph','assign','commandStatus','getRunGroup','start','status','strictlyOrderedTargets','../../../utilities/waiter','retrieve','../../error/print-run-group-error','tasks','write','Observable','done','./node_modules/.cache/nx','encryptionKey','exit','ENCRYPTION_KEY','DistributedExecutionApi','completeRunGroupWithError','target','Error:','Command\x20execution\x20failed.','Status\x20update','has','TaskGraphCreator','printRunGroupError','finally','addTaskDependencies','executionStatus','Processing\x20task\x20','nxCloudDistributedTasksRunner','keys','cacheDirectory','FileStorage','build','Waiter','addDependencies','Waiting...','addVerticalSeparator','completedTasks','COMPLETED','next','nodes','See\x20run\x20details\x20at\x20','createStartRequest','./distributed-execution.api','runUrl','then','message','__esModule','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','taskId','E2EEncryption','hash','Found\x20unknown\x20task:\x20','createNoNewMessagesTimeout','self','criticalErrorMessage','size'];(function(_0x216879,_0x408b1a){const _0x232e29=function(_0x4a8a6e){while(--_0x4a8a6e){_0x216879['push'](_0x216879['shift']());}};_0x232e29(++_0x408b1a);}(a7_0x408b,0xf0));const a7_0x232e=function(_0x216879,_0x408b1a){_0x216879=_0x216879-0x0;let _0x232e29=a7_0x408b[_0x216879];return _0x232e29;};'use strict';var __awaiter=this&&this[a7_0x232e('0x49')]||function(_0x2f7af0,_0xa42779,_0x2c917a,_0x4222e0){function _0x42f435(_0x6d91a5){return _0x6d91a5 instanceof _0x2c917a?_0x6d91a5:new _0x2c917a(function(_0x3954bd){_0x3954bd(_0x6d91a5);});}return new(_0x2c917a||(_0x2c917a=Promise))(function(_0xefd349,_0x4d1fa7){function _0x455ebe(_0x1fe552){try{_0x59837d(_0x4222e0[a7_0x232e('0x30')](_0x1fe552));}catch(_0x26a18a){_0x4d1fa7(_0x26a18a);}}function _0x4885e2(_0x7166ff){try{_0x59837d(_0x4222e0[a7_0x232e('0x1')](_0x7166ff));}catch(_0x1e6040){_0x4d1fa7(_0x1e6040);}}function _0x59837d(_0x52010b){_0x52010b[a7_0x232e('0x13')]?_0xefd349(_0x52010b['value']):_0x42f435(_0x52010b[a7_0x232e('0x4e')])['then'](_0x455ebe,_0x4885e2);}_0x59837d((_0x4222e0=_0x4222e0['apply'](_0x2f7af0,_0xa42779||[]))[a7_0x232e('0x30')]());});};Object[a7_0x232e('0x5f')](exports,a7_0x232e('0x38'),{'value':!![]});exports[a7_0x232e('0x1f')]=exports[a7_0x232e('0x25')]=void 0x0;const Observable_1=require('rxjs/internal/Observable');const stripJsonComments=require('strip-json-comments');const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x232e('0x34'));const file_storage_1=require(a7_0x232e('0x51'));const e2e_encryption_1=require('../../file-storage/e2e-encryption');const waiter_1=require(a7_0x232e('0xd'));const environment_1=require(a7_0x232e('0x62'));const print_run_group_error_1=require(a7_0x232e('0xf'));const create_no_new_messages_timeout_1=require('../../../utilities/create-no-new-messages-timeout');const metric_logger_1=require(a7_0x232e('0x55'));const {output,getDependencyConfigs,getOutputs,unparse,Cache}=require('../../../utilities/nx-imports');class NoopLifeCycle{[a7_0x232e('0x63')](_0x5a8dd4){}['startTask'](_0x4b6039){}['endTask'](_0x4358dc,_0x2ad876){}}function runDistributedExecution(_0x1384ba,_0x49436e,_0x3489af,_0x1a0c8f,_0x4e93ab,_0x198574,_0xf2633d){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x40a3bc=JSON[a7_0x232e('0x45')](stripJsonComments((0x0,fs_1['readFileSync'])('nx.json')[a7_0x232e('0x4f')]()));const _0x55019a=new TaskOrderer(_0x3489af[a7_0x232e('0x6')],getDefaultDependencyConfigs(_0x40a3bc,_0x49436e))[a7_0x232e('0x3')](_0xf2633d);const _0x25e70=yield _0x1384ba[a7_0x232e('0xa')]((0x0,distributed_execution_api_1[a7_0x232e('0x33')])(_0x198574,_0x55019a,_0x49436e));return yield processTasks(_0x1384ba,_0x1a0c8f,_0x4e93ab,_0x49436e,_0x25e70,_0xf2633d,_0x3489af);});}function processTasks(_0x36c6ac,_0x18d5ab,_0x280b73,_0x1f69b1,_0x5be75a,_0x49c1be,_0x77e6fa){return __awaiter(this,void 0x0,void 0x0,function*(){const _0xfac152={};const _0xd95266=(0x0,create_no_new_messages_timeout_1[a7_0x232e('0x3e')])();const _0x40d271=new waiter_1[(a7_0x232e('0x2a'))]();while(!![]){if(environment_1['VERBOSE_LOGGING']){output[a7_0x232e('0x0')]({'title':a7_0x232e('0x2c')});}yield _0x40d271['wait']();const _0x4c5670=yield _0x36c6ac[a7_0x232e('0xb')](_0x5be75a);if(environment_1[a7_0x232e('0x54')]){output['note']({'title':a7_0x232e('0x1d'),'bodyLines':['executionId:\x20'+_0x5be75a,'executionStatus:\x20'+_0x4c5670[a7_0x232e('0x23')],'number\x20of\x20completed\x20tasks:\x20'+_0x4c5670['completedTasks'][a7_0x232e('0x60')],'error:\x20'+_0x4c5670['criticalErrorMessage']]});}if(_0x4c5670[a7_0x232e('0x40')]){output['error']({'title':'Distributed\x20Execution\x20Terminated','bodyLines':[a7_0x232e('0x1b'),_0x4c5670[a7_0x232e('0x40')]]});process[a7_0x232e('0x16')](0x1);}_0xd95266(_0x4c5670['completedTasks'][a7_0x232e('0x60')]);for(const _0x31e2a9 of _0x4c5670[a7_0x232e('0x2e')]){if(_0xfac152[_0x31e2a9[a7_0x232e('0x3a')]])continue;yield processTask(_0x18d5ab,_0x280b73,_0x77e6fa,_0x1f69b1,_0x49c1be,_0x31e2a9);_0x40d271[a7_0x232e('0x4')]();_0xfac152[_0x31e2a9[a7_0x232e('0x3a')]]=!![];}if(_0x4c5670[a7_0x232e('0x23')]===a7_0x232e('0x2f')){return{'commandStatus':_0x4c5670['commandStatus'],'runUrl':_0x4c5670[a7_0x232e('0x35')]};}}});}function processTask(_0x3156c4,_0x55dc1f,_0x2a36ed,_0x53a162,_0x14858f,_0x3bc670){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a7_0x232e('0x54')]){output[a7_0x232e('0x0')]({'title':a7_0x232e('0x24')+_0x3bc670['taskId']});}const _0x5ee6d0=_0x14858f[a7_0x232e('0x46')](_0x36c397=>_0x3bc670[a7_0x232e('0x3a')]===_0x36c397['id']);if(!_0x5ee6d0){throw new Error(a7_0x232e('0x3d')+_0x3bc670[a7_0x232e('0x3a')]);}if(environment_1[a7_0x232e('0x54')]){output['note']({'title':a7_0x232e('0x57')+_0x3bc670[a7_0x232e('0x5a')]});}yield _0x3156c4[a7_0x232e('0xe')](_0x3bc670[a7_0x232e('0x3c')],_0x3bc670[a7_0x232e('0x5a')],_0x53a162[a7_0x232e('0x27')]||a7_0x232e('0x14'));const _0x3ce6e2=yield _0x55dc1f['get'](Object[a7_0x232e('0x7')](Object[a7_0x232e('0x7')]({},_0x5ee6d0),{'hash':_0x3bc670['hash']}));const _0x19054a=getOutputs(_0x2a36ed[a7_0x232e('0x6')][a7_0x232e('0x31')],_0x5ee6d0);if(environment_1[a7_0x232e('0x54')]){output['note']({'title':'Extracting\x20artifacts','bodyLines':_0x19054a});}yield _0x55dc1f['copyFilesFromCache'](_0x3bc670[a7_0x232e('0x3c')],_0x3ce6e2,_0x19054a);output['logCommand'](getCommand(_0x5ee6d0));process[a7_0x232e('0x4d')][a7_0x232e('0x11')](_0x3ce6e2[a7_0x232e('0x64')]);output[a7_0x232e('0x2d')]();});}function getCommand(_0xb0e20b){const _0x252bdf=unparse(_0xb0e20b[a7_0x232e('0x53')]||{});const _0x228020=_0xb0e20b['target'][a7_0x232e('0x5')]?':'+_0xb0e20b[a7_0x232e('0x1a')]['configuration']:'';return['nx','run',_0xb0e20b[a7_0x232e('0x1a')][a7_0x232e('0x50')]+':'+_0xb0e20b[a7_0x232e('0x1a')]['target']+_0x228020,..._0x252bdf]['join']('\x20');}const nxCloudDistributedTasksRunner=(_0x28c17a,_0x2b672a,_0x28a54d)=>{if(environment_1[a7_0x232e('0x54')]){output[a7_0x232e('0x0')]({'title':a7_0x232e('0x4a')});}_0x2b672a[a7_0x232e('0x48')]=new NoopLifeCycle();const _0x11e4b7=(0x0,environment_1[a7_0x232e('0x9')])();if(!_0x11e4b7){(0x0,print_run_group_error_1[a7_0x232e('0x20')])();return process[a7_0x232e('0x16')](0x1);}const _0x2e5dc6=new e2e_encryption_1[(a7_0x232e('0x3b'))](environment_1[a7_0x232e('0x17')]||_0x2b672a[a7_0x232e('0x15')]);const _0x10deca=new file_storage_1[(a7_0x232e('0x28'))](_0x2e5dc6);const _0x58abd9=new Cache(_0x2b672a);const _0x4cf784=new distributed_execution_api_1[(a7_0x232e('0x18'))](_0x2b672a);runDistributedExecution(_0x4cf784,_0x2b672a,_0x28a54d,_0x10deca,_0x58abd9,_0x11e4b7,_0x28c17a)[a7_0x232e('0x36')](_0x59ec87=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0x59ec87[a7_0x232e('0x8')]===0x0){output['success']({'title':a7_0x232e('0x52'),'bodyLines':[a7_0x232e('0x32')+_0x59ec87[a7_0x232e('0x35')]]});}else{output[a7_0x232e('0x59')]({'title':a7_0x232e('0x1c'),'bodyLines':[a7_0x232e('0x32')+_0x59ec87[a7_0x232e('0x35')]]});}yield(0x0,metric_logger_1[a7_0x232e('0x42')])(_0x2b672a);process[a7_0x232e('0x16')](_0x59ec87[a7_0x232e('0x8')]);}))[a7_0x232e('0x61')](_0x5f4549=>{output[a7_0x232e('0x59')]({'title':'Unable\x20to\x20complete\x20a\x20run.','bodyLines':[_0x5f4549[a7_0x232e('0x37')]]});if(_0x5f4549['axiosException']){console[a7_0x232e('0x5d')](_0x5f4549[a7_0x232e('0x65')]);}else{console['log'](_0x5f4549);}_0x4cf784[a7_0x232e('0x19')](_0x11e4b7,a7_0x232e('0x39')+_0x5f4549[a7_0x232e('0x37')]+'\x22')[a7_0x232e('0x21')](()=>process[a7_0x232e('0x16')](0x1));});return new Observable_1[(a7_0x232e('0x12'))](()=>{});};exports[a7_0x232e('0x25')]=nxCloudDistributedTasksRunner;class TaskOrderer{constructor(_0x42623b,_0x59d506){this[a7_0x232e('0x6')]=_0x42623b;this['defaultTargetDependencies']=_0x59d506;}[a7_0x232e('0x3')](_0x48b59a){if(_0x48b59a[a7_0x232e('0x60')]===0x0)return[];const _0x332639=[];const _0x1349cb=this[a7_0x232e('0x47')](_0x48b59a);const _0x35e3fb=new Set(_0x48b59a[a7_0x232e('0x4c')](_0x579b0f=>_0x579b0f['id']));let _0x3d7a8c=0x0;while(_0x35e3fb[a7_0x232e('0x41')]>0x0){const _0x3c3441=_0x332639[_0x3d7a8c]=[];for(const _0x25fda4 of _0x35e3fb){let _0x4bb4b8=!![];for(const _0x3f7e94 of _0x1349cb['dependencies'][_0x25fda4]){if(_0x35e3fb[a7_0x232e('0x1e')](_0x3f7e94)){_0x4bb4b8=![];break;}}if(!_0x4bb4b8){continue;}const _0x1070c5=_0x1349cb[a7_0x232e('0x10')][_0x25fda4];_0x3c3441[a7_0x232e('0x4b')](_0x1070c5);}for(const _0x33f662 of _0x3c3441){_0x35e3fb[a7_0x232e('0x43')](_0x33f662['id']);}_0x3d7a8c++;}return _0x332639;}['createTaskGraph'](_0x48c6b5){const _0x33ab30=new TaskGraphCreator(this[a7_0x232e('0x6')],this[a7_0x232e('0x44')]);return _0x33ab30[a7_0x232e('0x47')](_0x48c6b5);}}class TaskGraphCreator{constructor(_0x3dcf6a,_0x58999c){this[a7_0x232e('0x6')]=_0x3dcf6a;this[a7_0x232e('0x44')]=_0x58999c;}[a7_0x232e('0x47')](_0x1cb138){const _0x124052={'roots':[],'tasks':{},'dependencies':{}};for(const _0xc538bb of _0x1cb138){this[a7_0x232e('0x5e')](_0xc538bb,_0x124052);const _0x17de61=getDependencyConfigs(_0xc538bb[a7_0x232e('0x1a')],this['defaultTargetDependencies'],this['projectGraph']);if(!_0x17de61){continue;}this[a7_0x232e('0x22')](_0xc538bb,_0x17de61,_0x1cb138,_0x124052);}_0x124052['roots']=Object[a7_0x232e('0x26')](_0x124052[a7_0x232e('0x58')])[a7_0x232e('0x5b')](_0x4c0f92=>_0x124052[a7_0x232e('0x58')][_0x4c0f92][a7_0x232e('0x60')]===0x0);return _0x124052;}[a7_0x232e('0x22')](_0x32cdda,_0x4a76aa,_0xd2d3c5,_0x49a15a){for(const _0x3b54b1 of _0x4a76aa){if(_0x3b54b1['projects']===a7_0x232e('0x3f')){for(const _0x4f2ba8 of _0xd2d3c5){if(_0x4f2ba8[a7_0x232e('0x1a')][a7_0x232e('0x50')]===_0x32cdda[a7_0x232e('0x1a')][a7_0x232e('0x50')]&&_0x4f2ba8[a7_0x232e('0x1a')]['target']===_0x3b54b1[a7_0x232e('0x1a')]){_0x49a15a[a7_0x232e('0x58')][_0x32cdda['id']][a7_0x232e('0x4b')](_0x4f2ba8['id']);}}}else if(_0x3b54b1[a7_0x232e('0x56')]===a7_0x232e('0x58')){const _0x2c78e3=new Set();this['addDependencies'](_0x32cdda['target'][a7_0x232e('0x50')],_0x3b54b1['target'],_0xd2d3c5,_0x49a15a,_0x32cdda['id'],_0x2c78e3);}}}['addDependencies'](_0x368c6b,_0x56fa57,_0x3f37ef,_0x4fc240,_0x1f5de0,_0x4288c6){_0x4288c6['add'](_0x368c6b);const _0x17c801=this['projectGraph'][a7_0x232e('0x58')][_0x368c6b];if(_0x17c801){const _0x1582d4=_0x17c801[a7_0x232e('0x4c')](_0x31502d=>_0x31502d['target']);for(const _0x319155 of _0x1582d4){if(_0x4288c6[a7_0x232e('0x1e')](_0x319155)){continue;}const _0x747902=this['findTask']({'project':_0x319155,'target':_0x56fa57},_0x3f37ef);if(_0x747902){if(_0x4fc240[a7_0x232e('0x58')][_0x1f5de0][a7_0x232e('0x5c')](_0x747902['id'])===-0x1){_0x4fc240[a7_0x232e('0x58')][_0x1f5de0][a7_0x232e('0x4b')](_0x747902['id']);}}else{this[a7_0x232e('0x2b')](_0x319155,_0x56fa57,_0x3f37ef,_0x4fc240,_0x1f5de0,_0x4288c6);}}}}[a7_0x232e('0x2')]({project,target},_0x3cce5b){return _0x3cce5b[a7_0x232e('0x46')](_0x4d3ae6=>_0x4d3ae6[a7_0x232e('0x1a')]['project']===project&&_0x4d3ae6[a7_0x232e('0x1a')][a7_0x232e('0x1a')]===target);}['addTaskToGraph'](_0x2a4fda,_0x326bd4){_0x326bd4[a7_0x232e('0x10')][_0x2a4fda['id']]=_0x2a4fda;_0x326bd4[a7_0x232e('0x58')][_0x2a4fda['id']]=[];}}exports[a7_0x232e('0x1f')]=TaskGraphCreator;function getDefaultDependencyConfigs(_0x5a378c,_0x103954){var _0x1bd6a7,_0x9a9753;const _0x500ec4=(_0x1bd6a7=_0x5a378c['targetDependencies'])!==null&&_0x1bd6a7!==void 0x0?_0x1bd6a7:{};const _0x19fc5a=_0x103954?(_0x9a9753=_0x103954[a7_0x232e('0xc')])!==null&&_0x9a9753!==void 0x0?_0x9a9753:[a7_0x232e('0x29')]:[];for(const _0x4b75cc of _0x19fc5a){_0x500ec4[_0x4b75cc]=_0x500ec4[_0x4b75cc]||[];_0x500ec4[_0x4b75cc][a7_0x232e('0x4b')]({'target':_0x4b75cc,'projects':a7_0x232e('0x58')});}return _0x500ec4;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/generators/init/init.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAkC;AAClC,+BAAkC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/generators/init/init.ts"],"names":[],"mappings":"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"}
|