@nrwl/nx-cloud 14.4.0-beta.2 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/api/error-reporter.api.js +1 -36
- package/lib/core/api/run-group.api.js +1 -65
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -156
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -176
- 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 -252
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js.map +1 -1
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -143
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -217
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +1 -37
- package/lib/core/runners/distributed-execution/task-graph-creator.js +1 -77
- package/package.json +1 -1
- package/tsconfig.spec.json +2 -1
|
@@ -1,143 +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 serializer_overrides_1 = require("../../../utilities/serializer-overrides");
|
|
17
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
18
|
-
class DistributedExecutionApi {
|
|
19
|
-
constructor(options) {
|
|
20
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
21
|
-
}
|
|
22
|
-
start(params) {
|
|
23
|
-
var _a;
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStart');
|
|
26
|
-
let resp;
|
|
27
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
28
|
-
output.note({
|
|
29
|
-
title: 'Starting a distributed execution',
|
|
30
|
-
bodyLines: [JSON.stringify(params, null, 2)],
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/start', params));
|
|
35
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
39
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
40
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
41
|
-
throw e;
|
|
42
|
-
}
|
|
43
|
-
if (!resp.data.enabled) {
|
|
44
|
-
throw new Error(`Workspace is disabled. Cannot perform distributed task executions.`);
|
|
45
|
-
}
|
|
46
|
-
if (resp.data.error) {
|
|
47
|
-
throw new Error(resp.data.error);
|
|
48
|
-
}
|
|
49
|
-
return resp.data.id;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
status(id) {
|
|
53
|
-
var _a;
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStatus');
|
|
56
|
-
try {
|
|
57
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/status', {
|
|
58
|
-
id,
|
|
59
|
-
}));
|
|
60
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
61
|
-
return resp.data;
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
65
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
66
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
67
|
-
output.error({
|
|
68
|
-
title: e.message,
|
|
69
|
-
});
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
completeRunGroupWithError(runGroup, error) {
|
|
75
|
-
var _a;
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
|
|
78
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
79
|
-
output.note({
|
|
80
|
-
title: 'Completing run group with an error',
|
|
81
|
-
bodyLines: [`runGroup: ${runGroup}`, `error: ${error}`],
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
86
|
-
runGroup: runGroup,
|
|
87
|
-
criticalErrorMessage: error,
|
|
88
|
-
}), 3);
|
|
89
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
93
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
94
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.DistributedExecutionApi = DistributedExecutionApi;
|
|
100
|
-
function createStartRequest(runGroup, task, options) {
|
|
101
|
-
const tasksToExecute = task.map((arr) => {
|
|
102
|
-
return arr.map((t) => {
|
|
103
|
-
return {
|
|
104
|
-
taskId: t.id,
|
|
105
|
-
hash: t.hash,
|
|
106
|
-
projectName: t.target.project,
|
|
107
|
-
target: t.target.target,
|
|
108
|
-
configuration: t.target.configuration || null,
|
|
109
|
-
params: (0, serializer_overrides_1.serializeOverrides)(t),
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
const request = {
|
|
114
|
-
command: (0, environment_1.parseCommand)(),
|
|
115
|
-
branch: (0, environment_1.getBranch)(),
|
|
116
|
-
runGroup,
|
|
117
|
-
tasks: tasksToExecute,
|
|
118
|
-
maxParallel: calculateMaxParallel(options),
|
|
119
|
-
};
|
|
120
|
-
if (environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT) {
|
|
121
|
-
request.agentCount = environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT;
|
|
122
|
-
}
|
|
123
|
-
if (!environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE) {
|
|
124
|
-
request.stopAgentsOnFailure = false;
|
|
125
|
-
}
|
|
126
|
-
return request;
|
|
127
|
-
}
|
|
128
|
-
exports.createStartRequest = createStartRequest;
|
|
129
|
-
function calculateMaxParallel(options) {
|
|
130
|
-
if (options.parallel === 'false' || options.parallel === false) {
|
|
131
|
-
return 1;
|
|
132
|
-
}
|
|
133
|
-
else if (options.parallel === 'true' || options.parallel === true) {
|
|
134
|
-
return Number(options.maxParallel || 3);
|
|
135
|
-
}
|
|
136
|
-
else if (options.parallel === undefined) {
|
|
137
|
-
return options.maxParallel ? Number(options.maxParallel) : 3;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
return Number(options.parallel) || 3;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=distributed-execution.api.js.map
|
|
1
|
+
const a6_0x2eae=['start','__esModule','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','throw','response','project','defineProperty','runGroup:\x20','recordMetric','note','apiAxiosInstance','__awaiter','true','dteStatus','completeRunGroup','stopAgentsOnFailure','serializeOverrides','/nx-cloud/executions/complete-run-group','next','RUNNER_FAILURE_PERF_ENTRY','dteStart','configuration','../../../utilities/environment','createStartRequest','false','Completing\x20run\x20group\x20with\x20an\x20error','/nx-cloud/executions/status','../../../utilities/axios','VERBOSE_LOGGING','data','target','message','value','mapRespToPerfEntry','post','apply','parallel','agentCount','getBranch','error:\x20','hash','exit','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','map','createApiAxiosInstance','createMetricRecorder','completeRunGroupWithError','error','Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.','axiosException','then','axiosMultipleTries','maxParallel','../../../utilities/serializer-overrides'];(function(_0x148e81,_0x2eaeaa){const _0x59679f=function(_0x41bc10){while(--_0x41bc10){_0x148e81['push'](_0x148e81['shift']());}};_0x59679f(++_0x2eaeaa);}(a6_0x2eae,0xba));const a6_0x5967=function(_0x148e81,_0x2eaeaa){_0x148e81=_0x148e81-0x0;let _0x59679f=a6_0x2eae[_0x148e81];return _0x59679f;};'use strict';var __awaiter=this&&this[a6_0x5967('0x29')]||function(_0x251848,_0x2f7ee3,_0x2b42c8,_0x55677f){function _0x3802f6(_0x46a2dc){return _0x46a2dc instanceof _0x2b42c8?_0x46a2dc:new _0x2b42c8(function(_0x138b89){_0x138b89(_0x46a2dc);});}return new(_0x2b42c8||(_0x2b42c8=Promise))(function(_0x5cb4ef,_0x2cbf0b){function _0x4e73a5(_0x2f74e6){try{_0x5189c4(_0x55677f[a6_0x5967('0x30')](_0x2f74e6));}catch(_0x4af4a8){_0x2cbf0b(_0x4af4a8);}}function _0x330582(_0xd28144){try{_0x5189c4(_0x55677f[a6_0x5967('0x21')](_0xd28144));}catch(_0x4f9a86){_0x2cbf0b(_0x4f9a86);}}function _0x5189c4(_0x1d90ba){_0x1d90ba['done']?_0x5cb4ef(_0x1d90ba['value']):_0x3802f6(_0x1d90ba[a6_0x5967('0x8')])[a6_0x5967('0x1a')](_0x4e73a5,_0x330582);}_0x5189c4((_0x55677f=_0x55677f[a6_0x5967('0xb')](_0x251848,_0x2f7ee3||[]))[a6_0x5967('0x30')]());});};Object[a6_0x5967('0x24')](exports,a6_0x5967('0x1f'),{'value':!![]});exports['createStartRequest']=exports['DistributedExecutionApi']=void 0x0;const axios_1=require(a6_0x5967('0x3'));const environment_1=require(a6_0x5967('0x34'));const metric_logger_1=require('../../../utilities/metric-logger');const serializer_overrides_1=require(a6_0x5967('0x1d'));const {output}=require('../../../utilities/nx-imports');class DistributedExecutionApi{constructor(_0x1e4428){this['apiAxiosInstance']=(0x0,axios_1[a6_0x5967('0x14')])(_0x1e4428);}[a6_0x5967('0x1e')](_0x330930){var _0x2b9e75;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x515cd8=(0x0,metric_logger_1[a6_0x5967('0x15')])(a6_0x5967('0x32'));let _0x31debf;if(environment_1[a6_0x5967('0x4')]){output[a6_0x5967('0x27')]({'title':'Starting\x20a\x20distributed\x20execution','bodyLines':[JSON['stringify'](_0x330930,null,0x2)]});}try{_0x31debf=yield(0x0,axios_1[a6_0x5967('0x1b')])(()=>this[a6_0x5967('0x28')][a6_0x5967('0xa')]('/nx-cloud/executions/start',_0x330930));_0x515cd8[a6_0x5967('0x26')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x31debf));}catch(_0x8b8e8){_0x515cd8[a6_0x5967('0x26')](((_0x2b9e75=_0x8b8e8===null||_0x8b8e8===void 0x0?void 0x0:_0x8b8e8[a6_0x5967('0x19')])===null||_0x2b9e75===void 0x0?void 0x0:_0x2b9e75['response'])?(0x0,metric_logger_1[a6_0x5967('0x9')])(_0x8b8e8[a6_0x5967('0x19')][a6_0x5967('0x22')]):metric_logger_1[a6_0x5967('0x31')]);throw _0x8b8e8;}if(!_0x31debf[a6_0x5967('0x5')]['enabled']){throw new Error(a6_0x5967('0x18'));}if(_0x31debf[a6_0x5967('0x5')][a6_0x5967('0x17')]){throw new Error(_0x31debf[a6_0x5967('0x5')][a6_0x5967('0x17')]);}return _0x31debf[a6_0x5967('0x5')]['id'];});}['status'](_0x1077d4){var _0x3abddd;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x29df50=(0x0,metric_logger_1[a6_0x5967('0x15')])(a6_0x5967('0x2b'));try{const _0x46011f=yield(0x0,axios_1[a6_0x5967('0x1b')])(()=>this['apiAxiosInstance'][a6_0x5967('0xa')](a6_0x5967('0x2'),{'id':_0x1077d4}));_0x29df50[a6_0x5967('0x26')]((0x0,metric_logger_1[a6_0x5967('0x9')])(_0x46011f));return _0x46011f[a6_0x5967('0x5')];}catch(_0x140512){_0x29df50[a6_0x5967('0x26')](((_0x3abddd=_0x140512===null||_0x140512===void 0x0?void 0x0:_0x140512['axiosException'])===null||_0x3abddd===void 0x0?void 0x0:_0x3abddd[a6_0x5967('0x22')])?(0x0,metric_logger_1[a6_0x5967('0x9')])(_0x140512[a6_0x5967('0x19')][a6_0x5967('0x22')]):metric_logger_1[a6_0x5967('0x31')]);output['error']({'title':_0x140512[a6_0x5967('0x7')]});process[a6_0x5967('0x11')](0x1);}});}[a6_0x5967('0x16')](_0x1e2572,_0x1af70e){var _0x92f4d8;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x113088=(0x0,metric_logger_1[a6_0x5967('0x15')])(a6_0x5967('0x2c'));if(environment_1[a6_0x5967('0x4')]){output[a6_0x5967('0x27')]({'title':a6_0x5967('0x1'),'bodyLines':[a6_0x5967('0x25')+_0x1e2572,a6_0x5967('0xf')+_0x1af70e]});}try{const _0x4e8bc8=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a6_0x5967('0x28')]['post'](a6_0x5967('0x2f'),{'runGroup':_0x1e2572,'criticalErrorMessage':_0x1af70e}),0x3);_0x113088[a6_0x5967('0x26')]((0x0,metric_logger_1[a6_0x5967('0x9')])(_0x4e8bc8));}catch(_0x4ae4cf){_0x113088[a6_0x5967('0x26')](((_0x92f4d8=_0x4ae4cf===null||_0x4ae4cf===void 0x0?void 0x0:_0x4ae4cf[a6_0x5967('0x19')])===null||_0x92f4d8===void 0x0?void 0x0:_0x92f4d8[a6_0x5967('0x22')])?(0x0,metric_logger_1[a6_0x5967('0x9')])(_0x4ae4cf['axiosException'][a6_0x5967('0x22')]):metric_logger_1[a6_0x5967('0x31')]);}});}}exports['DistributedExecutionApi']=DistributedExecutionApi;function createStartRequest(_0x12cdd5,_0x38a75a,_0x3dfd7a){const _0x42f338=_0x38a75a['map'](_0x2a714c=>{return _0x2a714c[a6_0x5967('0x13')](_0x4b3853=>{return{'taskId':_0x4b3853['id'],'hash':_0x4b3853[a6_0x5967('0x10')],'projectName':_0x4b3853[a6_0x5967('0x6')][a6_0x5967('0x23')],'target':_0x4b3853[a6_0x5967('0x6')][a6_0x5967('0x6')],'configuration':_0x4b3853[a6_0x5967('0x6')][a6_0x5967('0x33')]||null,'params':(0x0,serializer_overrides_1[a6_0x5967('0x2e')])(_0x4b3853)};});});const _0x4679a0={'command':(0x0,environment_1['parseCommand'])(),'branch':(0x0,environment_1[a6_0x5967('0xe')])(),'runGroup':_0x12cdd5,'tasks':_0x42f338,'maxParallel':calculateMaxParallel(_0x3dfd7a)};if(environment_1[a6_0x5967('0x20')]){_0x4679a0[a6_0x5967('0xd')]=environment_1[a6_0x5967('0x20')];}if(!environment_1[a6_0x5967('0x12')]){_0x4679a0[a6_0x5967('0x2d')]=![];}return _0x4679a0;}exports[a6_0x5967('0x35')]=createStartRequest;function calculateMaxParallel(_0x47f755){if(_0x47f755[a6_0x5967('0xc')]===a6_0x5967('0x0')||_0x47f755['parallel']===![]){return 0x1;}else if(_0x47f755[a6_0x5967('0xc')]===a6_0x5967('0x2a')||_0x47f755[a6_0x5967('0xc')]===!![]){return Number(_0x47f755[a6_0x5967('0x1c')]||0x3);}else if(_0x47f755[a6_0x5967('0xc')]===undefined){return _0x47f755[a6_0x5967('0x1c')]?Number(_0x47f755[a6_0x5967('0x1c')]):0x3;}else{return Number(_0x47f755[a6_0x5967('0xc')])||0x3;}}
|
|
@@ -1,217 +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.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 serializer_overrides_1 = require("../../../utilities/serializer-overrides");
|
|
25
|
-
const task_graph_creator_1 = require("./task-graph-creator");
|
|
26
|
-
const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
|
|
27
|
-
const { output, workspaceRoot, getOutputs, Cache, } = require('../../../utilities/nx-imports');
|
|
28
|
-
class NoopLifeCycle {
|
|
29
|
-
scheduleTask(task) { }
|
|
30
|
-
startTask(task) { }
|
|
31
|
-
endTask(task, code) { }
|
|
32
|
-
}
|
|
33
|
-
function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, (0, split_task_graph_into_stages_1.splitTasksIntoStages)(taskGraph), options));
|
|
36
|
-
return yield processTasks(api, fileStorage, cache, options, id, Object.values(taskGraph.tasks), context);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const processedTasks = {};
|
|
42
|
-
const failIfNumberOfCompletedTasksDoesNotChangeIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
|
|
43
|
-
const waiter = new waiter_1.Waiter();
|
|
44
|
-
while (true) {
|
|
45
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
46
|
-
output.note({
|
|
47
|
-
title: 'Waiting...',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
yield waiter.wait();
|
|
51
|
-
const r = yield api.status(executionId);
|
|
52
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
53
|
-
output.note({
|
|
54
|
-
title: `Status update`,
|
|
55
|
-
bodyLines: [
|
|
56
|
-
`executionId: ${executionId}`,
|
|
57
|
-
`executionStatus: ${r.executionStatus}`,
|
|
58
|
-
`number of completed tasks: ${r.completedTasks.length}`,
|
|
59
|
-
`error: ${r.criticalErrorMessage}`,
|
|
60
|
-
],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (r.criticalErrorMessage) {
|
|
64
|
-
output.error({
|
|
65
|
-
title: 'Distributed Execution Terminated',
|
|
66
|
-
bodyLines: ['Error:', r.criticalErrorMessage],
|
|
67
|
-
});
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
failIfNumberOfCompletedTasksDoesNotChangeIn30Mins(r.completedTasks.length);
|
|
71
|
-
for (const t of r.completedTasks) {
|
|
72
|
-
if (processedTasks[t.taskId])
|
|
73
|
-
continue;
|
|
74
|
-
yield processTask(fileStorage, cache, context, options, tasks, t);
|
|
75
|
-
waiter.reset();
|
|
76
|
-
processedTasks[t.taskId] = true;
|
|
77
|
-
}
|
|
78
|
-
if (r.executionStatus === 'COMPLETED') {
|
|
79
|
-
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function processTask(fileStorage, cache, context, options, tasks, completedTask) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
87
|
-
output.note({
|
|
88
|
-
title: `Processing task ${completedTask.taskId}`,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
|
|
92
|
-
if (!matchingTask) {
|
|
93
|
-
throw new Error(`Found unknown task: ${completedTask.taskId}`);
|
|
94
|
-
}
|
|
95
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
96
|
-
output.note({
|
|
97
|
-
title: `Retrieving artifacts from ${completedTask.url}`,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
|
|
101
|
-
const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
|
|
102
|
-
const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
|
|
103
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
104
|
-
output.note({
|
|
105
|
-
title: `Extracting artifacts`,
|
|
106
|
-
bodyLines: outputs,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
|
|
110
|
-
output.logCommand(getCommand(matchingTask));
|
|
111
|
-
process.stdout.write(cachedResult.terminalOutput);
|
|
112
|
-
output.addVerticalSeparator();
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function getCommand(task) {
|
|
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
|
-
(0, serializer_overrides_1.serializeOverrides)(task),
|
|
124
|
-
].join(' ');
|
|
125
|
-
}
|
|
126
|
-
function attachSignalListenersToCompleteRunGroupOnError(api, runGroup) {
|
|
127
|
-
process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGINT');
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}));
|
|
131
|
-
process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGTERM');
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
138
|
-
output.note({
|
|
139
|
-
title: 'Starting distributed command execution',
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
options.lifeCycle = new NoopLifeCycle();
|
|
143
|
-
const runGroup = (0, environment_1.getRunGroup)();
|
|
144
|
-
if (!runGroup) {
|
|
145
|
-
(0, print_run_group_error_1.printRunGroupError)();
|
|
146
|
-
return process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
|
|
149
|
-
const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
|
|
150
|
-
const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true);
|
|
151
|
-
const cache = new Cache(options);
|
|
152
|
-
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
|
|
153
|
-
attachSignalListenersToCompleteRunGroupOnError(api, runGroup);
|
|
154
|
-
try {
|
|
155
|
-
const taskGraph = getTaskGraph(context, tasks, options);
|
|
156
|
-
const r = yield runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph);
|
|
157
|
-
if (r.commandStatus === 0) {
|
|
158
|
-
output.success({
|
|
159
|
-
title: 'Successfully completed running the command.',
|
|
160
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
output.error({
|
|
165
|
-
title: 'Command execution failed.',
|
|
166
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
170
|
-
process.exit(r.commandStatus);
|
|
171
|
-
}
|
|
172
|
-
catch (e) {
|
|
173
|
-
output.error({
|
|
174
|
-
title: 'Unable to complete a run.',
|
|
175
|
-
bodyLines: [e.message],
|
|
176
|
-
});
|
|
177
|
-
if (e.axiosException) {
|
|
178
|
-
console.log(e.axiosException);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
console.log(e);
|
|
182
|
-
}
|
|
183
|
-
try {
|
|
184
|
-
yield api.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`);
|
|
185
|
-
}
|
|
186
|
-
finally {
|
|
187
|
-
process.exit(1);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
|
|
192
|
-
function getTaskGraph(context, tasks, options) {
|
|
193
|
-
if (context.taskGraph) {
|
|
194
|
-
return context.taskGraph;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
|
|
198
|
-
return new task_graph_creator_1.TaskGraphCreator(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
|
|
202
|
-
var _a, _b;
|
|
203
|
-
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
|
|
204
|
-
const strictlyOrderedTargets = runnerOptions
|
|
205
|
-
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
|
|
206
|
-
: [];
|
|
207
|
-
// Strictly Ordered Targets depend on their dependencies
|
|
208
|
-
for (const target of strictlyOrderedTargets) {
|
|
209
|
-
defaults[target] = defaults[target] || [];
|
|
210
|
-
defaults[target].push({
|
|
211
|
-
target,
|
|
212
|
-
projects: 'dependencies',
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return defaults;
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=distributed-execution.runner.js.map
|
|
1
|
+
const a7_0x75c0=['../../../utilities/environment','./distributed-execution.api','completedTasks','See\x20run\x20details\x20at\x20','push','getRunGroup','projectGraph','../../../utilities/metric-logger','length','TaskGraphCreator','Distributed\x20Execution\x20Terminated','run','../../../utilities/serializer-overrides','axiosException','error','message','createStartRequest','../../error/print-run-group-error','Unable\x20to\x20complete\x20a\x20run.','splitTasksIntoStages','readFileSync','next','logCommand','serializeOverrides','ENCRYPTION_KEY','../../../utilities/nx-imports','retrieve','DistributedExecutionApi','commandStatus','VERBOSE_LOGGING','defineProperty','createTaskGraph','stdout','SIGTERM','log','__esModule','Successfully\x20completed\x20running\x20the\x20command.','FileStorage','SIGINT','assign','taskGraph','start','target','Waiting...','hash','Starting\x20distributed\x20command\x20execution','printRunGroupError','strip-json-comments','Waiter','runUrl','build','../../file-storage/file-storage','executionStatus','number\x20of\x20completed\x20tasks:\x20','endTask','find','value','createNoNewMessagesTimeout','./split-task-graph-into-stages','url','encryptionKey','dependencies','nodes','Found\x20unknown\x20task:\x20','Extracting\x20artifacts','E2EEncryption','addVerticalSeparator','cacheDirectory','criticalErrorMessage','tasks','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','values','COMPLETED','join','completeRunGroupWithError','../../../utilities/waiter','exit','apply','write','error:\x20','note','configuration','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','nxCloudDistributedTasksRunner','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','taskId','throw','lifeCycle','toString','executionId:\x20'];(function(_0x4f52b3,_0x75c012){const _0x4c77a5=function(_0x503ee4){while(--_0x503ee4){_0x4f52b3['push'](_0x4f52b3['shift']());}};_0x4c77a5(++_0x75c012);}(a7_0x75c0,0x1b1));const a7_0x4c77=function(_0x4f52b3,_0x75c012){_0x4f52b3=_0x4f52b3-0x0;let _0x4c77a5=a7_0x75c0[_0x4f52b3];return _0x4c77a5;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x55a574,_0x56f968,_0xcbbd51,_0x394322){function _0x5636db(_0x5c3366){return _0x5c3366 instanceof _0xcbbd51?_0x5c3366:new _0xcbbd51(function(_0xc85b04){_0xc85b04(_0x5c3366);});}return new(_0xcbbd51||(_0xcbbd51=Promise))(function(_0x1b51d4,_0x2b84a6){function _0x135651(_0x2648a2){try{_0x5d2793(_0x394322[a7_0x4c77('0x26')](_0x2648a2));}catch(_0x247df2){_0x2b84a6(_0x247df2);}}function _0x236d0f(_0x2349a3){try{_0x5d2793(_0x394322[a7_0x4c77('0xd')](_0x2349a3));}catch(_0x54615d){_0x2b84a6(_0x54615d);}}function _0x5d2793(_0x3045aa){_0x3045aa['done']?_0x1b51d4(_0x3045aa[a7_0x4c77('0x49')]):_0x5636db(_0x3045aa['value'])['then'](_0x135651,_0x236d0f);}_0x5d2793((_0x394322=_0x394322[a7_0x4c77('0x4')](_0x55a574,_0x56f968||[]))[a7_0x4c77('0x26')]());});};Object[a7_0x4c77('0x2f')](exports,a7_0x4c77('0x34'),{'value':!![]});exports['nxCloudDistributedTasksRunner']=void 0x0;const stripJsonComments=require(a7_0x4c77('0x40'));const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x4c77('0x12'));const file_storage_1=require(a7_0x4c77('0x44'));const e2e_encryption_1=require('../../file-storage/e2e-encryption');const waiter_1=require(a7_0x4c77('0x2'));const environment_1=require(a7_0x4c77('0x11'));const print_run_group_error_1=require(a7_0x4c77('0x22'));const create_no_new_messages_timeout_1=require('../../../utilities/create-no-new-messages-timeout');const metric_logger_1=require(a7_0x4c77('0x18'));const error_reporter_api_1=require('../../api/error-reporter.api');const serializer_overrides_1=require(a7_0x4c77('0x1d'));const task_graph_creator_1=require('./task-graph-creator');const split_task_graph_into_stages_1=require(a7_0x4c77('0x4b'));const {output,workspaceRoot,getOutputs,Cache}=require(a7_0x4c77('0x2a'));class NoopLifeCycle{['scheduleTask'](_0xd5b8f9){}['startTask'](_0x540f4d){}[a7_0x4c77('0x47')](_0x575647,_0x52a036){}}function runDistributedExecution(_0x59db03,_0x7b1ad9,_0x4803f7,_0x3f22cd,_0x310b47,_0x4cc604,_0x23dc77){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5ceb33=yield _0x59db03[a7_0x4c77('0x3a')]((0x0,distributed_execution_api_1[a7_0x4c77('0x21')])(_0x4cc604,(0x0,split_task_graph_into_stages_1[a7_0x4c77('0x24')])(_0x23dc77),_0x7b1ad9));return yield processTasks(_0x59db03,_0x3f22cd,_0x310b47,_0x7b1ad9,_0x5ceb33,Object[a7_0x4c77('0x58')](_0x23dc77[a7_0x4c77('0x56')]),_0x4803f7);});}function processTasks(_0x2aa056,_0x192dfa,_0x41aab6,_0x400046,_0x128025,_0x37f7d0,_0x2b1773){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5cdfe2={};const _0x232d7c=(0x0,create_no_new_messages_timeout_1[a7_0x4c77('0x4a')])();const _0x92b761=new waiter_1[(a7_0x4c77('0x41'))]();while(!![]){if(environment_1['VERBOSE_LOGGING']){output[a7_0x4c77('0x7')]({'title':a7_0x4c77('0x3c')});}yield _0x92b761['wait']();const _0x327cc7=yield _0x2aa056['status'](_0x128025);if(environment_1[a7_0x4c77('0x2e')]){output[a7_0x4c77('0x7')]({'title':'Status\x20update','bodyLines':[a7_0x4c77('0x10')+_0x128025,'executionStatus:\x20'+_0x327cc7[a7_0x4c77('0x45')],a7_0x4c77('0x46')+_0x327cc7[a7_0x4c77('0x13')]['length'],a7_0x4c77('0x6')+_0x327cc7[a7_0x4c77('0x55')]]});}if(_0x327cc7[a7_0x4c77('0x55')]){output[a7_0x4c77('0x1f')]({'title':a7_0x4c77('0x1b'),'bodyLines':['Error:',_0x327cc7[a7_0x4c77('0x55')]]});process[a7_0x4c77('0x3')](0x1);}_0x232d7c(_0x327cc7[a7_0x4c77('0x13')][a7_0x4c77('0x19')]);for(const _0x3c9800 of _0x327cc7[a7_0x4c77('0x13')]){if(_0x5cdfe2[_0x3c9800[a7_0x4c77('0xc')]])continue;yield processTask(_0x192dfa,_0x41aab6,_0x2b1773,_0x400046,_0x37f7d0,_0x3c9800);_0x92b761['reset']();_0x5cdfe2[_0x3c9800[a7_0x4c77('0xc')]]=!![];}if(_0x327cc7[a7_0x4c77('0x45')]===a7_0x4c77('0x59')){return{'commandStatus':_0x327cc7[a7_0x4c77('0x2d')],'runUrl':_0x327cc7[a7_0x4c77('0x42')]};}}});}function processTask(_0x441e60,_0x14fed1,_0x1d3392,_0x478dcf,_0x4d293a,_0x4fd39b){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a7_0x4c77('0x7')]({'title':'Processing\x20task\x20'+_0x4fd39b[a7_0x4c77('0xc')]});}const _0x552498=_0x4d293a[a7_0x4c77('0x48')](_0x558bbb=>_0x4fd39b['taskId']===_0x558bbb['id']);if(!_0x552498){throw new Error(a7_0x4c77('0x50')+_0x4fd39b[a7_0x4c77('0xc')]);}if(environment_1[a7_0x4c77('0x2e')]){output['note']({'title':'Retrieving\x20artifacts\x20from\x20'+_0x4fd39b[a7_0x4c77('0x4c')]});}yield _0x441e60[a7_0x4c77('0x2b')](_0x4fd39b[a7_0x4c77('0x3d')],_0x4fd39b[a7_0x4c77('0x4c')],_0x478dcf[a7_0x4c77('0x54')]||'./node_modules/.cache/nx');const _0x4cf54b=yield _0x14fed1['get'](Object[a7_0x4c77('0x38')](Object['assign']({},_0x552498),{'hash':_0x4fd39b[a7_0x4c77('0x3d')]}));const _0x2e963d=getOutputs(_0x1d3392[a7_0x4c77('0x17')][a7_0x4c77('0x4f')],_0x552498);if(environment_1[a7_0x4c77('0x2e')]){output[a7_0x4c77('0x7')]({'title':a7_0x4c77('0x51'),'bodyLines':_0x2e963d});}yield _0x14fed1['copyFilesFromCache'](_0x4fd39b[a7_0x4c77('0x3d')],_0x4cf54b,_0x2e963d);output[a7_0x4c77('0x27')](getCommand(_0x552498));process[a7_0x4c77('0x31')][a7_0x4c77('0x5')](_0x4cf54b['terminalOutput']);output[a7_0x4c77('0x53')]();});}function getCommand(_0x638c2d){const _0x236e81=_0x638c2d['target']['configuration']?':'+_0x638c2d[a7_0x4c77('0x3b')][a7_0x4c77('0x8')]:'';return['nx',a7_0x4c77('0x1c'),_0x638c2d[a7_0x4c77('0x3b')]['project']+':'+_0x638c2d[a7_0x4c77('0x3b')][a7_0x4c77('0x3b')]+_0x236e81,(0x0,serializer_overrides_1[a7_0x4c77('0x28')])(_0x638c2d)][a7_0x4c77('0x0')]('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x4c1b2a,_0x2676a3){process['on'](a7_0x4c77('0x37'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x4c1b2a[a7_0x4c77('0x1')](_0x2676a3,a7_0x4c77('0xb'));process[a7_0x4c77('0x3')](0x1);}));process['on'](a7_0x4c77('0x32'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x4c1b2a[a7_0x4c77('0x1')](_0x2676a3,a7_0x4c77('0x9'));process['exit'](0x1);}));}const nxCloudDistributedTasksRunner=(_0xe8e9c3,_0x2c7db4,_0x3aebfb)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1[a7_0x4c77('0x2e')]){output[a7_0x4c77('0x7')]({'title':a7_0x4c77('0x3e')});}_0x2c7db4[a7_0x4c77('0xe')]=new NoopLifeCycle();const _0x3a74e8=(0x0,environment_1[a7_0x4c77('0x16')])();if(!_0x3a74e8){(0x0,print_run_group_error_1[a7_0x4c77('0x3f')])();return process[a7_0x4c77('0x3')](0x1);}const _0x5efe1f=new e2e_encryption_1[(a7_0x4c77('0x52'))](environment_1[a7_0x4c77('0x29')]||_0x2c7db4[a7_0x4c77('0x4d')]);const _0x2d0527=new error_reporter_api_1['ErrorReporterApi'](_0x2c7db4);const _0x550201=new file_storage_1[(a7_0x4c77('0x36'))](_0x5efe1f,_0x2d0527,!![]);const _0x59eb3=new Cache(_0x2c7db4);const _0x392612=new distributed_execution_api_1[(a7_0x4c77('0x2c'))](_0x2c7db4);attachSignalListenersToCompleteRunGroupOnError(_0x392612,_0x3a74e8);try{const _0x5da0fb=getTaskGraph(_0x3aebfb,_0xe8e9c3,_0x2c7db4);const _0x193304=yield runDistributedExecution(_0x392612,_0x2c7db4,_0x3aebfb,_0x550201,_0x59eb3,_0x3a74e8,_0x5da0fb);if(_0x193304['commandStatus']===0x0){output['success']({'title':a7_0x4c77('0x35'),'bodyLines':[a7_0x4c77('0x14')+_0x193304[a7_0x4c77('0x42')]]});}else{output['error']({'title':'Command\x20execution\x20failed.','bodyLines':[a7_0x4c77('0x14')+_0x193304[a7_0x4c77('0x42')]]});}yield(0x0,metric_logger_1['submitRunMetrics'])(_0x2c7db4);process[a7_0x4c77('0x3')](_0x193304[a7_0x4c77('0x2d')]);}catch(_0x3f5ded){output[a7_0x4c77('0x1f')]({'title':a7_0x4c77('0x23'),'bodyLines':[_0x3f5ded[a7_0x4c77('0x20')]]});if(_0x3f5ded[a7_0x4c77('0x1e')]){console[a7_0x4c77('0x33')](_0x3f5ded[a7_0x4c77('0x1e')]);}else{console[a7_0x4c77('0x33')](_0x3f5ded);}try{yield _0x392612[a7_0x4c77('0x1')](_0x3a74e8,a7_0x4c77('0x57')+_0x3f5ded[a7_0x4c77('0x20')]+'\x22');}finally{process['exit'](0x1);}}});exports[a7_0x4c77('0xa')]=nxCloudDistributedTasksRunner;function getTaskGraph(_0x51e941,_0x464bdb,_0x1b8047){if(_0x51e941['taskGraph']){return _0x51e941[a7_0x4c77('0x39')];}else{const _0xcfc430=JSON['parse'](stripJsonComments((0x0,fs_1[a7_0x4c77('0x25')])(workspaceRoot+'/nx.json')[a7_0x4c77('0xf')]()));return new task_graph_creator_1[(a7_0x4c77('0x1a'))](_0x51e941['projectGraph'],getDefaultDependencyConfigs(_0xcfc430,_0x1b8047))[a7_0x4c77('0x30')](_0x464bdb);}}function getDefaultDependencyConfigs(_0x3c8a1c,_0x1da6c9){var _0x23d9f9,_0x5472ca;const _0x1d034d=(_0x23d9f9=_0x3c8a1c['targetDependencies'])!==null&&_0x23d9f9!==void 0x0?_0x23d9f9:{};const _0x465d53=_0x1da6c9?(_0x5472ca=_0x1da6c9['strictlyOrderedTargets'])!==null&&_0x5472ca!==void 0x0?_0x5472ca:[a7_0x4c77('0x43')]:[];for(const _0x3ce8b4 of _0x465d53){_0x1d034d[_0x3ce8b4]=_0x1d034d[_0x3ce8b4]||[];_0x1d034d[_0x3ce8b4][a7_0x4c77('0x15')]({'target':_0x3ce8b4,'projects':a7_0x4c77('0x4e')});}return _0x1d034d;}
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitTasksIntoStages = void 0;
|
|
4
|
-
function splitTasksIntoStages(taskGraph) {
|
|
5
|
-
const stages = [];
|
|
6
|
-
const notStagedTaskIds = new Set(Object.values(taskGraph.tasks).map((t) => t.id));
|
|
7
|
-
let stageIndex = 0;
|
|
8
|
-
// Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
|
|
9
|
-
while (notStagedTaskIds.size > 0) {
|
|
10
|
-
const currentStage = (stages[stageIndex] = []);
|
|
11
|
-
for (const taskId of notStagedTaskIds) {
|
|
12
|
-
let ready = true;
|
|
13
|
-
for (const dependency of taskGraph.dependencies[taskId]) {
|
|
14
|
-
if (notStagedTaskIds.has(dependency)) {
|
|
15
|
-
// dependency has not been staged yet, this task is not ready to be staged.
|
|
16
|
-
ready = false;
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
// Some dependency still has not been staged, skip it for now, it will be processed again
|
|
21
|
-
if (!ready) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
// All the dependencies have been staged, let's stage it.
|
|
25
|
-
const task = taskGraph.tasks[taskId];
|
|
26
|
-
currentStage.push(task);
|
|
27
|
-
}
|
|
28
|
-
// Remove the entire new stage of tasks from the list
|
|
29
|
-
for (const task of currentStage) {
|
|
30
|
-
notStagedTaskIds.delete(task.id);
|
|
31
|
-
}
|
|
32
|
-
stageIndex++;
|
|
33
|
-
}
|
|
34
|
-
return stages;
|
|
35
|
-
}
|
|
36
|
-
exports.splitTasksIntoStages = splitTasksIntoStages;
|
|
37
|
-
//# sourceMappingURL=split-task-graph-into-stages.js.map
|
|
1
|
+
const a8_0x5d06=['delete','__esModule','values','dependencies','has','splitTasksIntoStages','push','map'];(function(_0x472ccc,_0x5d06d7){const _0x45fb24=function(_0x5cbdc1){while(--_0x5cbdc1){_0x472ccc['push'](_0x472ccc['shift']());}};_0x45fb24(++_0x5d06d7);}(a8_0x5d06,0x18f));const a8_0x45fb=function(_0x472ccc,_0x5d06d7){_0x472ccc=_0x472ccc-0x0;let _0x45fb24=a8_0x5d06[_0x472ccc];return _0x45fb24;};'use strict';Object['defineProperty'](exports,a8_0x45fb('0x2'),{'value':!![]});exports['splitTasksIntoStages']=void 0x0;function splitTasksIntoStages(_0x5d5f8d){const _0x2ff280=[];const _0x387cad=new Set(Object[a8_0x45fb('0x3')](_0x5d5f8d['tasks'])[a8_0x45fb('0x0')](_0x4bd1b9=>_0x4bd1b9['id']));let _0x3d31f0=0x0;while(_0x387cad['size']>0x0){const _0x1eb5e7=_0x2ff280[_0x3d31f0]=[];for(const _0x4c8df5 of _0x387cad){let _0x1bb8d2=!![];for(const _0x46cc02 of _0x5d5f8d[a8_0x45fb('0x4')][_0x4c8df5]){if(_0x387cad[a8_0x45fb('0x5')](_0x46cc02)){_0x1bb8d2=![];break;}}if(!_0x1bb8d2){continue;}const _0x30fb66=_0x5d5f8d['tasks'][_0x4c8df5];_0x1eb5e7[a8_0x45fb('0x7')](_0x30fb66);}for(const _0x1f6e13 of _0x1eb5e7){_0x387cad[a8_0x45fb('0x1')](_0x1f6e13['id']);}_0x3d31f0++;}return _0x2ff280;}exports[a8_0x45fb('0x6')]=splitTasksIntoStages;
|
|
@@ -1,77 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskGraphCreator = void 0;
|
|
4
|
-
const { getDependencyConfigs } = require('../../../utilities/nx-imports');
|
|
5
|
-
/**
|
|
6
|
-
* This is only used for versions of Nx prior to 14 where the task graph
|
|
7
|
-
* wasn't part of the context so we have to recreate it
|
|
8
|
-
*/
|
|
9
|
-
class TaskGraphCreator {
|
|
10
|
-
constructor(projectGraph, defaultTargetDependencies) {
|
|
11
|
-
this.projectGraph = projectGraph;
|
|
12
|
-
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
13
|
-
}
|
|
14
|
-
createTaskGraph(tasks) {
|
|
15
|
-
const graph = {
|
|
16
|
-
roots: [],
|
|
17
|
-
tasks: {},
|
|
18
|
-
dependencies: {},
|
|
19
|
-
};
|
|
20
|
-
for (const task of tasks) {
|
|
21
|
-
this.addTaskToGraph(task, graph);
|
|
22
|
-
const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
|
|
23
|
-
if (!dependencyConfigs) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
|
|
27
|
-
}
|
|
28
|
-
graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
|
|
29
|
-
return graph;
|
|
30
|
-
}
|
|
31
|
-
addTaskDependencies(task, dependencyConfigs, tasks, graph) {
|
|
32
|
-
for (const dependencyConfig of dependencyConfigs) {
|
|
33
|
-
if (dependencyConfig.projects === 'self') {
|
|
34
|
-
for (const t of tasks) {
|
|
35
|
-
if (t.target.project === task.target.project &&
|
|
36
|
-
t.target.target === dependencyConfig.target) {
|
|
37
|
-
graph.dependencies[task.id].push(t.id);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else if (dependencyConfig.projects === 'dependencies') {
|
|
42
|
-
const seen = new Set();
|
|
43
|
-
this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
addDependencies(project, target, tasks, graph, taskId, seen) {
|
|
48
|
-
seen.add(project);
|
|
49
|
-
const dependencies = this.projectGraph.dependencies[project];
|
|
50
|
-
if (dependencies) {
|
|
51
|
-
const projectDependencies = dependencies.map((dependency) => dependency.target);
|
|
52
|
-
for (const projectDependency of projectDependencies) {
|
|
53
|
-
if (seen.has(projectDependency)) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const dependency = this.findTask({ project: projectDependency, target }, tasks);
|
|
57
|
-
if (dependency) {
|
|
58
|
-
if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
|
|
59
|
-
graph.dependencies[taskId].push(dependency.id);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
findTask({ project, target }, tasks) {
|
|
69
|
-
return tasks.find((t) => t.target.project === project && t.target.target === target);
|
|
70
|
-
}
|
|
71
|
-
addTaskToGraph(task, graph) {
|
|
72
|
-
graph.tasks[task.id] = task;
|
|
73
|
-
graph.dependencies[task.id] = [];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.TaskGraphCreator = TaskGraphCreator;
|
|
77
|
-
//# sourceMappingURL=task-graph-creator.js.map
|
|
1
|
+
const a9_0x1607=['keys','target','findTask','filter','TaskGraphCreator','project','__esModule','tasks','addTaskToGraph','add','createTaskGraph','find','addTaskDependencies','defineProperty','dependencies','projectGraph','addDependencies','projects','defaultTargetDependencies','self','../../../utilities/nx-imports','length'];(function(_0x380552,_0x1607d6){const _0x144791=function(_0x8b437d){while(--_0x8b437d){_0x380552['push'](_0x380552['shift']());}};_0x144791(++_0x1607d6);}(a9_0x1607,0x14f));const a9_0x1447=function(_0x380552,_0x1607d6){_0x380552=_0x380552-0x0;let _0x144791=a9_0x1607[_0x380552];return _0x144791;};'use strict';Object[a9_0x1447('0x8')](exports,a9_0x1447('0x1'),{'value':!![]});exports[a9_0x1447('0x15')]=void 0x0;const {getDependencyConfigs}=require(a9_0x1447('0xf'));class TaskGraphCreator{constructor(_0x5a378e,_0x375b70){this[a9_0x1447('0xa')]=_0x5a378e;this[a9_0x1447('0xd')]=_0x375b70;}[a9_0x1447('0x5')](_0x116c71){const _0x2d5c4c={'roots':[],'tasks':{},'dependencies':{}};for(const _0x4b70c9 of _0x116c71){this[a9_0x1447('0x3')](_0x4b70c9,_0x2d5c4c);const _0x5b5c57=getDependencyConfigs(_0x4b70c9[a9_0x1447('0x12')],this[a9_0x1447('0xd')],this[a9_0x1447('0xa')]);if(!_0x5b5c57){continue;}this['addTaskDependencies'](_0x4b70c9,_0x5b5c57,_0x116c71,_0x2d5c4c);}_0x2d5c4c['roots']=Object[a9_0x1447('0x11')](_0x2d5c4c[a9_0x1447('0x9')])[a9_0x1447('0x14')](_0x4b12ce=>_0x2d5c4c['dependencies'][_0x4b12ce][a9_0x1447('0x10')]===0x0);return _0x2d5c4c;}[a9_0x1447('0x7')](_0x48d14f,_0x1217bb,_0x48c2cd,_0x242eb5){for(const _0x14a2b3 of _0x1217bb){if(_0x14a2b3[a9_0x1447('0xc')]===a9_0x1447('0xe')){for(const _0x59826a of _0x48c2cd){if(_0x59826a[a9_0x1447('0x12')][a9_0x1447('0x0')]===_0x48d14f[a9_0x1447('0x12')]['project']&&_0x59826a[a9_0x1447('0x12')][a9_0x1447('0x12')]===_0x14a2b3['target']){_0x242eb5[a9_0x1447('0x9')][_0x48d14f['id']]['push'](_0x59826a['id']);}}}else if(_0x14a2b3['projects']===a9_0x1447('0x9')){const _0x5487d7=new Set();this['addDependencies'](_0x48d14f['target']['project'],_0x14a2b3[a9_0x1447('0x12')],_0x48c2cd,_0x242eb5,_0x48d14f['id'],_0x5487d7);}}}[a9_0x1447('0xb')](_0x2506e1,_0x10960b,_0x1f24a0,_0x12fe2b,_0x443d1e,_0x26a35c){_0x26a35c[a9_0x1447('0x4')](_0x2506e1);const _0x1d7f91=this[a9_0x1447('0xa')][a9_0x1447('0x9')][_0x2506e1];if(_0x1d7f91){const _0x23b931=_0x1d7f91['map'](_0x3bc527=>_0x3bc527[a9_0x1447('0x12')]);for(const _0x2378b0 of _0x23b931){if(_0x26a35c['has'](_0x2378b0)){continue;}const _0x56baaf=this[a9_0x1447('0x13')]({'project':_0x2378b0,'target':_0x10960b},_0x1f24a0);if(_0x56baaf){if(_0x12fe2b[a9_0x1447('0x9')][_0x443d1e]['indexOf'](_0x56baaf['id'])===-0x1){_0x12fe2b['dependencies'][_0x443d1e]['push'](_0x56baaf['id']);}}else{this[a9_0x1447('0xb')](_0x2378b0,_0x10960b,_0x1f24a0,_0x12fe2b,_0x443d1e,_0x26a35c);}}}}['findTask']({project,target},_0x39858e){return _0x39858e[a9_0x1447('0x6')](_0x212c58=>_0x212c58[a9_0x1447('0x12')][a9_0x1447('0x0')]===project&&_0x212c58[a9_0x1447('0x12')][a9_0x1447('0x12')]===target);}[a9_0x1447('0x3')](_0x18c348,_0x5baf4d){_0x5baf4d[a9_0x1447('0x2')][_0x18c348['id']]=_0x18c348;_0x5baf4d[a9_0x1447('0x9')][_0x18c348['id']]=[];}}exports[a9_0x1447('0x15')]=TaskGraphCreator;
|
package/package.json
CHANGED