@nrwl/nx-cloud 15.1.0-beta.3 → 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/api/error-reporter.api.js +1 -36
- package/lib/core/api/run-group.api.js +1 -68
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -92
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -305
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -117
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -167
- package/lib/core/runners/cloud-enabled/id-generator.js +1 -16
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -80
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -293
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -143
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -241
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +1 -37
- package/lib/core/runners/distributed-execution/task-graph-creator.js +1 -77
- package/package.json +1 -1
|
@@ -1,241 +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 fs_1 = require("fs");
|
|
14
|
-
const stripJsonComments = require("strip-json-comments");
|
|
15
|
-
const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
|
|
16
|
-
const environment_1 = require("../../../utilities/environment");
|
|
17
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
18
|
-
const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
|
|
19
|
-
const waiter_1 = require("../../../utilities/waiter");
|
|
20
|
-
const error_reporter_api_1 = require("../../api/error-reporter.api");
|
|
21
|
-
const print_run_group_error_1 = require("../../error/print-run-group-error");
|
|
22
|
-
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
23
|
-
const file_storage_1 = require("../../file-storage/file-storage");
|
|
24
|
-
const distributed_execution_api_1 = require("./distributed-execution.api");
|
|
25
|
-
const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
|
|
26
|
-
const task_graph_creator_1 = require("./task-graph-creator");
|
|
27
|
-
const { output, workspaceRoot, getOutputs, Cache, } = require('../../../utilities/nx-imports');
|
|
28
|
-
class NoopLifeCycle {
|
|
29
|
-
scheduleTask(task) { }
|
|
30
|
-
startTask(task) { }
|
|
31
|
-
endTasks(tasks) { }
|
|
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 failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
|
|
43
|
-
title: `No new completed tasks after ${environment_1.NO_COMPLETED_TASKS_TIMEOUT / 1000} seconds.`,
|
|
44
|
-
timeout: environment_1.NO_COMPLETED_TASKS_TIMEOUT,
|
|
45
|
-
});
|
|
46
|
-
const waiter = new waiter_1.Waiter();
|
|
47
|
-
while (true) {
|
|
48
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
49
|
-
output.note({
|
|
50
|
-
title: 'Waiting...',
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
yield waiter.wait();
|
|
54
|
-
const r = yield api.status(executionId);
|
|
55
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
56
|
-
output.note({
|
|
57
|
-
title: `Status update`,
|
|
58
|
-
bodyLines: [
|
|
59
|
-
`executionId: ${executionId}`,
|
|
60
|
-
`executionStatus: ${r.executionStatus}`,
|
|
61
|
-
`number of completed tasks: ${r.completedTasks.length}`,
|
|
62
|
-
`error: ${r.criticalErrorMessage}`,
|
|
63
|
-
],
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (r.criticalErrorMessage) {
|
|
67
|
-
output.error({
|
|
68
|
-
title: 'Distributed Execution Terminated',
|
|
69
|
-
bodyLines: ['Error:', r.criticalErrorMessage],
|
|
70
|
-
});
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout(r.completedTasks.length);
|
|
74
|
-
for (const t of r.completedTasks) {
|
|
75
|
-
if (processedTasks[t.taskId])
|
|
76
|
-
continue;
|
|
77
|
-
yield processTask(fileStorage, cache, context, options, tasks, t);
|
|
78
|
-
waiter.reset();
|
|
79
|
-
processedTasks[t.taskId] = true;
|
|
80
|
-
}
|
|
81
|
-
if (r.executionStatus === 'COMPLETED') {
|
|
82
|
-
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function processTask(fileStorage, cache, context, options, tasks, completedTask) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
90
|
-
output.note({
|
|
91
|
-
title: `Processing task ${completedTask.taskId}`,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
|
|
95
|
-
if (!matchingTask) {
|
|
96
|
-
throw new Error(`Found unknown task: ${completedTask.taskId}`);
|
|
97
|
-
}
|
|
98
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
99
|
-
output.note({
|
|
100
|
-
title: `Retrieving artifacts from ${completedTask.url}`,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
|
|
104
|
-
try {
|
|
105
|
-
yield fileStorage.retrieve(completedTask.hash, completedTask.url, (0, environment_1.getNxCacheDirectory)(options));
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
if (outputs.length > 0 && !outputs.find((output) => (0, fs_1.existsSync)(output))) {
|
|
109
|
-
throw e;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
output.warn({
|
|
113
|
-
title: `Unable to download ${completedTask.url}. Hash: ${completedTask.hash}`,
|
|
114
|
-
bodyLines: [
|
|
115
|
-
'The files have been extracted from a previous command invocation.',
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
|
|
121
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
122
|
-
output.note({
|
|
123
|
-
title: `Extracting artifacts`,
|
|
124
|
-
bodyLines: outputs,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
|
|
128
|
-
output.logCommand(getCommand(matchingTask));
|
|
129
|
-
process.stdout.write(cachedResult.terminalOutput);
|
|
130
|
-
output.addVerticalSeparator();
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function getCommand(task) {
|
|
134
|
-
const config = task.target.configuration
|
|
135
|
-
? `:${task.target.configuration}`
|
|
136
|
-
: '';
|
|
137
|
-
return [
|
|
138
|
-
'nx',
|
|
139
|
-
'run',
|
|
140
|
-
`${task.target.project}:${task.target.target}${config}`,
|
|
141
|
-
(0, serializer_overrides_1.serializeOverrides)(task),
|
|
142
|
-
].join(' ');
|
|
143
|
-
}
|
|
144
|
-
function attachSignalListenersToCompleteRunGroupOnError(api, runGroup) {
|
|
145
|
-
process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGINT');
|
|
147
|
-
process.exit(1);
|
|
148
|
-
}));
|
|
149
|
-
process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGTERM');
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
-
if (options.skipNxCache) {
|
|
156
|
-
output.warn({
|
|
157
|
-
title: `--skip-nx-cache is ignored when using distributed tasks execution (DTE).`,
|
|
158
|
-
bodyLine: [`DTE needs the cache to share files between agents.`],
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
162
|
-
output.note({
|
|
163
|
-
title: 'Starting distributed command execution',
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
options.lifeCycle = new NoopLifeCycle();
|
|
167
|
-
const runGroup = (0, environment_1.getRunGroup)();
|
|
168
|
-
if (!runGroup) {
|
|
169
|
-
(0, print_run_group_error_1.printRunGroupError)();
|
|
170
|
-
return process.exit(1);
|
|
171
|
-
}
|
|
172
|
-
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
|
|
173
|
-
const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
|
|
174
|
-
const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true, false);
|
|
175
|
-
const cache = new Cache(options);
|
|
176
|
-
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
|
|
177
|
-
attachSignalListenersToCompleteRunGroupOnError(api, runGroup);
|
|
178
|
-
try {
|
|
179
|
-
const taskGraph = getTaskGraph(context, tasks, options);
|
|
180
|
-
const r = yield runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph);
|
|
181
|
-
if (r.commandStatus === 0) {
|
|
182
|
-
output.success({
|
|
183
|
-
title: 'Successfully completed running the command.',
|
|
184
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
output.error({
|
|
189
|
-
title: 'Command execution failed.',
|
|
190
|
-
bodyLines: [`See run details at ${r.runUrl}`],
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
194
|
-
process.exit(r.commandStatus);
|
|
195
|
-
}
|
|
196
|
-
catch (e) {
|
|
197
|
-
output.error({
|
|
198
|
-
title: 'Unable to complete a run.',
|
|
199
|
-
bodyLines: [e.message],
|
|
200
|
-
});
|
|
201
|
-
if (e.axiosException) {
|
|
202
|
-
console.log(e.axiosException);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
console.log(e);
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
yield api.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`);
|
|
209
|
-
}
|
|
210
|
-
finally {
|
|
211
|
-
process.exit(1);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
|
|
216
|
-
function getTaskGraph(context, tasks, options) {
|
|
217
|
-
if (context.taskGraph) {
|
|
218
|
-
return context.taskGraph;
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
|
|
222
|
-
return new task_graph_creator_1.TaskGraphCreator(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
|
|
226
|
-
var _a, _b;
|
|
227
|
-
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
|
|
228
|
-
const strictlyOrderedTargets = runnerOptions
|
|
229
|
-
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
|
|
230
|
-
: [];
|
|
231
|
-
// Strictly Ordered Targets depend on their dependencies
|
|
232
|
-
for (const target of strictlyOrderedTargets) {
|
|
233
|
-
defaults[target] = defaults[target] || [];
|
|
234
|
-
defaults[target].push({
|
|
235
|
-
target,
|
|
236
|
-
projects: 'dependencies',
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
return defaults;
|
|
240
|
-
}
|
|
241
|
-
//# sourceMappingURL=distributed-execution.runner.js.map
|
|
1
|
+
const a8_0x2c4b=['Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','Extracting\x20artifacts','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','then','TaskGraphCreator','getNxCacheDirectory','./task-graph-creator','message','addVerticalSeparator','executionStatus','defineProperty','executionStatus:\x20','Waiter','FileStorage','success','value','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','target','reset','\x20seconds.','executionId:\x20','tasks','apply','terminalOutput','join','../../api/error-reporter.api','criticalErrorMessage','completedTasks','Starting\x20distributed\x20command\x20execution','get','write','DistributedExecutionApi','existsSync','Processing\x20task\x20','next','skipNxCache','targetDependencies','splitTasksIntoStages','wait','../../../utilities/waiter','See\x20run\x20details\x20at\x20','push','E2EEncryption','scheduleTask','NO_COMPLETED_TASKS_TIMEOUT','Found\x20unknown\x20task:\x20','completeRunGroupWithError','../../file-storage/file-storage','number\x20of\x20completed\x20tasks:\x20','__awaiter','taskGraph','VERBOSE_LOGGING','../../../utilities/serializer-overrides','SIGTERM','Unable\x20to\x20download\x20','warn','hash','done','nodes','configuration','find','DTE\x20needs\x20the\x20cache\x20to\x20share\x20files\x20between\x20agents.','serializeOverrides','length','createUnchangedValueTimeout','ErrorReporterApi','COMPLETED','__esModule','toString','taskId','dependencies','stdout','../../file-storage/e2e-encryption','strip-json-comments','url','Successfully\x20completed\x20running\x20the\x20command.','exit','assign','error','submitRunMetrics','Command\x20execution\x20failed.','Waiting...','endTasks','parse','./split-task-graph-into-stages','getRunGroup','error:\x20','printRunGroupError','ENCRYPTION_KEY','note','project','Unable\x20to\x20complete\x20a\x20run.','lifeCycle','/nx.json','../../../utilities/nx-imports','run','encryptionKey','The\x20files\x20have\x20been\x20extracted\x20from\x20a\x20previous\x20command\x20invocation.','start','commandStatus','../../../utilities/create-unchanged-value-timeout','Retrieving\x20artifacts\x20from\x20','build','log'];(function(_0x43d8f7,_0x2c4b9a){const _0x101cb7=function(_0x4b6b8f){while(--_0x4b6b8f){_0x43d8f7['push'](_0x43d8f7['shift']());}};_0x101cb7(++_0x2c4b9a);}(a8_0x2c4b,0x181));const a8_0x101c=function(_0x43d8f7,_0x2c4b9a){_0x43d8f7=_0x43d8f7-0x0;let _0x101cb7=a8_0x2c4b[_0x43d8f7];return _0x101cb7;};'use strict';var __awaiter=this&&this[a8_0x101c('0x50')]||function(_0x78464,_0xc0146d,_0x3c3e85,_0x11a53c){function _0x46a482(_0x215956){return _0x215956 instanceof _0x3c3e85?_0x215956:new _0x3c3e85(function(_0x2ed7ac){_0x2ed7ac(_0x215956);});}return new(_0x3c3e85||(_0x3c3e85=Promise))(function(_0x172714,_0x1a03ff){function _0x2eded6(_0x134965){try{_0x524867(_0x11a53c[a8_0x101c('0x41')](_0x134965));}catch(_0x420056){_0x1a03ff(_0x420056);}}function _0x4784ba(_0x9925c6){try{_0x524867(_0x11a53c['throw'](_0x9925c6));}catch(_0x1090c4){_0x1a03ff(_0x1090c4);}}function _0x524867(_0x28b1ed){_0x28b1ed[a8_0x101c('0x58')]?_0x172714(_0x28b1ed[a8_0x101c('0x2e')]):_0x46a482(_0x28b1ed[a8_0x101c('0x2e')])[a8_0x101c('0x22')](_0x2eded6,_0x4784ba);}_0x524867((_0x11a53c=_0x11a53c[a8_0x101c('0x35')](_0x78464,_0xc0146d||[]))[a8_0x101c('0x41')]());});};Object[a8_0x101c('0x29')](exports,a8_0x101c('0x62'),{'value':!![]});exports['nxCloudDistributedTasksRunner']=void 0x0;const fs_1=require('fs');const stripJsonComments=require(a8_0x101c('0x0'));const create_unchanged_value_timeout_1=require(a8_0x101c('0x1b'));const environment_1=require('../../../utilities/environment');const metric_logger_1=require('../../../utilities/metric-logger');const serializer_overrides_1=require(a8_0x101c('0x53'));const waiter_1=require(a8_0x101c('0x46'));const error_reporter_api_1=require(a8_0x101c('0x38'));const print_run_group_error_1=require('../../error/print-run-group-error');const e2e_encryption_1=require(a8_0x101c('0x67'));const file_storage_1=require(a8_0x101c('0x4e'));const distributed_execution_api_1=require('./distributed-execution.api');const split_task_graph_into_stages_1=require(a8_0x101c('0xb'));const task_graph_creator_1=require(a8_0x101c('0x25'));const {output,workspaceRoot,getOutputs,Cache}=require(a8_0x101c('0x15'));class NoopLifeCycle{[a8_0x101c('0x4a')](_0x111202){}['startTask'](_0x2d1ecb){}[a8_0x101c('0x9')](_0x2dae6d){}}function runDistributedExecution(_0x4ca707,_0x591e30,_0x48c7de,_0xd547d5,_0xd4af69,_0x1a115c,_0x4a831b){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5921f4=yield _0x4ca707[a8_0x101c('0x19')]((0x0,distributed_execution_api_1['createStartRequest'])(_0x1a115c,(0x0,split_task_graph_into_stages_1[a8_0x101c('0x44')])(_0x4a831b),_0x591e30));return yield processTasks(_0x4ca707,_0xd547d5,_0xd4af69,_0x591e30,_0x5921f4,Object['values'](_0x4a831b[a8_0x101c('0x34')]),_0x48c7de);});}function processTasks(_0x2feacb,_0x47b5d5,_0x12b663,_0x8bf9dd,_0x488b83,_0x4868a5,_0x82a6b6){return __awaiter(this,void 0x0,void 0x0,function*(){const _0xeb427d={};const _0x49ee50=(0x0,create_unchanged_value_timeout_1[a8_0x101c('0x5f')])({'title':'No\x20new\x20completed\x20tasks\x20after\x20'+environment_1[a8_0x101c('0x4b')]/0x3e8+a8_0x101c('0x32'),'timeout':environment_1[a8_0x101c('0x4b')]});const _0xad0a53=new waiter_1[(a8_0x101c('0x2b'))]();while(!![]){if(environment_1['VERBOSE_LOGGING']){output[a8_0x101c('0x10')]({'title':a8_0x101c('0x8')});}yield _0xad0a53[a8_0x101c('0x45')]();const _0x4bcd13=yield _0x2feacb['status'](_0x488b83);if(environment_1[a8_0x101c('0x52')]){output[a8_0x101c('0x10')]({'title':'Status\x20update','bodyLines':[a8_0x101c('0x33')+_0x488b83,a8_0x101c('0x2a')+_0x4bcd13['executionStatus'],a8_0x101c('0x4f')+_0x4bcd13[a8_0x101c('0x3a')]['length'],a8_0x101c('0xd')+_0x4bcd13[a8_0x101c('0x39')]]});}if(_0x4bcd13[a8_0x101c('0x39')]){output[a8_0x101c('0x5')]({'title':'Distributed\x20Execution\x20Terminated','bodyLines':['Error:',_0x4bcd13[a8_0x101c('0x39')]]});process['exit'](0x1);}_0x49ee50(_0x4bcd13[a8_0x101c('0x3a')][a8_0x101c('0x5e')]);for(const _0x2968d4 of _0x4bcd13[a8_0x101c('0x3a')]){if(_0xeb427d[_0x2968d4[a8_0x101c('0x64')]])continue;yield processTask(_0x47b5d5,_0x12b663,_0x82a6b6,_0x8bf9dd,_0x4868a5,_0x2968d4);_0xad0a53[a8_0x101c('0x31')]();_0xeb427d[_0x2968d4[a8_0x101c('0x64')]]=!![];}if(_0x4bcd13[a8_0x101c('0x28')]===a8_0x101c('0x61')){return{'commandStatus':_0x4bcd13[a8_0x101c('0x1a')],'runUrl':_0x4bcd13['runUrl']};}}});}function processTask(_0x15e96e,_0x375e44,_0x5ede12,_0x303c7f,_0x45027b,_0x4c1375){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a8_0x101c('0x52')]){output[a8_0x101c('0x10')]({'title':a8_0x101c('0x40')+_0x4c1375[a8_0x101c('0x64')]});}const _0x5ac152=_0x45027b['find'](_0x3f8c32=>_0x4c1375[a8_0x101c('0x64')]===_0x3f8c32['id']);if(!_0x5ac152){throw new Error(a8_0x101c('0x4c')+_0x4c1375[a8_0x101c('0x64')]);}if(environment_1['VERBOSE_LOGGING']){output[a8_0x101c('0x10')]({'title':a8_0x101c('0x1c')+_0x4c1375[a8_0x101c('0x1')]});}const _0xafc18a=getOutputs(_0x5ede12['projectGraph'][a8_0x101c('0x59')],_0x5ac152);try{yield _0x15e96e['retrieve'](_0x4c1375['hash'],_0x4c1375[a8_0x101c('0x1')],(0x0,environment_1[a8_0x101c('0x24')])(_0x303c7f));}catch(_0x9d9d80){if(_0xafc18a[a8_0x101c('0x5e')]>0x0&&!_0xafc18a[a8_0x101c('0x5b')](_0x1f92a9=>(0x0,fs_1[a8_0x101c('0x3f')])(_0x1f92a9))){throw _0x9d9d80;}else{output[a8_0x101c('0x56')]({'title':a8_0x101c('0x55')+_0x4c1375[a8_0x101c('0x1')]+'.\x20Hash:\x20'+_0x4c1375[a8_0x101c('0x57')],'bodyLines':[a8_0x101c('0x18')]});}}const _0x3dfe9e=yield _0x375e44[a8_0x101c('0x3c')](Object[a8_0x101c('0x4')](Object[a8_0x101c('0x4')]({},_0x5ac152),{'hash':_0x4c1375[a8_0x101c('0x57')]}));if(environment_1['VERBOSE_LOGGING']){output[a8_0x101c('0x10')]({'title':a8_0x101c('0x20'),'bodyLines':_0xafc18a});}yield _0x375e44['copyFilesFromCache'](_0x4c1375[a8_0x101c('0x57')],_0x3dfe9e,_0xafc18a);output['logCommand'](getCommand(_0x5ac152));process[a8_0x101c('0x66')][a8_0x101c('0x3d')](_0x3dfe9e[a8_0x101c('0x36')]);output[a8_0x101c('0x27')]();});}function getCommand(_0x1796b8){const _0x422f99=_0x1796b8['target']['configuration']?':'+_0x1796b8[a8_0x101c('0x30')][a8_0x101c('0x5a')]:'';return['nx',a8_0x101c('0x16'),_0x1796b8[a8_0x101c('0x30')][a8_0x101c('0x11')]+':'+_0x1796b8['target'][a8_0x101c('0x30')]+_0x422f99,(0x0,serializer_overrides_1[a8_0x101c('0x5d')])(_0x1796b8)][a8_0x101c('0x37')]('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x3a0dde,_0xe4f27e){process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x3a0dde[a8_0x101c('0x4d')](_0xe4f27e,a8_0x101c('0x21'));process[a8_0x101c('0x3')](0x1);}));process['on'](a8_0x101c('0x54'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x3a0dde[a8_0x101c('0x4d')](_0xe4f27e,a8_0x101c('0x1f'));process[a8_0x101c('0x3')](0x1);}));}const nxCloudDistributedTasksRunner=(_0x5f0490,_0xe9f664,_0x595dcb)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0xe9f664[a8_0x101c('0x42')]){output[a8_0x101c('0x56')]({'title':'--skip-nx-cache\x20is\x20ignored\x20when\x20using\x20distributed\x20tasks\x20execution\x20(DTE).','bodyLine':[a8_0x101c('0x5c')]});}if(environment_1['VERBOSE_LOGGING']){output[a8_0x101c('0x10')]({'title':a8_0x101c('0x3b')});}_0xe9f664[a8_0x101c('0x13')]=new NoopLifeCycle();const _0x9eaa2c=(0x0,environment_1[a8_0x101c('0xc')])();if(!_0x9eaa2c){(0x0,print_run_group_error_1[a8_0x101c('0xe')])();return process[a8_0x101c('0x3')](0x1);}const _0x1c4c49=new e2e_encryption_1[(a8_0x101c('0x49'))](environment_1[a8_0x101c('0xf')]||_0xe9f664[a8_0x101c('0x17')]);const _0xcfb8bb=new error_reporter_api_1[(a8_0x101c('0x60'))](_0xe9f664);const _0x225d0a=new file_storage_1[(a8_0x101c('0x2c'))](_0x1c4c49,_0xcfb8bb,!![],![]);const _0x44c2d0=new Cache(_0xe9f664);const _0x1aade7=new distributed_execution_api_1[(a8_0x101c('0x3e'))](_0xe9f664);attachSignalListenersToCompleteRunGroupOnError(_0x1aade7,_0x9eaa2c);try{const _0x5f5a9b=getTaskGraph(_0x595dcb,_0x5f0490,_0xe9f664);const _0x391ad9=yield runDistributedExecution(_0x1aade7,_0xe9f664,_0x595dcb,_0x225d0a,_0x44c2d0,_0x9eaa2c,_0x5f5a9b);if(_0x391ad9[a8_0x101c('0x1a')]===0x0){output[a8_0x101c('0x2d')]({'title':a8_0x101c('0x2'),'bodyLines':[a8_0x101c('0x47')+_0x391ad9['runUrl']]});}else{output[a8_0x101c('0x5')]({'title':a8_0x101c('0x7'),'bodyLines':[a8_0x101c('0x47')+_0x391ad9['runUrl']]});}yield(0x0,metric_logger_1[a8_0x101c('0x6')])(_0xe9f664);process[a8_0x101c('0x3')](_0x391ad9[a8_0x101c('0x1a')]);}catch(_0x3142ca){output[a8_0x101c('0x5')]({'title':a8_0x101c('0x12'),'bodyLines':[_0x3142ca[a8_0x101c('0x26')]]});if(_0x3142ca['axiosException']){console['log'](_0x3142ca['axiosException']);}else{console[a8_0x101c('0x1e')](_0x3142ca);}try{yield _0x1aade7[a8_0x101c('0x4d')](_0x9eaa2c,a8_0x101c('0x2f')+_0x3142ca[a8_0x101c('0x26')]+'\x22');}finally{process[a8_0x101c('0x3')](0x1);}}});exports['nxCloudDistributedTasksRunner']=nxCloudDistributedTasksRunner;function getTaskGraph(_0x5b2331,_0x18fc80,_0x294e70){if(_0x5b2331[a8_0x101c('0x51')]){return _0x5b2331[a8_0x101c('0x51')];}else{const _0x418611=JSON[a8_0x101c('0xa')](stripJsonComments((0x0,fs_1['readFileSync'])(workspaceRoot+a8_0x101c('0x14'))[a8_0x101c('0x63')]()));return new task_graph_creator_1[(a8_0x101c('0x23'))](_0x5b2331['projectGraph'],getDefaultDependencyConfigs(_0x418611,_0x294e70))['createTaskGraph'](_0x18fc80);}}function getDefaultDependencyConfigs(_0x5a27f1,_0x463a77){var _0x79f078,_0x1a67bf;const _0x271c85=(_0x79f078=_0x5a27f1[a8_0x101c('0x43')])!==null&&_0x79f078!==void 0x0?_0x79f078:{};const _0x3dadbc=_0x463a77?(_0x1a67bf=_0x463a77['strictlyOrderedTargets'])!==null&&_0x1a67bf!==void 0x0?_0x1a67bf:[a8_0x101c('0x1d')]:[];for(const _0x1c032f of _0x3dadbc){_0x271c85[_0x1c032f]=_0x271c85[_0x1c032f]||[];_0x271c85[_0x1c032f][a8_0x101c('0x48')]({'target':_0x1c032f,'projects':a8_0x101c('0x65')});}return _0x271c85;}
|
|
@@ -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 a9_0x13f3=['has','tasks','splitTasksIntoStages','defineProperty','values','dependencies','size','push'];(function(_0x1c8bff,_0x13f324){const _0xce7e24=function(_0x33651a){while(--_0x33651a){_0x1c8bff['push'](_0x1c8bff['shift']());}};_0xce7e24(++_0x13f324);}(a9_0x13f3,0xdc));const a9_0xce7e=function(_0x1c8bff,_0x13f324){_0x1c8bff=_0x1c8bff-0x0;let _0xce7e24=a9_0x13f3[_0x1c8bff];return _0xce7e24;};'use strict';Object[a9_0xce7e('0x7')](exports,'__esModule',{'value':!![]});exports[a9_0xce7e('0x6')]=void 0x0;function splitTasksIntoStages(_0x489f4d){const _0x2f40b=[];const _0x557b20=new Set(Object[a9_0xce7e('0x0')](_0x489f4d[a9_0xce7e('0x5')])['map'](_0x34db0c=>_0x34db0c['id']));let _0xbdf4da=0x0;while(_0x557b20[a9_0xce7e('0x2')]>0x0){const _0xe624f7=_0x2f40b[_0xbdf4da]=[];for(const _0x526f68 of _0x557b20){let _0x1864d3=!![];for(const _0x11fc11 of _0x489f4d[a9_0xce7e('0x1')][_0x526f68]){if(_0x557b20[a9_0xce7e('0x4')](_0x11fc11)){_0x1864d3=![];break;}}if(!_0x1864d3){continue;}const _0x25dc68=_0x489f4d[a9_0xce7e('0x5')][_0x526f68];_0xe624f7[a9_0xce7e('0x3')](_0x25dc68);}for(const _0x45e14d of _0xe624f7){_0x557b20['delete'](_0x45e14d['id']);}_0xbdf4da++;}return _0x2f40b;}exports[a9_0xce7e('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 a10_0x5f1a=['keys','filter','push','__esModule','dependencies','addTaskToGraph','createTaskGraph','project','target','self','findTask','projects','tasks','length','indexOf','has','../../../utilities/nx-imports','map','addTaskDependencies','defaultTargetDependencies','addDependencies','add','TaskGraphCreator'];(function(_0x323eec,_0x5f1a32){const _0x4bdcf4=function(_0x54a0cd){while(--_0x54a0cd){_0x323eec['push'](_0x323eec['shift']());}};_0x4bdcf4(++_0x5f1a32);}(a10_0x5f1a,0x137));const a10_0x4bdc=function(_0x323eec,_0x5f1a32){_0x323eec=_0x323eec-0x0;let _0x4bdcf4=a10_0x5f1a[_0x323eec];return _0x4bdcf4;};'use strict';Object['defineProperty'](exports,a10_0x4bdc('0xe'),{'value':!![]});exports[a10_0x4bdc('0xa')]=void 0x0;const {getDependencyConfigs}=require(a10_0x4bdc('0x4'));class TaskGraphCreator{constructor(_0x9fd488,_0x2ba92c){this['projectGraph']=_0x9fd488;this['defaultTargetDependencies']=_0x2ba92c;}[a10_0x4bdc('0x11')](_0x37c6e8){const _0x1fa428={'roots':[],'tasks':{},'dependencies':{}};for(const _0x307cbd of _0x37c6e8){this[a10_0x4bdc('0x10')](_0x307cbd,_0x1fa428);const _0x1b125b=getDependencyConfigs(_0x307cbd[a10_0x4bdc('0x13')],this[a10_0x4bdc('0x7')],this['projectGraph']);if(!_0x1b125b){continue;}this[a10_0x4bdc('0x6')](_0x307cbd,_0x1b125b,_0x37c6e8,_0x1fa428);}_0x1fa428['roots']=Object[a10_0x4bdc('0xb')](_0x1fa428['dependencies'])[a10_0x4bdc('0xc')](_0x5a628b=>_0x1fa428[a10_0x4bdc('0xf')][_0x5a628b][a10_0x4bdc('0x1')]===0x0);return _0x1fa428;}[a10_0x4bdc('0x6')](_0x38b10c,_0x57defb,_0x2c2762,_0x449b41){for(const _0x286311 of _0x57defb){if(_0x286311[a10_0x4bdc('0x16')]===a10_0x4bdc('0x14')){for(const _0x25f48a of _0x2c2762){if(_0x25f48a['target']['project']===_0x38b10c['target'][a10_0x4bdc('0x12')]&&_0x25f48a[a10_0x4bdc('0x13')]['target']===_0x286311['target']){_0x449b41[a10_0x4bdc('0xf')][_0x38b10c['id']][a10_0x4bdc('0xd')](_0x25f48a['id']);}}}else if(_0x286311[a10_0x4bdc('0x16')]===a10_0x4bdc('0xf')){const _0x39f58c=new Set();this[a10_0x4bdc('0x8')](_0x38b10c['target'][a10_0x4bdc('0x12')],_0x286311[a10_0x4bdc('0x13')],_0x2c2762,_0x449b41,_0x38b10c['id'],_0x39f58c);}}}[a10_0x4bdc('0x8')](_0x7ca7ab,_0x117ce6,_0x4f399c,_0x5cadb9,_0x5c6077,_0x236910){_0x236910[a10_0x4bdc('0x9')](_0x7ca7ab);const _0x1be6da=this['projectGraph'][a10_0x4bdc('0xf')][_0x7ca7ab];if(_0x1be6da){const _0x187ecf=_0x1be6da[a10_0x4bdc('0x5')](_0x142b2d=>_0x142b2d[a10_0x4bdc('0x13')]);for(const _0xe00feb of _0x187ecf){if(_0x236910[a10_0x4bdc('0x3')](_0xe00feb)){continue;}const _0x2f228b=this[a10_0x4bdc('0x15')]({'project':_0xe00feb,'target':_0x117ce6},_0x4f399c);if(_0x2f228b){if(_0x5cadb9[a10_0x4bdc('0xf')][_0x5c6077][a10_0x4bdc('0x2')](_0x2f228b['id'])===-0x1){_0x5cadb9['dependencies'][_0x5c6077][a10_0x4bdc('0xd')](_0x2f228b['id']);}}else{this[a10_0x4bdc('0x8')](_0xe00feb,_0x117ce6,_0x4f399c,_0x5cadb9,_0x5c6077,_0x236910);}}}}['findTask']({project,target},_0x25d0c6){return _0x25d0c6['find'](_0x53bcbd=>_0x53bcbd['target'][a10_0x4bdc('0x12')]===project&&_0x53bcbd[a10_0x4bdc('0x13')][a10_0x4bdc('0x13')]===target);}[a10_0x4bdc('0x10')](_0x2b7ee1,_0x9f2754){_0x9f2754[a10_0x4bdc('0x0')][_0x2b7ee1['id']]=_0x2b7ee1;_0x9f2754[a10_0x4bdc('0xf')][_0x2b7ee1['id']]=[];}}exports[a10_0x4bdc('0xa')]=TaskGraphCreator;
|