@nrwl/nx-cloud 13.2.2 → 13.3.0-beta.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/run-group.api.js +65 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +138 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +166 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +113 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +158 -1
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +79 -1
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +239 -1
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +130 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +306 -1
- package/lib/nx-cloud-tasks-runner.js +5 -1
- package/lib/nx-cloud-tasks-runner.js.map +1 -1
- package/lib/utilities/environment.d.ts +1 -1
- package/lib/utilities/environment.js +3 -2
- package/lib/utilities/environment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1,130 @@
|
|
|
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.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 +1,306 @@
|
|
|
1
|
-
const a7_0xc9ef=['ENCRYPTION_KEY','TaskGraphCreator','roots','runUrl','Waiting...','addVerticalSeparator','error:\x20','axiosException','__awaiter','Extracting\x20artifacts','catch','executionStatus','hash','startTask','../../error/print-run-group-error','assign','E2EEncryption','submitRunMetrics','createTaskGraph','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','nxCloudDistributedTasksRunner','next','self','Error:','configuration','__esModule','./distributed-execution.api','push','url','dependencies','See\x20run\x20details\x20at\x20','Distributed\x20Execution\x20Terminated','log','executionId:\x20','finally','readFileSync','findTask','success','../../../utilities/waiter','encryptionKey','Unable\x20to\x20complete\x20a\x20run.','note','nx.json','projects','projectGraph','retrieve','./node_modules/.cache/nx','../../file-storage/e2e-encryption','length','taskId','wait','target','defaultTargetDependencies','terminalOutput','../../file-storage/file-storage','message','addTaskDependencies','indexOf','find','Status\x20update','exit','nodes','keys','defineProperty','targetDependencies','getRunGroup','project','printRunGroupError','value','logCommand','VERBOSE_LOGGING','criticalErrorMessage','createNoNewMessagesTimeout','createStartRequest','then','delete','overrides','Successfully\x20completed\x20running\x20the\x20command.','error','../../../utilities/metric-logger','executionStatus:\x20','scheduleTask','lifeCycle','stdout','addDependencies','../../../utilities/environment','completeRunGroupWithError','addTaskToGraph','completedTasks','Command\x20execution\x20failed.','commandStatus','parse','reset','FileStorage','DistributedExecutionApi','Found\x20unknown\x20task:\x20','done','apply','copyFilesFromCache','endTask','strictlyOrderedTargets','build','../../../utilities/create-no-new-messages-timeout','has','map','throw'];(function(_0x24da4,_0xc9efb4){const _0x247c0c=function(_0x28ff1d){while(--_0x28ff1d){_0x24da4['push'](_0x24da4['shift']());}};_0x247c0c(++_0xc9efb4);}(a7_0xc9ef,0x64));const a7_0x247c=function(_0x24da4,_0xc9efb4){_0x24da4=_0x24da4-0x0;let _0x247c0c=a7_0xc9ef[_0x24da4];return _0x247c0c;};'use strict';var __awaiter=this&&this[a7_0x247c('0xe')]||function(_0x30935f,_0x2446cd,_0xd57e5f,_0x1ec0ad){function _0x398579(_0xad6757){return _0xad6757 instanceof _0xd57e5f?_0xad6757:new _0xd57e5f(function(_0x265d7c){_0x265d7c(_0xad6757);});}return new(_0xd57e5f||(_0xd57e5f=Promise))(function(_0x20f22e,_0x529d39){function _0x4294b0(_0x56d5cf){try{_0x2080c9(_0x1ec0ad[a7_0x247c('0x1b')](_0x56d5cf));}catch(_0x1d5f7e){_0x529d39(_0x1d5f7e);}}function _0x2f0a88(_0x93643f){try{_0x2080c9(_0x1ec0ad[a7_0x247c('0x5')](_0x93643f));}catch(_0xca1aef){_0x529d39(_0xca1aef);}}function _0x2080c9(_0x23365b){_0x23365b[a7_0x247c('0x66')]?_0x20f22e(_0x23365b[a7_0x247c('0x4a')]):_0x398579(_0x23365b[a7_0x247c('0x4a')])[a7_0x247c('0x50')](_0x4294b0,_0x2f0a88);}_0x2080c9((_0x1ec0ad=_0x1ec0ad[a7_0x247c('0x67')](_0x30935f,_0x2446cd||[]))[a7_0x247c('0x1b')]());});};Object[a7_0x247c('0x45')](exports,a7_0x247c('0x1f'),{'value':!![]});exports[a7_0x247c('0x7')]=exports[a7_0x247c('0x1a')]=void 0x0;const Observable_1=require('rxjs/internal/Observable');const stripJsonComments=require('strip-json-comments');const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x247c('0x20'));const file_storage_1=require(a7_0x247c('0x3c'));const e2e_encryption_1=require(a7_0x247c('0x35'));const waiter_1=require(a7_0x247c('0x2c'));const environment_1=require(a7_0x247c('0x5b'));const print_run_group_error_1=require(a7_0x247c('0x14'));const create_no_new_messages_timeout_1=require(a7_0x247c('0x2'));const metric_logger_1=require(a7_0x247c('0x55'));const {output,getDependencyConfigs,getOutputs,unparse,Cache}=require('../../../utilities/nx-imports');class NoopLifeCycle{[a7_0x247c('0x57')](_0x456b9d){}[a7_0x247c('0x13')](_0x1243ca){}[a7_0x247c('0x69')](_0x2f44b8,_0x5ce368){}}function runDistributedExecution(_0xcba97,_0x1b640f,_0x89144b,_0x5c2fbd,_0x33fc6b,_0x1494d0,_0x3b60eb){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x56fa29=JSON[a7_0x247c('0x61')](stripJsonComments((0x0,fs_1[a7_0x247c('0x29')])(a7_0x247c('0x30'))['toString']()));const _0xb4d4d2=new TaskOrderer(_0x89144b[a7_0x247c('0x32')],getDefaultDependencyConfigs(_0x56fa29,_0x1b640f))['splitTasksIntoStages'](_0x3b60eb);const _0xd301a8=yield _0xcba97['start']((0x0,distributed_execution_api_1[a7_0x247c('0x4f')])(_0x1494d0,_0xb4d4d2,_0x1b640f));return yield processTasks(_0xcba97,_0x5c2fbd,_0x33fc6b,_0x1b640f,_0xd301a8,_0x3b60eb,_0x89144b);});}function processTasks(_0x3fbf08,_0x322dec,_0x13a70a,_0xe0f742,_0x407ad2,_0x55c02f,_0x590ed5){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x49419b={};const _0x377fc4=(0x0,create_no_new_messages_timeout_1[a7_0x247c('0x4e')])();const _0x51b5eb=new waiter_1['Waiter']();while(!![]){if(environment_1[a7_0x247c('0x4c')]){output[a7_0x247c('0x2f')]({'title':a7_0x247c('0xa')});}yield _0x51b5eb[a7_0x247c('0x38')]();const _0x6024b3=yield _0x3fbf08['status'](_0x407ad2);if(environment_1['VERBOSE_LOGGING']){output[a7_0x247c('0x2f')]({'title':a7_0x247c('0x41'),'bodyLines':[a7_0x247c('0x27')+_0x407ad2,a7_0x247c('0x56')+_0x6024b3[a7_0x247c('0x11')],'number\x20of\x20completed\x20tasks:\x20'+_0x6024b3['completedTasks'][a7_0x247c('0x36')],a7_0x247c('0xc')+_0x6024b3[a7_0x247c('0x4d')]]});}if(_0x6024b3['criticalErrorMessage']){output['error']({'title':a7_0x247c('0x25'),'bodyLines':[a7_0x247c('0x1d'),_0x6024b3[a7_0x247c('0x4d')]]});process[a7_0x247c('0x42')](0x1);}_0x377fc4(_0x6024b3[a7_0x247c('0x5e')][a7_0x247c('0x36')]);for(const _0x5d029b of _0x6024b3[a7_0x247c('0x5e')]){if(_0x49419b[_0x5d029b['taskId']])continue;yield processTask(_0x322dec,_0x13a70a,_0x590ed5,_0xe0f742,_0x55c02f,_0x5d029b);_0x51b5eb[a7_0x247c('0x62')]();_0x49419b[_0x5d029b[a7_0x247c('0x37')]]=!![];}if(_0x6024b3['executionStatus']==='COMPLETED'){return{'commandStatus':_0x6024b3['commandStatus'],'runUrl':_0x6024b3[a7_0x247c('0x9')]};}}});}function processTask(_0x3a2d32,_0x2ab294,_0x33d4fe,_0x182e70,_0x3e01ec,_0x205ff5){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a7_0x247c('0x2f')]({'title':'Processing\x20task\x20'+_0x205ff5[a7_0x247c('0x37')]});}const _0x22fe79=_0x3e01ec[a7_0x247c('0x40')](_0x3e1a8b=>_0x205ff5[a7_0x247c('0x37')]===_0x3e1a8b['id']);if(!_0x22fe79){throw new Error(a7_0x247c('0x65')+_0x205ff5[a7_0x247c('0x37')]);}if(environment_1[a7_0x247c('0x4c')]){output[a7_0x247c('0x2f')]({'title':'Retrieving\x20artifacts\x20from\x20'+_0x205ff5[a7_0x247c('0x22')]});}yield _0x3a2d32[a7_0x247c('0x33')](_0x205ff5[a7_0x247c('0x12')],_0x205ff5[a7_0x247c('0x22')],_0x182e70['cacheDirectory']||a7_0x247c('0x34'));const _0x571726=yield _0x2ab294['get'](Object[a7_0x247c('0x15')](Object[a7_0x247c('0x15')]({},_0x22fe79),{'hash':_0x205ff5['hash']}));const _0x26c37e=getOutputs(_0x33d4fe[a7_0x247c('0x32')][a7_0x247c('0x43')],_0x22fe79);if(environment_1[a7_0x247c('0x4c')]){output['note']({'title':a7_0x247c('0xf'),'bodyLines':_0x26c37e});}yield _0x2ab294[a7_0x247c('0x68')](_0x205ff5[a7_0x247c('0x12')],_0x571726,_0x26c37e);output[a7_0x247c('0x4b')](getCommand(_0x22fe79));process[a7_0x247c('0x59')]['write'](_0x571726[a7_0x247c('0x3b')]);output[a7_0x247c('0xb')]();});}function getCommand(_0x3bab65){const _0x3f5e2f=unparse(_0x3bab65[a7_0x247c('0x52')]||{});const _0x4fa791=_0x3bab65['target']['configuration']?':'+_0x3bab65[a7_0x247c('0x39')][a7_0x247c('0x1e')]:'';return['nx','run',_0x3bab65[a7_0x247c('0x39')][a7_0x247c('0x48')]+':'+_0x3bab65[a7_0x247c('0x39')][a7_0x247c('0x39')]+_0x4fa791,..._0x3f5e2f]['join']('\x20');}const nxCloudDistributedTasksRunner=(_0x39cdaa,_0x59287d,_0x107c99)=>{if(environment_1[a7_0x247c('0x4c')]){output[a7_0x247c('0x2f')]({'title':'Starting\x20distributed\x20command\x20execution'});}_0x59287d[a7_0x247c('0x58')]=new NoopLifeCycle();const _0x5eeb2d=(0x0,environment_1[a7_0x247c('0x47')])();if(!_0x5eeb2d){(0x0,print_run_group_error_1[a7_0x247c('0x49')])();return process[a7_0x247c('0x42')](0x1);}const _0x2dacd6=new e2e_encryption_1[(a7_0x247c('0x16'))](environment_1[a7_0x247c('0x6')]||_0x59287d[a7_0x247c('0x2d')]);const _0x320243=new file_storage_1[(a7_0x247c('0x63'))](_0x2dacd6);const _0xd47c9=new Cache(_0x59287d);const _0x8d738=new distributed_execution_api_1[(a7_0x247c('0x64'))](_0x59287d);runDistributedExecution(_0x8d738,_0x59287d,_0x107c99,_0x320243,_0xd47c9,_0x5eeb2d,_0x39cdaa)[a7_0x247c('0x50')](_0x2ed2ac=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0x2ed2ac[a7_0x247c('0x60')]===0x0){output[a7_0x247c('0x2b')]({'title':a7_0x247c('0x53'),'bodyLines':[a7_0x247c('0x24')+_0x2ed2ac[a7_0x247c('0x9')]]});}else{output[a7_0x247c('0x54')]({'title':a7_0x247c('0x5f'),'bodyLines':[a7_0x247c('0x24')+_0x2ed2ac[a7_0x247c('0x9')]]});}yield(0x0,metric_logger_1[a7_0x247c('0x17')])(_0x59287d);process[a7_0x247c('0x42')](_0x2ed2ac[a7_0x247c('0x60')]);}))[a7_0x247c('0x10')](_0x512fb2=>{output[a7_0x247c('0x54')]({'title':a7_0x247c('0x2e'),'bodyLines':[_0x512fb2[a7_0x247c('0x3d')]]});if(_0x512fb2['axiosException']){console[a7_0x247c('0x26')](_0x512fb2[a7_0x247c('0xd')]);}else{console['log'](_0x512fb2);}_0x8d738[a7_0x247c('0x5c')](_0x5eeb2d,a7_0x247c('0x19')+_0x512fb2[a7_0x247c('0x3d')]+'\x22')[a7_0x247c('0x28')](()=>process['exit'](0x1));});return new Observable_1['Observable'](()=>{});};exports[a7_0x247c('0x1a')]=nxCloudDistributedTasksRunner;class TaskOrderer{constructor(_0x5eef82,_0x84ac3a){this['projectGraph']=_0x5eef82;this[a7_0x247c('0x3a')]=_0x84ac3a;}['splitTasksIntoStages'](_0xc04f01){if(_0xc04f01[a7_0x247c('0x36')]===0x0)return[];const _0x3a55ac=[];const _0x2f7ac0=this['createTaskGraph'](_0xc04f01);const _0x2ffa08=new Set(_0xc04f01[a7_0x247c('0x4')](_0x41df56=>_0x41df56['id']));let _0x2013f6=0x0;while(_0x2ffa08['size']>0x0){const _0x1c18a0=_0x3a55ac[_0x2013f6]=[];for(const _0x28ab49 of _0x2ffa08){let _0x2b5b82=!![];for(const _0x569ad7 of _0x2f7ac0[a7_0x247c('0x23')][_0x28ab49]){if(_0x2ffa08[a7_0x247c('0x3')](_0x569ad7)){_0x2b5b82=![];break;}}if(!_0x2b5b82){continue;}const _0x1c65ca=_0x2f7ac0['tasks'][_0x28ab49];_0x1c18a0[a7_0x247c('0x21')](_0x1c65ca);}for(const _0x2071f1 of _0x1c18a0){_0x2ffa08[a7_0x247c('0x51')](_0x2071f1['id']);}_0x2013f6++;}return _0x3a55ac;}['createTaskGraph'](_0x699c67){const _0x44112e=new TaskGraphCreator(this[a7_0x247c('0x32')],this[a7_0x247c('0x3a')]);return _0x44112e['createTaskGraph'](_0x699c67);}}class TaskGraphCreator{constructor(_0x365591,_0x2b1eff){this[a7_0x247c('0x32')]=_0x365591;this[a7_0x247c('0x3a')]=_0x2b1eff;}[a7_0x247c('0x18')](_0x5e170f){const _0x53cd1a={'roots':[],'tasks':{},'dependencies':{}};for(const _0x5d33d1 of _0x5e170f){this[a7_0x247c('0x5d')](_0x5d33d1,_0x53cd1a);const _0x213a8c=getDependencyConfigs(_0x5d33d1[a7_0x247c('0x39')],this[a7_0x247c('0x3a')],this[a7_0x247c('0x32')]);if(!_0x213a8c){continue;}this['addTaskDependencies'](_0x5d33d1,_0x213a8c,_0x5e170f,_0x53cd1a);}_0x53cd1a[a7_0x247c('0x8')]=Object[a7_0x247c('0x44')](_0x53cd1a[a7_0x247c('0x23')])['filter'](_0x5d1ed3=>_0x53cd1a[a7_0x247c('0x23')][_0x5d1ed3][a7_0x247c('0x36')]===0x0);return _0x53cd1a;}[a7_0x247c('0x3e')](_0x11150d,_0x44a519,_0x227d74,_0x108818){for(const _0x51196b of _0x44a519){if(_0x51196b[a7_0x247c('0x31')]===a7_0x247c('0x1c')){for(const _0x300986 of _0x227d74){if(_0x300986['target'][a7_0x247c('0x48')]===_0x11150d[a7_0x247c('0x39')][a7_0x247c('0x48')]&&_0x300986[a7_0x247c('0x39')][a7_0x247c('0x39')]===_0x51196b[a7_0x247c('0x39')]){_0x108818[a7_0x247c('0x23')][_0x11150d['id']][a7_0x247c('0x21')](_0x300986['id']);}}}else if(_0x51196b[a7_0x247c('0x31')]===a7_0x247c('0x23')){const _0x177434=new Set();this['addDependencies'](_0x11150d['target'][a7_0x247c('0x48')],_0x51196b[a7_0x247c('0x39')],_0x227d74,_0x108818,_0x11150d['id'],_0x177434);}}}[a7_0x247c('0x5a')](_0x272838,_0x2536f7,_0x27a58b,_0x5aac49,_0x1bbfdd,_0x317758){_0x317758['add'](_0x272838);const _0x596858=this[a7_0x247c('0x32')][a7_0x247c('0x23')][_0x272838];if(_0x596858){const _0x2a2112=_0x596858[a7_0x247c('0x4')](_0x222fc3=>_0x222fc3[a7_0x247c('0x39')]);for(const _0x45aea7 of _0x2a2112){if(_0x317758[a7_0x247c('0x3')](_0x45aea7)){continue;}const _0xc739=this[a7_0x247c('0x2a')]({'project':_0x45aea7,'target':_0x2536f7},_0x27a58b);if(_0xc739){if(_0x5aac49[a7_0x247c('0x23')][_0x1bbfdd][a7_0x247c('0x3f')](_0xc739['id'])===-0x1){_0x5aac49[a7_0x247c('0x23')][_0x1bbfdd][a7_0x247c('0x21')](_0xc739['id']);}}else{this[a7_0x247c('0x5a')](_0x45aea7,_0x2536f7,_0x27a58b,_0x5aac49,_0x1bbfdd,_0x317758);}}}}[a7_0x247c('0x2a')]({project,target},_0x4b8197){return _0x4b8197[a7_0x247c('0x40')](_0x5f3fe3=>_0x5f3fe3['target']['project']===project&&_0x5f3fe3[a7_0x247c('0x39')][a7_0x247c('0x39')]===target);}['addTaskToGraph'](_0x1692c0,_0x443958){_0x443958['tasks'][_0x1692c0['id']]=_0x1692c0;_0x443958[a7_0x247c('0x23')][_0x1692c0['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;function getDefaultDependencyConfigs(_0x1e3b97,_0x23a679){var _0x2e47f8,_0x4349e5;const _0x381c40=(_0x2e47f8=_0x1e3b97[a7_0x247c('0x46')])!==null&&_0x2e47f8!==void 0x0?_0x2e47f8:{};const _0x3e72d9=_0x23a679?(_0x4349e5=_0x23a679[a7_0x247c('0x0')])!==null&&_0x4349e5!==void 0x0?_0x4349e5:[a7_0x247c('0x1')]:[];for(const _0x340ff5 of _0x3e72d9){_0x381c40[_0x340ff5]=_0x381c40[_0x340ff5]||[];_0x381c40[_0x340ff5]['push']({'target':_0x340ff5,'projects':a7_0x247c('0x23')});}return _0x381c40;}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaskGraphCreator = exports.nxCloudDistributedTasksRunner = void 0;
|
|
13
|
+
const Observable_1 = require("rxjs/internal/Observable");
|
|
14
|
+
const stripJsonComments = require("strip-json-comments");
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const distributed_execution_api_1 = require("./distributed-execution.api");
|
|
17
|
+
const file_storage_1 = require("../../file-storage/file-storage");
|
|
18
|
+
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
19
|
+
const waiter_1 = require("../../../utilities/waiter");
|
|
20
|
+
const environment_1 = require("../../../utilities/environment");
|
|
21
|
+
const print_run_group_error_1 = require("../../error/print-run-group-error");
|
|
22
|
+
const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
|
|
23
|
+
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
24
|
+
const { output, getDependencyConfigs, getOutputs, unparse, Cache, } = require('../../../utilities/nx-imports');
|
|
25
|
+
class NoopLifeCycle {
|
|
26
|
+
scheduleTask(task) { }
|
|
27
|
+
startTask(task) { }
|
|
28
|
+
endTask(task, code) { }
|
|
29
|
+
}
|
|
30
|
+
function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString()));
|
|
33
|
+
const stages = new TaskOrderer(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).splitTasksIntoStages(tasks);
|
|
34
|
+
const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, stages, options));
|
|
35
|
+
return yield processTasks(api, fileStorage, cache, options, id, tasks, context);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const processedTasks = {};
|
|
41
|
+
const failIfNumberOfCompletedTasksDoesNotChangeIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
|
|
42
|
+
const waiter = new waiter_1.Waiter();
|
|
43
|
+
while (true) {
|
|
44
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
45
|
+
output.note({
|
|
46
|
+
title: 'Waiting...',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
yield waiter.wait();
|
|
50
|
+
const r = yield api.status(executionId);
|
|
51
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
52
|
+
output.note({
|
|
53
|
+
title: `Status update`,
|
|
54
|
+
bodyLines: [
|
|
55
|
+
`executionId: ${executionId}`,
|
|
56
|
+
`executionStatus: ${r.executionStatus}`,
|
|
57
|
+
`number of completed tasks: ${r.completedTasks.length}`,
|
|
58
|
+
`error: ${r.criticalErrorMessage}`,
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (r.criticalErrorMessage) {
|
|
63
|
+
output.error({
|
|
64
|
+
title: 'Distributed Execution Terminated',
|
|
65
|
+
bodyLines: ['Error:', r.criticalErrorMessage],
|
|
66
|
+
});
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
failIfNumberOfCompletedTasksDoesNotChangeIn30Mins(r.completedTasks.length);
|
|
70
|
+
for (const t of r.completedTasks) {
|
|
71
|
+
if (processedTasks[t.taskId])
|
|
72
|
+
continue;
|
|
73
|
+
yield processTask(fileStorage, cache, context, options, tasks, t);
|
|
74
|
+
waiter.reset();
|
|
75
|
+
processedTasks[t.taskId] = true;
|
|
76
|
+
}
|
|
77
|
+
if (r.executionStatus === 'COMPLETED') {
|
|
78
|
+
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function processTask(fileStorage, cache, context, options, tasks, completedTask) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
86
|
+
output.note({
|
|
87
|
+
title: `Processing task ${completedTask.taskId}`,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
|
|
91
|
+
if (!matchingTask) {
|
|
92
|
+
throw new Error(`Found unknown task: ${completedTask.taskId}`);
|
|
93
|
+
}
|
|
94
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
95
|
+
output.note({
|
|
96
|
+
title: `Retrieving artifacts from ${completedTask.url}`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
|
|
100
|
+
const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
|
|
101
|
+
const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
|
|
102
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
103
|
+
output.note({
|
|
104
|
+
title: `Extracting artifacts`,
|
|
105
|
+
bodyLines: outputs,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
|
|
109
|
+
output.logCommand(getCommand(matchingTask));
|
|
110
|
+
process.stdout.write(cachedResult.terminalOutput);
|
|
111
|
+
output.addVerticalSeparator();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function getCommand(task) {
|
|
115
|
+
const args = unparse(task.overrides || {});
|
|
116
|
+
const config = task.target.configuration
|
|
117
|
+
? `:${task.target.configuration}`
|
|
118
|
+
: '';
|
|
119
|
+
return [
|
|
120
|
+
'nx',
|
|
121
|
+
'run',
|
|
122
|
+
`${task.target.project}:${task.target.target}${config}`,
|
|
123
|
+
...args,
|
|
124
|
+
].join(' ');
|
|
125
|
+
}
|
|
126
|
+
const nxCloudDistributedTasksRunner = (tasks, options, context) => {
|
|
127
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
128
|
+
output.note({
|
|
129
|
+
title: 'Starting distributed command execution',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
options.lifeCycle = new NoopLifeCycle();
|
|
133
|
+
const runGroup = (0, environment_1.getRunGroup)();
|
|
134
|
+
if (!runGroup) {
|
|
135
|
+
(0, print_run_group_error_1.printRunGroupError)();
|
|
136
|
+
return process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
|
|
139
|
+
const fileStorage = new file_storage_1.FileStorage(encryption);
|
|
140
|
+
const cache = new Cache(options);
|
|
141
|
+
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
|
|
142
|
+
runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks)
|
|
143
|
+
.then((r) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
+
if (r.commandStatus === 0) {
|
|
145
|
+
output.success({
|
|
146
|
+
title: 'Successfully completed running the command.',
|
|
147
|
+
bodyLines: [`See run details at ${r.runUrl}`],
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
output.error({
|
|
152
|
+
title: 'Command execution failed.',
|
|
153
|
+
bodyLines: [`See run details at ${r.runUrl}`],
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
157
|
+
process.exit(r.commandStatus);
|
|
158
|
+
}))
|
|
159
|
+
.catch((e) => {
|
|
160
|
+
output.error({
|
|
161
|
+
title: 'Unable to complete a run.',
|
|
162
|
+
bodyLines: [e.message],
|
|
163
|
+
});
|
|
164
|
+
if (e.axiosException) {
|
|
165
|
+
console.log(e.axiosException);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
console.log(e);
|
|
169
|
+
}
|
|
170
|
+
api
|
|
171
|
+
.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`)
|
|
172
|
+
.finally(() => process.exit(1));
|
|
173
|
+
});
|
|
174
|
+
return new Observable_1.Observable(() => { });
|
|
175
|
+
};
|
|
176
|
+
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
|
|
177
|
+
class TaskOrderer {
|
|
178
|
+
constructor(projectGraph, defaultTargetDependencies) {
|
|
179
|
+
this.projectGraph = projectGraph;
|
|
180
|
+
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
181
|
+
}
|
|
182
|
+
splitTasksIntoStages(tasks) {
|
|
183
|
+
if (tasks.length === 0)
|
|
184
|
+
return [];
|
|
185
|
+
const stages = [];
|
|
186
|
+
const taskGraph = this.createTaskGraph(tasks);
|
|
187
|
+
const notStagedTaskIds = new Set(tasks.map((t) => t.id));
|
|
188
|
+
let stageIndex = 0;
|
|
189
|
+
// Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
|
|
190
|
+
while (notStagedTaskIds.size > 0) {
|
|
191
|
+
const currentStage = (stages[stageIndex] = []);
|
|
192
|
+
for (const taskId of notStagedTaskIds) {
|
|
193
|
+
let ready = true;
|
|
194
|
+
for (const dependency of taskGraph.dependencies[taskId]) {
|
|
195
|
+
if (notStagedTaskIds.has(dependency)) {
|
|
196
|
+
// dependency has not been staged yet, this task is not ready to be staged.
|
|
197
|
+
ready = false;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Some dependency still has not been staged, skip it for now, it will be processed again
|
|
202
|
+
if (!ready) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
// All the dependencies have been staged, let's stage it.
|
|
206
|
+
const task = taskGraph.tasks[taskId];
|
|
207
|
+
currentStage.push(task);
|
|
208
|
+
}
|
|
209
|
+
// Remove the entire new stage of tasks from the list
|
|
210
|
+
for (const task of currentStage) {
|
|
211
|
+
notStagedTaskIds.delete(task.id);
|
|
212
|
+
}
|
|
213
|
+
stageIndex++;
|
|
214
|
+
}
|
|
215
|
+
return stages;
|
|
216
|
+
}
|
|
217
|
+
createTaskGraph(tasks) {
|
|
218
|
+
const t = new TaskGraphCreator(this.projectGraph, this.defaultTargetDependencies);
|
|
219
|
+
return t.createTaskGraph(tasks);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
class TaskGraphCreator {
|
|
223
|
+
constructor(projectGraph, defaultTargetDependencies) {
|
|
224
|
+
this.projectGraph = projectGraph;
|
|
225
|
+
this.defaultTargetDependencies = defaultTargetDependencies;
|
|
226
|
+
}
|
|
227
|
+
createTaskGraph(tasks) {
|
|
228
|
+
const graph = {
|
|
229
|
+
roots: [],
|
|
230
|
+
tasks: {},
|
|
231
|
+
dependencies: {},
|
|
232
|
+
};
|
|
233
|
+
for (const task of tasks) {
|
|
234
|
+
this.addTaskToGraph(task, graph);
|
|
235
|
+
const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
|
|
236
|
+
if (!dependencyConfigs) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
|
|
240
|
+
}
|
|
241
|
+
graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
|
|
242
|
+
return graph;
|
|
243
|
+
}
|
|
244
|
+
addTaskDependencies(task, dependencyConfigs, tasks, graph) {
|
|
245
|
+
for (const dependencyConfig of dependencyConfigs) {
|
|
246
|
+
if (dependencyConfig.projects === 'self') {
|
|
247
|
+
for (const t of tasks) {
|
|
248
|
+
if (t.target.project === task.target.project &&
|
|
249
|
+
t.target.target === dependencyConfig.target) {
|
|
250
|
+
graph.dependencies[task.id].push(t.id);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else if (dependencyConfig.projects === 'dependencies') {
|
|
255
|
+
const seen = new Set();
|
|
256
|
+
this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
addDependencies(project, target, tasks, graph, taskId, seen) {
|
|
261
|
+
seen.add(project);
|
|
262
|
+
const dependencies = this.projectGraph.dependencies[project];
|
|
263
|
+
if (dependencies) {
|
|
264
|
+
const projectDependencies = dependencies.map((dependency) => dependency.target);
|
|
265
|
+
for (const projectDependency of projectDependencies) {
|
|
266
|
+
if (seen.has(projectDependency)) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const dependency = this.findTask({ project: projectDependency, target }, tasks);
|
|
270
|
+
if (dependency) {
|
|
271
|
+
if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
|
|
272
|
+
graph.dependencies[taskId].push(dependency.id);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
findTask({ project, target }, tasks) {
|
|
282
|
+
return tasks.find((t) => t.target.project === project && t.target.target === target);
|
|
283
|
+
}
|
|
284
|
+
addTaskToGraph(task, graph) {
|
|
285
|
+
graph.tasks[task.id] = task;
|
|
286
|
+
graph.dependencies[task.id] = [];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
exports.TaskGraphCreator = TaskGraphCreator;
|
|
290
|
+
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
|
|
291
|
+
var _a, _b;
|
|
292
|
+
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
|
|
293
|
+
const strictlyOrderedTargets = runnerOptions
|
|
294
|
+
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
|
|
295
|
+
: [];
|
|
296
|
+
// Strictly Ordered Targets depend on their dependencies
|
|
297
|
+
for (const target of strictlyOrderedTargets) {
|
|
298
|
+
defaults[target] = defaults[target] || [];
|
|
299
|
+
defaults[target].push({
|
|
300
|
+
target,
|
|
301
|
+
projects: 'dependencies',
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
return defaults;
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=distributed-execution.runner.js.map
|
|
@@ -19,7 +19,7 @@ const nxCloudTasksRunner = (tasks, options, context) => {
|
|
|
19
19
|
if (!environment_1.ACCESS_TOKEN && !options.accessToken) {
|
|
20
20
|
return tasksRunnerV2(tasks, options, context);
|
|
21
21
|
}
|
|
22
|
-
if (environment_1.
|
|
22
|
+
if (environment_1.NX_NO_CLOUD) {
|
|
23
23
|
return tasksRunnerV2(tasks, options, context);
|
|
24
24
|
}
|
|
25
25
|
if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
|
|
@@ -44,9 +44,13 @@ const nxCloudTasksRunner = (tasks, options, context) => {
|
|
|
44
44
|
'Execution will now continue using this machine only.',
|
|
45
45
|
],
|
|
46
46
|
});
|
|
47
|
+
// This disables using Cloud for all inner nx invocations, so it won't create an extra run.
|
|
48
|
+
process.env.NX_CLOUD = 'false';
|
|
47
49
|
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
48
50
|
}));
|
|
49
51
|
}
|
|
52
|
+
// This disables using Cloud for all inner nx invocations, so it won't create an extra run.
|
|
53
|
+
process.env.NX_CLOUD = 'false';
|
|
50
54
|
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
51
55
|
};
|
|
52
56
|
function verifyNxCloudWorkspaceEnabled(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-cloud-tasks-runner.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/lib/nx-cloud-tasks-runner.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,wDAAqD;AACrD,iEAA8D;AAE9D,yDAKiC;AACjC,6CAA+E;AAC/E,4FAA4F;AAG5F,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEpE,MAAM,kBAAkB,GAAQ,CAC9B,KAAa,EACb,OAA+B,EAC/B,OAAY,EACK,EAAE;IACnB,IAAI,CAAC,0BAAY,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;QACzC,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAQ,CAAC;KACtD;IAED,IAAI,
|
|
1
|
+
{"version":3,"file":"nx-cloud-tasks-runner.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/lib/nx-cloud-tasks-runner.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,wDAAqD;AACrD,iEAA8D;AAE9D,yDAKiC;AACjC,6CAA+E;AAC/E,4FAA4F;AAG5F,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEpE,MAAM,kBAAkB,GAAQ,CAC9B,KAAa,EACb,OAA+B,EAC/B,OAAY,EACK,EAAE;IACnB,IAAI,CAAC,0BAAY,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;QACzC,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAQ,CAAC;KACtD;IAED,IAAI,yBAAW,EAAE;QACf,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAQ,CAAC;KACtD;IAED,IAAI,oDAAsC,EAAE;QAC1C,sCAAsC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACxD;IAED,iCAAiC;IACjC,IACE,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAAK,MAAM;QACrD,CAAC,oDAAsC,EACvC;QACA,wCAAwC,CA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MITED_FILE_SIZE: number;
|
|
6
6
|
export declare const DEFAULT_FILE_SIZE_LIMIT: number;
|
|
7
7
|
export declare const DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE = 166;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const NX_NO_CLOUD: boolean;
|
|
9
9
|
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION_ID: string | undefined;
|
|
10
10
|
export declare const AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION: boolean;
|
|
11
11
|
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseCommand = exports.getMachineInfo = exports.getBranch = exports.getRunGroup = exports.extractGitSha = exports.NX_CLOUD_NO_TIMEOUTS = exports.VERBOSE_LOGGING = exports.ENCRYPTION_KEY = exports.ACCESS_TOKEN = exports.NX_CLOUD_FORCE_METRICS = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT = exports.NUMBER_OF_AXIOS_RETRIES = exports.NX_CLOUD_DISTRIBUTED_EXECUTION = exports.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_ID = exports.
|
|
3
|
+
exports.parseCommand = exports.getMachineInfo = exports.getBranch = exports.getRunGroup = exports.extractGitSha = exports.NX_CLOUD_NO_TIMEOUTS = exports.VERBOSE_LOGGING = exports.ENCRYPTION_KEY = exports.ACCESS_TOKEN = exports.NX_CLOUD_FORCE_METRICS = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT = exports.NUMBER_OF_AXIOS_RETRIES = exports.NX_CLOUD_DISTRIBUTED_EXECUTION = exports.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION = exports.NX_CLOUD_DISTRIBUTED_EXECUTION_ID = exports.NX_NO_CLOUD = exports.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE = exports.DEFAULT_FILE_SIZE_LIMIT = exports.UNLIMITED_FILE_SIZE = exports.NO_MESSAGES_TIMEOUT = exports.UNLIMITED_TIMEOUT = void 0;
|
|
4
4
|
const node_machine_id_1 = require("node-machine-id");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const fs_1 = require("fs");
|
|
@@ -12,7 +12,8 @@ exports.NO_MESSAGES_TIMEOUT = 3600000; // 60 minutes
|
|
|
12
12
|
exports.UNLIMITED_FILE_SIZE = 1000 * 1000 * 10000;
|
|
13
13
|
exports.DEFAULT_FILE_SIZE_LIMIT = 1000 * 1000 * 300;
|
|
14
14
|
exports.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE = 166;
|
|
15
|
-
exports.
|
|
15
|
+
exports.NX_NO_CLOUD = process.env.NX_INVOKED_BY_RUNNER === 'true' ||
|
|
16
|
+
process.env.NX_CLOUD === 'false';
|
|
16
17
|
exports.NX_CLOUD_DISTRIBUTED_EXECUTION_ID = process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
|
|
17
18
|
exports.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION = !!exports.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
|
|
18
19
|
exports.NX_CLOUD_DISTRIBUTED_EXECUTION = process.env.NX_CLOUD_DISTRIBUTED_EXECUTION === 'true';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/environment.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAEhD,iDAAyC;AACzC,2BAAkC;AAClC,+BAA4B;AAC5B,iCAAiC;AACjC,MAAM,EAAE,WAAW,EAA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