@nrwl/nx-cloud 14.0.6-beta.1 → 14.0.8
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 -65
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -141
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -169
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -113
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -166
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -79
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -240
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -130
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -309
- package/lib/utilities/nx-imports.js +9 -3
- package/lib/utilities/nx-imports.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_0x1c55=['response','message','next','axiosMultipleTries','error','../../../utilities/nx-imports','/nx-cloud/executions/complete-run-group','target','data','enabled','project','dteStatus','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','overrides','stopAgentsOnFailure','configuration','mapRespToPerfEntry','throw','/nx-cloud/executions/status','__esModule','post','getBranch','../../../utilities/axios','apiAxiosInstance','/nx-cloud/executions/start','RUNNER_FAILURE_PERF_ENTRY','createMetricRecorder','createApiAxiosInstance','start','value','map','DistributedExecutionApi','../../../utilities/metric-logger','axiosException','dteStart','apply','../../../utilities/environment','maxParallel','false','then','parallel','createStartRequest','completeRunGroupWithError','recordMetric','__awaiter','exit','status'];(function(_0x8dc40c,_0x1c5560){const _0x36e45c=function(_0x21b7d6){while(--_0x21b7d6){_0x8dc40c['push'](_0x8dc40c['shift']());}};_0x36e45c(++_0x1c5560);}(a6_0x1c55,0x89));const a6_0x36e4=function(_0x8dc40c,_0x1c5560){_0x8dc40c=_0x8dc40c-0x0;let _0x36e45c=a6_0x1c55[_0x8dc40c];return _0x36e45c;};'use strict';var __awaiter=this&&this[a6_0x36e4('0x4')]||function(_0x371b93,_0x2ec05b,_0x5e09b7,_0x2d2e17){function _0x1fc04a(_0x8e46ca){return _0x8e46ca instanceof _0x5e09b7?_0x8e46ca:new _0x5e09b7(function(_0x263781){_0x263781(_0x8e46ca);});}return new(_0x5e09b7||(_0x5e09b7=Promise))(function(_0x1aebd8,_0x1b4b8c){function _0x3ca303(_0x2813b3){try{_0x45edda(_0x2d2e17[a6_0x36e4('0x9')](_0x2813b3));}catch(_0x32550c){_0x1b4b8c(_0x32550c);}}function _0x5102b7(_0x341623){try{_0x45edda(_0x2d2e17[a6_0x36e4('0x19')](_0x341623));}catch(_0x402a8c){_0x1b4b8c(_0x402a8c);}}function _0x45edda(_0x2fa513){_0x2fa513['done']?_0x1aebd8(_0x2fa513[a6_0x36e4('0x25')]):_0x1fc04a(_0x2fa513[a6_0x36e4('0x25')])[a6_0x36e4('0x2f')](_0x3ca303,_0x5102b7);}_0x45edda((_0x2d2e17=_0x2d2e17[a6_0x36e4('0x2b')](_0x371b93,_0x2ec05b||[]))[a6_0x36e4('0x9')]());});};Object['defineProperty'](exports,a6_0x36e4('0x1b'),{'value':!![]});exports[a6_0x36e4('0x1')]=exports[a6_0x36e4('0x27')]=void 0x0;const axios_1=require(a6_0x36e4('0x1e'));const environment_1=require(a6_0x36e4('0x2c'));const metric_logger_1=require(a6_0x36e4('0x28'));const {output,unparse}=require(a6_0x36e4('0xc'));class DistributedExecutionApi{constructor(_0x449923){this[a6_0x36e4('0x1f')]=(0x0,axios_1[a6_0x36e4('0x23')])(_0x449923);}[a6_0x36e4('0x24')](_0x483d82){var _0x2191eb;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4f363c=(0x0,metric_logger_1[a6_0x36e4('0x22')])(a6_0x36e4('0x2a'));let _0x575201;try{_0x575201=yield(0x0,axios_1[a6_0x36e4('0xa')])(()=>this[a6_0x36e4('0x1f')][a6_0x36e4('0x1c')](a6_0x36e4('0x20'),_0x483d82));_0x4f363c[a6_0x36e4('0x3')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x575201));}catch(_0x584793){_0x4f363c[a6_0x36e4('0x3')](((_0x2191eb=_0x584793===null||_0x584793===void 0x0?void 0x0:_0x584793[a6_0x36e4('0x29')])===null||_0x2191eb===void 0x0?void 0x0:_0x2191eb['response'])?(0x0,metric_logger_1[a6_0x36e4('0x18')])(_0x584793['axiosException']['response']):metric_logger_1[a6_0x36e4('0x21')]);throw _0x584793;}if(!_0x575201[a6_0x36e4('0xf')][a6_0x36e4('0x10')]){throw new Error('Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.');}if(_0x575201['data'][a6_0x36e4('0xb')]){throw new Error(_0x575201[a6_0x36e4('0xf')][a6_0x36e4('0xb')]);}return _0x575201['data']['id'];});}[a6_0x36e4('0x6')](_0x273b17){var _0xab9bad;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1b85a6=(0x0,metric_logger_1[a6_0x36e4('0x22')])(a6_0x36e4('0x12'));try{const _0x1d9acf=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a6_0x36e4('0x1f')][a6_0x36e4('0x1c')](a6_0x36e4('0x1a'),{'id':_0x273b17}));_0x1b85a6[a6_0x36e4('0x3')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x1d9acf));return _0x1d9acf[a6_0x36e4('0xf')];}catch(_0x2f927c){_0x1b85a6['recordMetric'](((_0xab9bad=_0x2f927c===null||_0x2f927c===void 0x0?void 0x0:_0x2f927c['axiosException'])===null||_0xab9bad===void 0x0?void 0x0:_0xab9bad['response'])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x2f927c['axiosException']['response']):metric_logger_1[a6_0x36e4('0x21')]);output['error']({'title':_0x2f927c[a6_0x36e4('0x8')]});process[a6_0x36e4('0x5')](0x1);}});}[a6_0x36e4('0x2')](_0x2eabbb,_0x55bd52){var _0x424fa3;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x52be39=(0x0,metric_logger_1[a6_0x36e4('0x22')])('completeRunGroup');try{const _0x5b7b78=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a6_0x36e4('0x1f')][a6_0x36e4('0x1c')](a6_0x36e4('0xd'),{'runGroup':_0x2eabbb,'criticalErrorMessage':_0x55bd52}),0x3);_0x52be39[a6_0x36e4('0x3')]((0x0,metric_logger_1[a6_0x36e4('0x18')])(_0x5b7b78));}catch(_0x345d7c){_0x52be39['recordMetric'](((_0x424fa3=_0x345d7c===null||_0x345d7c===void 0x0?void 0x0:_0x345d7c['axiosException'])===null||_0x424fa3===void 0x0?void 0x0:_0x424fa3['response'])?(0x0,metric_logger_1[a6_0x36e4('0x18')])(_0x345d7c[a6_0x36e4('0x29')][a6_0x36e4('0x7')]):metric_logger_1[a6_0x36e4('0x21')]);}});}}exports[a6_0x36e4('0x27')]=DistributedExecutionApi;function createStartRequest(_0x1c3669,_0x3afd8b,_0x2f8f29){const _0x28f9dc=_0x3afd8b[a6_0x36e4('0x26')](_0x8b95f1=>{return _0x8b95f1[a6_0x36e4('0x26')](_0x1ad618=>{return{'taskId':_0x1ad618['id'],'hash':_0x1ad618['hash'],'projectName':_0x1ad618[a6_0x36e4('0xe')][a6_0x36e4('0x11')],'target':_0x1ad618[a6_0x36e4('0xe')][a6_0x36e4('0xe')],'configuration':_0x1ad618[a6_0x36e4('0xe')][a6_0x36e4('0x17')]||null,'params':unparse(_0x1ad618[a6_0x36e4('0x15')])['join']('\x20')};});});const _0x21f904={'command':(0x0,environment_1['parseCommand'])(),'branch':(0x0,environment_1[a6_0x36e4('0x1d')])(),'runGroup':_0x1c3669,'tasks':_0x28f9dc,'maxParallel':calculateMaxParallel(_0x2f8f29)};if(environment_1[a6_0x36e4('0x13')]){_0x21f904['agentCount']=environment_1[a6_0x36e4('0x13')];}if(!environment_1[a6_0x36e4('0x14')]){_0x21f904[a6_0x36e4('0x16')]=![];}return _0x21f904;}exports[a6_0x36e4('0x1')]=createStartRequest;function calculateMaxParallel(_0x411975){if(_0x411975['parallel']===a6_0x36e4('0x2e')||_0x411975['parallel']===![]){return 0x1;}else if(_0x411975['parallel']==='true'||_0x411975[a6_0x36e4('0x0')]===!![]){return Number(_0x411975[a6_0x36e4('0x2d')]||0x3);}else if(_0x411975[a6_0x36e4('0x0')]===undefined){return _0x411975[a6_0x36e4('0x2d')]?Number(_0x411975[a6_0x36e4('0x2d')]):0x3;}else{return Number(_0x411975[a6_0x36e4('0x0')])||0x3;}}
|
|
@@ -1,309 +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 stripJsonComments = require("strip-json-comments");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
|
-
const distributed_execution_api_1 = require("./distributed-execution.api");
|
|
16
|
-
const file_storage_1 = require("../../file-storage/file-storage");
|
|
17
|
-
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
18
|
-
const waiter_1 = require("../../../utilities/waiter");
|
|
19
|
-
const environment_1 = require("../../../utilities/environment");
|
|
20
|
-
const print_run_group_error_1 = require("../../error/print-run-group-error");
|
|
21
|
-
const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
|
|
22
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
23
|
-
const error_reporter_api_1 = require("../../api/error-reporter.api");
|
|
24
|
-
const { output, workspaceRoot, 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)(`${workspaceRoot}/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) => __awaiter(void 0, void 0, void 0, function* () {
|
|
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 errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
|
|
140
|
-
const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true);
|
|
141
|
-
const cache = new Cache(options);
|
|
142
|
-
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
|
|
143
|
-
try {
|
|
144
|
-
const r = yield runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks);
|
|
145
|
-
if (r.commandStatus === 0) {
|
|
146
|
-
output.success({
|
|
147
|
-
title: 'Successfully completed running the command.',
|
|
148
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
output.error({
|
|
153
|
-
title: 'Command execution failed.',
|
|
154
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
158
|
-
process.exit(r.commandStatus);
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
output.error({
|
|
162
|
-
title: 'Unable to complete a run.',
|
|
163
|
-
bodyLines: [e.message],
|
|
164
|
-
});
|
|
165
|
-
if (e.axiosException) {
|
|
166
|
-
console.log(e.axiosException);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
console.log(e);
|
|
170
|
-
}
|
|
171
|
-
try {
|
|
172
|
-
yield api.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`);
|
|
173
|
-
}
|
|
174
|
-
finally {
|
|
175
|
-
process.exit(1);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
|
|
180
|
-
class TaskOrderer {
|
|
181
|
-
constructor(projectGraph, defaultTargetDependencies) {
|
|
182
|
-
this.projectGraph = projectGraph;
|
|
183
|
-
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
184
|
-
}
|
|
185
|
-
splitTasksIntoStages(tasks) {
|
|
186
|
-
if (tasks.length === 0)
|
|
187
|
-
return [];
|
|
188
|
-
const stages = [];
|
|
189
|
-
const taskGraph = this.createTaskGraph(tasks);
|
|
190
|
-
const notStagedTaskIds = new Set(tasks.map((t) => t.id));
|
|
191
|
-
let stageIndex = 0;
|
|
192
|
-
// Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
|
|
193
|
-
while (notStagedTaskIds.size > 0) {
|
|
194
|
-
const currentStage = (stages[stageIndex] = []);
|
|
195
|
-
for (const taskId of notStagedTaskIds) {
|
|
196
|
-
let ready = true;
|
|
197
|
-
for (const dependency of taskGraph.dependencies[taskId]) {
|
|
198
|
-
if (notStagedTaskIds.has(dependency)) {
|
|
199
|
-
// dependency has not been staged yet, this task is not ready to be staged.
|
|
200
|
-
ready = false;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
// Some dependency still has not been staged, skip it for now, it will be processed again
|
|
205
|
-
if (!ready) {
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
// All the dependencies have been staged, let's stage it.
|
|
209
|
-
const task = taskGraph.tasks[taskId];
|
|
210
|
-
currentStage.push(task);
|
|
211
|
-
}
|
|
212
|
-
// Remove the entire new stage of tasks from the list
|
|
213
|
-
for (const task of currentStage) {
|
|
214
|
-
notStagedTaskIds.delete(task.id);
|
|
215
|
-
}
|
|
216
|
-
stageIndex++;
|
|
217
|
-
}
|
|
218
|
-
return stages;
|
|
219
|
-
}
|
|
220
|
-
createTaskGraph(tasks) {
|
|
221
|
-
const t = new TaskGraphCreator(this.projectGraph, this.defaultTargetDependencies);
|
|
222
|
-
return t.createTaskGraph(tasks);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
class TaskGraphCreator {
|
|
226
|
-
constructor(projectGraph, defaultTargetDependencies) {
|
|
227
|
-
this.projectGraph = projectGraph;
|
|
228
|
-
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
229
|
-
}
|
|
230
|
-
createTaskGraph(tasks) {
|
|
231
|
-
const graph = {
|
|
232
|
-
roots: [],
|
|
233
|
-
tasks: {},
|
|
234
|
-
dependencies: {},
|
|
235
|
-
};
|
|
236
|
-
for (const task of tasks) {
|
|
237
|
-
this.addTaskToGraph(task, graph);
|
|
238
|
-
const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
|
|
239
|
-
if (!dependencyConfigs) {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
|
|
243
|
-
}
|
|
244
|
-
graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
|
|
245
|
-
return graph;
|
|
246
|
-
}
|
|
247
|
-
addTaskDependencies(task, dependencyConfigs, tasks, graph) {
|
|
248
|
-
for (const dependencyConfig of dependencyConfigs) {
|
|
249
|
-
if (dependencyConfig.projects === 'self') {
|
|
250
|
-
for (const t of tasks) {
|
|
251
|
-
if (t.target.project === task.target.project &&
|
|
252
|
-
t.target.target === dependencyConfig.target) {
|
|
253
|
-
graph.dependencies[task.id].push(t.id);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else if (dependencyConfig.projects === 'dependencies') {
|
|
258
|
-
const seen = new Set();
|
|
259
|
-
this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
addDependencies(project, target, tasks, graph, taskId, seen) {
|
|
264
|
-
seen.add(project);
|
|
265
|
-
const dependencies = this.projectGraph.dependencies[project];
|
|
266
|
-
if (dependencies) {
|
|
267
|
-
const projectDependencies = dependencies.map((dependency) => dependency.target);
|
|
268
|
-
for (const projectDependency of projectDependencies) {
|
|
269
|
-
if (seen.has(projectDependency)) {
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
const dependency = this.findTask({ project: projectDependency, target }, tasks);
|
|
273
|
-
if (dependency) {
|
|
274
|
-
if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
|
|
275
|
-
graph.dependencies[taskId].push(dependency.id);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
findTask({ project, target }, tasks) {
|
|
285
|
-
return tasks.find((t) => t.target.project === project && t.target.target === target);
|
|
286
|
-
}
|
|
287
|
-
addTaskToGraph(task, graph) {
|
|
288
|
-
graph.tasks[task.id] = task;
|
|
289
|
-
graph.dependencies[task.id] = [];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
exports.TaskGraphCreator = TaskGraphCreator;
|
|
293
|
-
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
|
|
294
|
-
var _a, _b;
|
|
295
|
-
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
|
|
296
|
-
const strictlyOrderedTargets = runnerOptions
|
|
297
|
-
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
|
|
298
|
-
: [];
|
|
299
|
-
// Strictly Ordered Targets depend on their dependencies
|
|
300
|
-
for (const target of strictlyOrderedTargets) {
|
|
301
|
-
defaults[target] = defaults[target] || [];
|
|
302
|
-
defaults[target].push({
|
|
303
|
-
target,
|
|
304
|
-
projects: 'dependencies',
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
return defaults;
|
|
308
|
-
}
|
|
309
|
-
//# sourceMappingURL=distributed-execution.runner.js.map
|
|
1
|
+
const a7_0x57c3=['Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','targetDependencies','size','./distributed-execution.api','executionStatus:\x20','Retrieving\x20artifacts\x20from\x20','COMPLETED','addTaskDependencies','url','ENCRYPTION_KEY','terminalOutput','delete','runUrl','../../../utilities/metric-logger','addTaskToGraph','findTask','reset','number\x20of\x20completed\x20tasks:\x20','strictlyOrderedTargets','configuration','done','indexOf','hash','target','assign','splitTasksIntoStages','readFileSync','length','criticalErrorMessage','projects','Starting\x20distributed\x20command\x20execution','completedTasks','nxCloudDistributedTasksRunner','addDependencies','Command\x20execution\x20failed.','../../../utilities/waiter','has','run','encryptionKey','ErrorReporterApi','Successfully\x20completed\x20running\x20the\x20command.','logCommand','project','commandStatus','defaultTargetDependencies','VERBOSE_LOGGING','stdout','tasks','__awaiter','TaskGraphCreator','executionId:\x20','../../error/print-run-group-error','E2EEncryption','build','filter','map','exit','message','start','../../../utilities/create-no-new-messages-timeout','cacheDirectory','addVerticalSeparator','find','lifeCycle','endTask','printRunGroupError','strip-json-comments','error','join','completeRunGroupWithError','Waiter','defineProperty','createStartRequest','../../file-storage/e2e-encryption','add','dependencies','./node_modules/.cache/nx','axiosException','executionStatus','value','scheduleTask','FileStorage','projectGraph','self','toString','startTask','taskId','../../../utilities/environment','Extracting\x20artifacts','createTaskGraph','log','Error:','parse','__esModule','overrides','push','Waiting...','keys','note','write','../../file-storage/file-storage','roots','Processing\x20task\x20','submitRunMetrics','See\x20run\x20details\x20at\x20','success','nodes','then','Found\x20unknown\x20task:\x20'];(function(_0x47b77f,_0x57c384){const _0x493140=function(_0x21325c){while(--_0x21325c){_0x47b77f['push'](_0x47b77f['shift']());}};_0x493140(++_0x57c384);}(a7_0x57c3,0x191));const a7_0x4931=function(_0x47b77f,_0x57c384){_0x47b77f=_0x47b77f-0x0;let _0x493140=a7_0x57c3[_0x47b77f];return _0x493140;};'use strict';var __awaiter=this&&this[a7_0x4931('0x53')]||function(_0x95a642,_0x21c9ea,_0x65a14f,_0x1c91ee){function _0xec83c9(_0x1b8d98){return _0x1b8d98 instanceof _0x65a14f?_0x1b8d98:new _0x65a14f(function(_0x54d930){_0x54d930(_0x1b8d98);});}return new(_0x65a14f||(_0x65a14f=Promise))(function(_0x47ec6e,_0x526e75){function _0x3248c2(_0x2e299b){try{_0x1f3e81(_0x1c91ee['next'](_0x2e299b));}catch(_0x30c41a){_0x526e75(_0x30c41a);}}function _0x40d160(_0x403dcc){try{_0x1f3e81(_0x1c91ee['throw'](_0x403dcc));}catch(_0x1e4af4){_0x526e75(_0x1e4af4);}}function _0x1f3e81(_0x114734){_0x114734[a7_0x4931('0x37')]?_0x47ec6e(_0x114734['value']):_0xec83c9(_0x114734[a7_0x4931('0x5')])[a7_0x4931('0x21')](_0x3248c2,_0x40d160);}_0x1f3e81((_0x1c91ee=_0x1c91ee['apply'](_0x95a642,_0x21c9ea||[]))['next']());});};Object[a7_0x4931('0x6a')](exports,a7_0x4931('0x13'),{'value':!![]});exports[a7_0x4931('0x54')]=exports[a7_0x4931('0x43')]=void 0x0;const stripJsonComments=require(a7_0x4931('0x65'));const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x4931('0x26'));const file_storage_1=require(a7_0x4931('0x1a'));const e2e_encryption_1=require(a7_0x4931('0x6c'));const waiter_1=require(a7_0x4931('0x46'));const environment_1=require(a7_0x4931('0xd'));const print_run_group_error_1=require(a7_0x4931('0x56'));const create_no_new_messages_timeout_1=require(a7_0x4931('0x5e'));const metric_logger_1=require(a7_0x4931('0x30'));const error_reporter_api_1=require('../../api/error-reporter.api');const {output,workspaceRoot,getDependencyConfigs,getOutputs,unparse,Cache}=require('../../../utilities/nx-imports');class NoopLifeCycle{[a7_0x4931('0x6')](_0x2e3e46){}[a7_0x4931('0xb')](_0x11806b){}[a7_0x4931('0x63')](_0x3cde2b,_0x4ca545){}}function runDistributedExecution(_0x45122e,_0x3ddd82,_0x264f67,_0x3384c7,_0x483090,_0x2b8694,_0x82dd21){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x34b2a0=JSON[a7_0x4931('0x12')](stripJsonComments((0x0,fs_1[a7_0x4931('0x3d')])(workspaceRoot+'/nx.json')[a7_0x4931('0xa')]()));const _0x248d0d=new TaskOrderer(_0x264f67[a7_0x4931('0x8')],getDefaultDependencyConfigs(_0x34b2a0,_0x3ddd82))[a7_0x4931('0x3c')](_0x82dd21);const _0x19af0b=yield _0x45122e[a7_0x4931('0x5d')]((0x0,distributed_execution_api_1[a7_0x4931('0x6b')])(_0x2b8694,_0x248d0d,_0x3ddd82));return yield processTasks(_0x45122e,_0x3384c7,_0x483090,_0x3ddd82,_0x19af0b,_0x82dd21,_0x264f67);});}function processTasks(_0x68b70e,_0x535c19,_0x372307,_0x2242f2,_0x212d22,_0x575f23,_0x541205){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1ffe7f={};const _0x111981=(0x0,create_no_new_messages_timeout_1['createNoNewMessagesTimeout'])();const _0x4144af=new waiter_1[(a7_0x4931('0x69'))]();while(!![]){if(environment_1[a7_0x4931('0x50')]){output[a7_0x4931('0x18')]({'title':a7_0x4931('0x16')});}yield _0x4144af['wait']();const _0x40456a=yield _0x68b70e['status'](_0x212d22);if(environment_1['VERBOSE_LOGGING']){output['note']({'title':'Status\x20update','bodyLines':[a7_0x4931('0x55')+_0x212d22,a7_0x4931('0x27')+_0x40456a[a7_0x4931('0x4')],a7_0x4931('0x34')+_0x40456a[a7_0x4931('0x42')]['length'],'error:\x20'+_0x40456a[a7_0x4931('0x3f')]]});}if(_0x40456a[a7_0x4931('0x3f')]){output[a7_0x4931('0x66')]({'title':'Distributed\x20Execution\x20Terminated','bodyLines':[a7_0x4931('0x11'),_0x40456a['criticalErrorMessage']]});process[a7_0x4931('0x5b')](0x1);}_0x111981(_0x40456a[a7_0x4931('0x42')][a7_0x4931('0x3e')]);for(const _0x531641 of _0x40456a[a7_0x4931('0x42')]){if(_0x1ffe7f[_0x531641[a7_0x4931('0xc')]])continue;yield processTask(_0x535c19,_0x372307,_0x541205,_0x2242f2,_0x575f23,_0x531641);_0x4144af[a7_0x4931('0x33')]();_0x1ffe7f[_0x531641['taskId']]=!![];}if(_0x40456a[a7_0x4931('0x4')]===a7_0x4931('0x29')){return{'commandStatus':_0x40456a[a7_0x4931('0x4e')],'runUrl':_0x40456a[a7_0x4931('0x2f')]};}}});}function processTask(_0x4e1607,_0x37bc6f,_0x94426d,_0x927ec8,_0x595956,_0x14b5ea){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a7_0x4931('0x50')]){output['note']({'title':a7_0x4931('0x1c')+_0x14b5ea[a7_0x4931('0xc')]});}const _0x1b058b=_0x595956[a7_0x4931('0x61')](_0x3aef1d=>_0x14b5ea[a7_0x4931('0xc')]===_0x3aef1d['id']);if(!_0x1b058b){throw new Error(a7_0x4931('0x22')+_0x14b5ea[a7_0x4931('0xc')]);}if(environment_1[a7_0x4931('0x50')]){output[a7_0x4931('0x18')]({'title':a7_0x4931('0x28')+_0x14b5ea[a7_0x4931('0x2b')]});}yield _0x4e1607['retrieve'](_0x14b5ea[a7_0x4931('0x39')],_0x14b5ea['url'],_0x927ec8[a7_0x4931('0x5f')]||a7_0x4931('0x2'));const _0x342e7b=yield _0x37bc6f['get'](Object[a7_0x4931('0x3b')](Object[a7_0x4931('0x3b')]({},_0x1b058b),{'hash':_0x14b5ea[a7_0x4931('0x39')]}));const _0x4ea860=getOutputs(_0x94426d[a7_0x4931('0x8')][a7_0x4931('0x20')],_0x1b058b);if(environment_1[a7_0x4931('0x50')]){output[a7_0x4931('0x18')]({'title':a7_0x4931('0xe'),'bodyLines':_0x4ea860});}yield _0x37bc6f['copyFilesFromCache'](_0x14b5ea[a7_0x4931('0x39')],_0x342e7b,_0x4ea860);output[a7_0x4931('0x4c')](getCommand(_0x1b058b));process[a7_0x4931('0x51')][a7_0x4931('0x19')](_0x342e7b[a7_0x4931('0x2d')]);output[a7_0x4931('0x60')]();});}function getCommand(_0x130a5c){const _0x5c39ae=unparse(_0x130a5c[a7_0x4931('0x14')]||{});const _0x20339a=_0x130a5c['target']['configuration']?':'+_0x130a5c[a7_0x4931('0x3a')][a7_0x4931('0x36')]:'';return['nx',a7_0x4931('0x48'),_0x130a5c[a7_0x4931('0x3a')][a7_0x4931('0x4d')]+':'+_0x130a5c[a7_0x4931('0x3a')][a7_0x4931('0x3a')]+_0x20339a,..._0x5c39ae][a7_0x4931('0x67')]('\x20');}const nxCloudDistributedTasksRunner=(_0x479b4a,_0x388d95,_0x471632)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1[a7_0x4931('0x50')]){output['note']({'title':a7_0x4931('0x41')});}_0x388d95[a7_0x4931('0x62')]=new NoopLifeCycle();const _0x359fb0=(0x0,environment_1['getRunGroup'])();if(!_0x359fb0){(0x0,print_run_group_error_1[a7_0x4931('0x64')])();return process[a7_0x4931('0x5b')](0x1);}const _0x52bf81=new e2e_encryption_1[(a7_0x4931('0x57'))](environment_1[a7_0x4931('0x2c')]||_0x388d95[a7_0x4931('0x49')]);const _0x586baf=new error_reporter_api_1[(a7_0x4931('0x4a'))](_0x388d95);const _0x2d6dc4=new file_storage_1[(a7_0x4931('0x7'))](_0x52bf81,_0x586baf,!![]);const _0x936a49=new Cache(_0x388d95);const _0x42a246=new distributed_execution_api_1['DistributedExecutionApi'](_0x388d95);try{const _0x2ad979=yield runDistributedExecution(_0x42a246,_0x388d95,_0x471632,_0x2d6dc4,_0x936a49,_0x359fb0,_0x479b4a);if(_0x2ad979[a7_0x4931('0x4e')]===0x0){output[a7_0x4931('0x1f')]({'title':a7_0x4931('0x4b'),'bodyLines':[a7_0x4931('0x1e')+_0x2ad979['runUrl']]});}else{output[a7_0x4931('0x66')]({'title':a7_0x4931('0x45'),'bodyLines':[a7_0x4931('0x1e')+_0x2ad979[a7_0x4931('0x2f')]]});}yield(0x0,metric_logger_1[a7_0x4931('0x1d')])(_0x388d95);process[a7_0x4931('0x5b')](_0x2ad979[a7_0x4931('0x4e')]);}catch(_0x203c20){output[a7_0x4931('0x66')]({'title':'Unable\x20to\x20complete\x20a\x20run.','bodyLines':[_0x203c20[a7_0x4931('0x5c')]]});if(_0x203c20[a7_0x4931('0x3')]){console['log'](_0x203c20[a7_0x4931('0x3')]);}else{console[a7_0x4931('0x10')](_0x203c20);}try{yield _0x42a246[a7_0x4931('0x68')](_0x359fb0,a7_0x4931('0x23')+_0x203c20[a7_0x4931('0x5c')]+'\x22');}finally{process[a7_0x4931('0x5b')](0x1);}}});exports[a7_0x4931('0x43')]=nxCloudDistributedTasksRunner;class TaskOrderer{constructor(_0x553ab9,_0x4a8cda){this[a7_0x4931('0x8')]=_0x553ab9;this[a7_0x4931('0x4f')]=_0x4a8cda;}['splitTasksIntoStages'](_0x34e20a){if(_0x34e20a['length']===0x0)return[];const _0xfe72e1=[];const _0x5abf27=this[a7_0x4931('0xf')](_0x34e20a);const _0xf7b82b=new Set(_0x34e20a[a7_0x4931('0x5a')](_0x2881d9=>_0x2881d9['id']));let _0x4e6877=0x0;while(_0xf7b82b[a7_0x4931('0x25')]>0x0){const _0x25d3cd=_0xfe72e1[_0x4e6877]=[];for(const _0x10bafd of _0xf7b82b){let _0x23ff9f=!![];for(const _0x15b03d of _0x5abf27[a7_0x4931('0x1')][_0x10bafd]){if(_0xf7b82b[a7_0x4931('0x47')](_0x15b03d)){_0x23ff9f=![];break;}}if(!_0x23ff9f){continue;}const _0x263541=_0x5abf27[a7_0x4931('0x52')][_0x10bafd];_0x25d3cd[a7_0x4931('0x15')](_0x263541);}for(const _0x3a59a2 of _0x25d3cd){_0xf7b82b[a7_0x4931('0x2e')](_0x3a59a2['id']);}_0x4e6877++;}return _0xfe72e1;}[a7_0x4931('0xf')](_0x30da20){const _0xe97db3=new TaskGraphCreator(this['projectGraph'],this[a7_0x4931('0x4f')]);return _0xe97db3['createTaskGraph'](_0x30da20);}}class TaskGraphCreator{constructor(_0x5e539e,_0x504156){this[a7_0x4931('0x8')]=_0x5e539e;this[a7_0x4931('0x4f')]=_0x504156;}['createTaskGraph'](_0x39c439){const _0x58ddb5={'roots':[],'tasks':{},'dependencies':{}};for(const _0x43a34c of _0x39c439){this[a7_0x4931('0x31')](_0x43a34c,_0x58ddb5);const _0x74d887=getDependencyConfigs(_0x43a34c[a7_0x4931('0x3a')],this[a7_0x4931('0x4f')],this[a7_0x4931('0x8')]);if(!_0x74d887){continue;}this[a7_0x4931('0x2a')](_0x43a34c,_0x74d887,_0x39c439,_0x58ddb5);}_0x58ddb5[a7_0x4931('0x1b')]=Object[a7_0x4931('0x17')](_0x58ddb5[a7_0x4931('0x1')])[a7_0x4931('0x59')](_0x246d1f=>_0x58ddb5['dependencies'][_0x246d1f]['length']===0x0);return _0x58ddb5;}[a7_0x4931('0x2a')](_0x1b8abe,_0x403e8f,_0x13cdca,_0x49f640){for(const _0x8cfb8 of _0x403e8f){if(_0x8cfb8[a7_0x4931('0x40')]===a7_0x4931('0x9')){for(const _0x5559c9 of _0x13cdca){if(_0x5559c9[a7_0x4931('0x3a')][a7_0x4931('0x4d')]===_0x1b8abe[a7_0x4931('0x3a')][a7_0x4931('0x4d')]&&_0x5559c9[a7_0x4931('0x3a')][a7_0x4931('0x3a')]===_0x8cfb8[a7_0x4931('0x3a')]){_0x49f640[a7_0x4931('0x1')][_0x1b8abe['id']][a7_0x4931('0x15')](_0x5559c9['id']);}}}else if(_0x8cfb8[a7_0x4931('0x40')]===a7_0x4931('0x1')){const _0x33f670=new Set();this[a7_0x4931('0x44')](_0x1b8abe[a7_0x4931('0x3a')][a7_0x4931('0x4d')],_0x8cfb8[a7_0x4931('0x3a')],_0x13cdca,_0x49f640,_0x1b8abe['id'],_0x33f670);}}}[a7_0x4931('0x44')](_0x236c0e,_0x9f613,_0x5ce1b1,_0xdda1c2,_0x568c27,_0xc276e5){_0xc276e5[a7_0x4931('0x0')](_0x236c0e);const _0x21e3f0=this[a7_0x4931('0x8')][a7_0x4931('0x1')][_0x236c0e];if(_0x21e3f0){const _0x1cec17=_0x21e3f0[a7_0x4931('0x5a')](_0x241256=>_0x241256['target']);for(const _0x27af8e of _0x1cec17){if(_0xc276e5[a7_0x4931('0x47')](_0x27af8e)){continue;}const _0x40dbed=this[a7_0x4931('0x32')]({'project':_0x27af8e,'target':_0x9f613},_0x5ce1b1);if(_0x40dbed){if(_0xdda1c2[a7_0x4931('0x1')][_0x568c27][a7_0x4931('0x38')](_0x40dbed['id'])===-0x1){_0xdda1c2[a7_0x4931('0x1')][_0x568c27][a7_0x4931('0x15')](_0x40dbed['id']);}}else{this[a7_0x4931('0x44')](_0x27af8e,_0x9f613,_0x5ce1b1,_0xdda1c2,_0x568c27,_0xc276e5);}}}}[a7_0x4931('0x32')]({project,target},_0x4fbcb0){return _0x4fbcb0['find'](_0x2ed8ef=>_0x2ed8ef['target']['project']===project&&_0x2ed8ef[a7_0x4931('0x3a')][a7_0x4931('0x3a')]===target);}[a7_0x4931('0x31')](_0x3d0271,_0x5dae5b){_0x5dae5b['tasks'][_0x3d0271['id']]=_0x3d0271;_0x5dae5b[a7_0x4931('0x1')][_0x3d0271['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;function getDefaultDependencyConfigs(_0x51facf,_0x3d0626){var _0x1fbcd8,_0x2166a8;const _0x1e1c6b=(_0x1fbcd8=_0x51facf[a7_0x4931('0x24')])!==null&&_0x1fbcd8!==void 0x0?_0x1fbcd8:{};const _0x245020=_0x3d0626?(_0x2166a8=_0x3d0626[a7_0x4931('0x35')])!==null&&_0x2166a8!==void 0x0?_0x2166a8:[a7_0x4931('0x58')]:[];for(const _0x5518a7 of _0x245020){_0x1e1c6b[_0x5518a7]=_0x1e1c6b[_0x5518a7]||[];_0x1e1c6b[_0x5518a7][a7_0x4931('0x15')]({'target':_0x5518a7,'projects':'dependencies'});}return _0x1e1c6b;}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
try {
|
|
3
3
|
const { output } = require('nx/src/utils/output');
|
|
4
|
-
|
|
4
|
+
let workspaceRoot;
|
|
5
|
+
try {
|
|
6
|
+
workspaceRoot = require('nx/src/utils/app-root').workspaceRoot;
|
|
7
|
+
}
|
|
8
|
+
catch (_a) {
|
|
9
|
+
workspaceRoot = require('nx/src/utils/workspace-root').workspaceRoot;
|
|
10
|
+
}
|
|
5
11
|
const { unparse, getDependencyConfigs, getOutputs, } = require('nx/src/tasks-runner/utils');
|
|
6
12
|
const { Cache } = require('nx/src/tasks-runner/cache');
|
|
7
|
-
const
|
|
13
|
+
const tasksRunner = require('nx/tasks-runners/default').default;
|
|
8
14
|
const { CompositeLifeCycle } = require('nx/src/tasks-runner/life-cycle');
|
|
9
15
|
exports.runnerReturnsPromise = true;
|
|
10
16
|
exports.output = output;
|
|
@@ -16,7 +22,7 @@ try {
|
|
|
16
22
|
exports.getOutputs = getOutputs;
|
|
17
23
|
exports.Cache = Cache;
|
|
18
24
|
}
|
|
19
|
-
catch (
|
|
25
|
+
catch (_b) {
|
|
20
26
|
const { output } = require('@nrwl/workspace/src/utilities/output');
|
|
21
27
|
const { appRootPath } = require('@nrwl/tao/src/utils/app-root');
|
|
22
28
|
const { unparse, getDependencyConfigs, getOutputs, } = require('@nrwl/workspace/src/tasks-runner/utils');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-imports.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/nx-imports.ts"],"names":[],"mappings":";AAAA,IAAI;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClD,
|
|
1
|
+
{"version":3,"file":"nx-imports.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/nx-imports.ts"],"names":[],"mappings":";AAAA,IAAI;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,aAAa,CAAC;IAClB,IAAI;QACF,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,aAAa,CAAC;KAChE;IAAC,OAAO,EAAE,EAAE;QACX,aAAa,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC,aAAa,CAAC;KACtE;IACD,MAAM,EACJ,OAAO,EACP,oBAAoB,EACpB,UAAU,GACX,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACzC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAEzE,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;IACtC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;IAClC,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAChD,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACpD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IAChC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;CACvB;AAAC,WAAM;IACN,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACnE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAChE,MAAM,EACJ,OAAO,EACP,oBAAoB,EACpB,UAAU,GACX,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;IACtD,MAAM,EACJ,aAAa,GACd,GAAG,OAAO,CAAC,kDAAkD,CAAC,CAAC;IAEhE,IAAI,kBAAkB,CAAC;IACvB,IAAI;QACF,kBAAkB;YAChB,OAAO,CAAC,6CAA6C,CAAC,CAAC,kBAAkB,CAAC;KAC7E;IAAC,OAAO,CAAC,EAAE,GAAE;IACd,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;IAEpE,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACrC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,aAAa,GAAG,WAAW,CAAC;IACpC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,WAAW,GAAG,aAAa,CAAC;IACpC,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAChD,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACpD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IAChC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;CACvB"}
|