@nrwl/nx-cloud 15.0.3 → 15.0.4-beta.1

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.
@@ -1 +1,241 @@
1
- const a8_0x41b4=['Successfully\x20completed\x20running\x20the\x20command.','Command\x20execution\x20failed.','completedTasks','retrieve','start','getNxCacheDirectory','./task-graph-creator','taskGraph','stdout','exit','assign','target','toString','./split-task-graph-into-stages','No\x20new\x20completed\x20tasks\x20after\x20','createUnchangedValueTimeout','../../../utilities/nx-imports','/nx.json','configuration','ErrorReporterApi','status','project','Retrieving\x20artifacts\x20from\x20','projectGraph','Status\x20update','values','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','lifeCycle','ENCRYPTION_KEY','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','logCommand','VERBOSE_LOGGING','executionId:\x20','throw','strip-json-comments','Waiting...','log','Waiter','createTaskGraph','readFileSync','Unable\x20to\x20complete\x20a\x20run.','get','commandStatus','completeRunGroupWithError','endTask','See\x20run\x20details\x20at\x20','TaskGraphCreator','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','write','reset','tasks','Processing\x20task\x20','join','FileStorage','taskId','DistributedExecutionApi','success','note','../../api/error-reporter.api','encryptionKey','serializeOverrides','NO_COMPLETED_TASKS_TIMEOUT','criticalErrorMessage','addVerticalSeparator','__awaiter','./distributed-execution.api','wait','printRunGroupError','Starting\x20distributed\x20command\x20execution','value','startTask','createStartRequest','nodes','dependencies','length','nxCloudDistributedTasksRunner','copyFilesFromCache','getRunGroup','submitRunMetrics','axiosException','defineProperty','error:\x20','../../../utilities/environment','runUrl','message','error','find','COMPLETED','E2EEncryption','splitTasksIntoStages','hash','push','../../../utilities/create-unchanged-value-timeout'];(function(_0x4fcfd7,_0x41b4a9){const _0x449583=function(_0x34fdee){while(--_0x34fdee){_0x4fcfd7['push'](_0x4fcfd7['shift']());}};_0x449583(++_0x41b4a9);}(a8_0x41b4,0x1b3));const a8_0x4495=function(_0x4fcfd7,_0x41b4a9){_0x4fcfd7=_0x4fcfd7-0x0;let _0x449583=a8_0x41b4[_0x4fcfd7];return _0x449583;};'use strict';var __awaiter=this&&this[a8_0x4495('0x1')]||function(_0x2ca21f,_0x3fca69,_0x1680d1,_0x334354){function _0x2569e9(_0x4ea03f){return _0x4ea03f instanceof _0x1680d1?_0x4ea03f:new _0x1680d1(function(_0x5813f9){_0x5813f9(_0x4ea03f);});}return new(_0x1680d1||(_0x1680d1=Promise))(function(_0x379ec8,_0x3702d0){function _0xd9d814(_0x624449){try{_0x3c8884(_0x334354['next'](_0x624449));}catch(_0x4ec7b1){_0x3702d0(_0x4ec7b1);}}function _0x10dbb9(_0x1cce7a){try{_0x3c8884(_0x334354[a8_0x4495('0x3f')](_0x1cce7a));}catch(_0x598e0a){_0x3702d0(_0x598e0a);}}function _0x3c8884(_0xcc228a){_0xcc228a['done']?_0x379ec8(_0xcc228a[a8_0x4495('0x6')]):_0x2569e9(_0xcc228a[a8_0x4495('0x6')])['then'](_0xd9d814,_0x10dbb9);}_0x3c8884((_0x334354=_0x334354['apply'](_0x2ca21f,_0x3fca69||[]))['next']());});};Object[a8_0x4495('0x11')](exports,'__esModule',{'value':!![]});exports[a8_0x4495('0xc')]=void 0x0;const fs_1=require('fs');const stripJsonComments=require(a8_0x4495('0x40'));const create_unchanged_value_timeout_1=require(a8_0x4495('0x1d'));const environment_1=require(a8_0x4495('0x13'));const metric_logger_1=require('../../../utilities/metric-logger');const serializer_overrides_1=require('../../../utilities/serializer-overrides');const waiter_1=require('../../../utilities/waiter');const error_reporter_api_1=require(a8_0x4495('0x58'));const print_run_group_error_1=require('../../error/print-run-group-error');const e2e_encryption_1=require('../../file-storage/e2e-encryption');const file_storage_1=require('../../file-storage/file-storage');const distributed_execution_api_1=require(a8_0x4495('0x2'));const split_task_graph_into_stages_1=require(a8_0x4495('0x2b'));const task_graph_creator_1=require(a8_0x4495('0x24'));const {output,workspaceRoot,getOutputs,Cache}=require(a8_0x4495('0x2e'));class NoopLifeCycle{['scheduleTask'](_0x586375){}[a8_0x4495('0x7')](_0x4dc34d){}[a8_0x4495('0x4a')](_0x17429e,_0x277874){}}function runDistributedExecution(_0x9cf60b,_0x59ca16,_0x4086d2,_0x36010e,_0x133d6a,_0x4abfd5,_0xa38920){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x2d5a9e=yield _0x9cf60b[a8_0x4495('0x22')]((0x0,distributed_execution_api_1[a8_0x4495('0x8')])(_0x4abfd5,(0x0,split_task_graph_into_stages_1[a8_0x4495('0x1a')])(_0xa38920),_0x59ca16));return yield processTasks(_0x9cf60b,_0x36010e,_0x133d6a,_0x59ca16,_0x2d5a9e,Object[a8_0x4495('0x37')](_0xa38920[a8_0x4495('0x50')]),_0x4086d2);});}function processTasks(_0x2ab75f,_0x1649c9,_0x197115,_0x45e740,_0x2148cb,_0x2a0e9c,_0x2a89b3){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x10c965={};const _0x33b79c=(0x0,create_unchanged_value_timeout_1[a8_0x4495('0x2d')])({'title':a8_0x4495('0x2c')+environment_1[a8_0x4495('0x5b')]/0x3e8+'\x20seconds.','timeout':environment_1[a8_0x4495('0x5b')]});const _0x797f96=new waiter_1[(a8_0x4495('0x43'))]();while(!![]){if(environment_1['VERBOSE_LOGGING']){output[a8_0x4495('0x57')]({'title':a8_0x4495('0x41')});}yield _0x797f96[a8_0x4495('0x3')]();const _0x2eefe9=yield _0x2ab75f[a8_0x4495('0x32')](_0x2148cb);if(environment_1['VERBOSE_LOGGING']){output[a8_0x4495('0x57')]({'title':a8_0x4495('0x36'),'bodyLines':[a8_0x4495('0x3e')+_0x2148cb,'executionStatus:\x20'+_0x2eefe9['executionStatus'],'number\x20of\x20completed\x20tasks:\x20'+_0x2eefe9[a8_0x4495('0x20')][a8_0x4495('0xb')],a8_0x4495('0x12')+_0x2eefe9[a8_0x4495('0x5c')]]});}if(_0x2eefe9[a8_0x4495('0x5c')]){output[a8_0x4495('0x16')]({'title':'Distributed\x20Execution\x20Terminated','bodyLines':['Error:',_0x2eefe9['criticalErrorMessage']]});process[a8_0x4495('0x27')](0x1);}_0x33b79c(_0x2eefe9['completedTasks']['length']);for(const _0x250e97 of _0x2eefe9[a8_0x4495('0x20')]){if(_0x10c965[_0x250e97[a8_0x4495('0x54')]])continue;yield processTask(_0x1649c9,_0x197115,_0x2a89b3,_0x45e740,_0x2a0e9c,_0x250e97);_0x797f96[a8_0x4495('0x4f')]();_0x10c965[_0x250e97['taskId']]=!![];}if(_0x2eefe9['executionStatus']===a8_0x4495('0x18')){return{'commandStatus':_0x2eefe9[a8_0x4495('0x48')],'runUrl':_0x2eefe9['runUrl']};}}});}function processTask(_0x35ed4f,_0x48b503,_0xc208ec,_0x483b8a,_0x458335,_0x3a2540){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a8_0x4495('0x57')]({'title':a8_0x4495('0x51')+_0x3a2540[a8_0x4495('0x54')]});}const _0x155b9e=_0x458335[a8_0x4495('0x17')](_0x287f60=>_0x3a2540[a8_0x4495('0x54')]===_0x287f60['id']);if(!_0x155b9e){throw new Error('Found\x20unknown\x20task:\x20'+_0x3a2540['taskId']);}if(environment_1['VERBOSE_LOGGING']){output[a8_0x4495('0x57')]({'title':a8_0x4495('0x34')+_0x3a2540['url']});}yield _0x35ed4f[a8_0x4495('0x21')](_0x3a2540[a8_0x4495('0x1b')],_0x3a2540['url'],(0x0,environment_1[a8_0x4495('0x23')])(_0x483b8a));const _0x498ab=yield _0x48b503[a8_0x4495('0x47')](Object[a8_0x4495('0x28')](Object[a8_0x4495('0x28')]({},_0x155b9e),{'hash':_0x3a2540['hash']}));const _0x2eee38=getOutputs(_0xc208ec[a8_0x4495('0x35')][a8_0x4495('0x9')],_0x155b9e);if(environment_1['VERBOSE_LOGGING']){output[a8_0x4495('0x57')]({'title':'Extracting\x20artifacts','bodyLines':_0x2eee38});}yield _0x48b503[a8_0x4495('0xd')](_0x3a2540[a8_0x4495('0x1b')],_0x498ab,_0x2eee38);output[a8_0x4495('0x3c')](getCommand(_0x155b9e));process[a8_0x4495('0x26')][a8_0x4495('0x4e')](_0x498ab['terminalOutput']);output[a8_0x4495('0x0')]();});}function getCommand(_0x282b4d){const _0x417765=_0x282b4d[a8_0x4495('0x29')][a8_0x4495('0x30')]?':'+_0x282b4d[a8_0x4495('0x29')][a8_0x4495('0x30')]:'';return['nx','run',_0x282b4d[a8_0x4495('0x29')][a8_0x4495('0x33')]+':'+_0x282b4d[a8_0x4495('0x29')][a8_0x4495('0x29')]+_0x417765,(0x0,serializer_overrides_1[a8_0x4495('0x5a')])(_0x282b4d)][a8_0x4495('0x52')]('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x1cef8f,_0x140bcd){process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x1cef8f[a8_0x4495('0x49')](_0x140bcd,a8_0x4495('0x4d'));process[a8_0x4495('0x27')](0x1);}));process['on']('SIGTERM',()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x1cef8f[a8_0x4495('0x49')](_0x140bcd,a8_0x4495('0x38'));process[a8_0x4495('0x27')](0x1);}));}const nxCloudDistributedTasksRunner=(_0x50cafd,_0x78ca43,_0x429e11)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1[a8_0x4495('0x3d')]){output['note']({'title':a8_0x4495('0x5')});}_0x78ca43[a8_0x4495('0x39')]=new NoopLifeCycle();const _0x55deea=(0x0,environment_1[a8_0x4495('0xe')])();if(!_0x55deea){(0x0,print_run_group_error_1[a8_0x4495('0x4')])();return process['exit'](0x1);}const _0x2d7f85=new e2e_encryption_1[(a8_0x4495('0x19'))](environment_1[a8_0x4495('0x3a')]||_0x78ca43[a8_0x4495('0x59')]);const _0x291deb=new error_reporter_api_1[(a8_0x4495('0x31'))](_0x78ca43);const _0x197f93=new file_storage_1[(a8_0x4495('0x53'))](_0x2d7f85,_0x291deb,!![],![]);const _0x13abfc=new Cache(_0x78ca43);const _0x190c46=new distributed_execution_api_1[(a8_0x4495('0x55'))](_0x78ca43);attachSignalListenersToCompleteRunGroupOnError(_0x190c46,_0x55deea);try{const _0x41e5ba=getTaskGraph(_0x429e11,_0x50cafd,_0x78ca43);const _0x157f72=yield runDistributedExecution(_0x190c46,_0x78ca43,_0x429e11,_0x197f93,_0x13abfc,_0x55deea,_0x41e5ba);if(_0x157f72[a8_0x4495('0x48')]===0x0){output[a8_0x4495('0x56')]({'title':a8_0x4495('0x1e'),'bodyLines':[a8_0x4495('0x4b')+_0x157f72[a8_0x4495('0x14')]]});}else{output[a8_0x4495('0x16')]({'title':a8_0x4495('0x1f'),'bodyLines':[a8_0x4495('0x4b')+_0x157f72[a8_0x4495('0x14')]]});}yield(0x0,metric_logger_1[a8_0x4495('0xf')])(_0x78ca43);process['exit'](_0x157f72[a8_0x4495('0x48')]);}catch(_0xeb031e){output[a8_0x4495('0x16')]({'title':a8_0x4495('0x46'),'bodyLines':[_0xeb031e[a8_0x4495('0x15')]]});if(_0xeb031e[a8_0x4495('0x10')]){console['log'](_0xeb031e[a8_0x4495('0x10')]);}else{console[a8_0x4495('0x42')](_0xeb031e);}try{yield _0x190c46[a8_0x4495('0x49')](_0x55deea,a8_0x4495('0x3b')+_0xeb031e['message']+'\x22');}finally{process[a8_0x4495('0x27')](0x1);}}});exports[a8_0x4495('0xc')]=nxCloudDistributedTasksRunner;function getTaskGraph(_0x230759,_0x358a10,_0x5e2189){if(_0x230759[a8_0x4495('0x25')]){return _0x230759[a8_0x4495('0x25')];}else{const _0x4532fe=JSON['parse'](stripJsonComments((0x0,fs_1[a8_0x4495('0x45')])(workspaceRoot+a8_0x4495('0x2f'))[a8_0x4495('0x2a')]()));return new task_graph_creator_1[(a8_0x4495('0x4c'))](_0x230759[a8_0x4495('0x35')],getDefaultDependencyConfigs(_0x4532fe,_0x5e2189))[a8_0x4495('0x44')](_0x358a10);}}function getDefaultDependencyConfigs(_0x2c8a21,_0x5d76ee){var _0x512581,_0xf2d6fc;const _0x4c76d4=(_0x512581=_0x2c8a21['targetDependencies'])!==null&&_0x512581!==void 0x0?_0x512581:{};const _0x574249=_0x5d76ee?(_0xf2d6fc=_0x5d76ee['strictlyOrderedTargets'])!==null&&_0xf2d6fc!==void 0x0?_0xf2d6fc:['build']:[];for(const _0x161325 of _0x574249){_0x4c76d4[_0x161325]=_0x4c76d4[_0x161325]||[];_0x4c76d4[_0x161325][a8_0x4495('0x1c')]({'target':_0x161325,'projects':a8_0x4495('0xa')});}return _0x4c76d4;}
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 +1 @@
1
- {"version":3,"file":"distributed-execution.runner.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/lib/core/runners/distributed-execution/distributed-execution.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAkC;AAClC,yDAAyD;AACzD,sGAAgG;AAChG,gEAMwC;AACxC,oEAAoE;AACpE,kFAA6E;AAC7E,sDAAmD;AACnD,qEAAgE;AAChE,6EAAuE;AACvE,sEAAkE;AAClE,kEAA8D;AAG9D,2EAGqC;AACrC,iFAAsE;AACtE,6DAAwD;AAExD,MAAM,EACJ,MAAM,EACN,aAAa,EACb,UAAU,EACV,KAAK,GACN,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAY7C,MAAM,aAAa;IACjB,YAAY,CAAC,IAAU,IAAS,CAAC;IAEjC,SAAS,CAAC,IAAU,IAAS,CAAC;IAE9B,OAAO,CAAC,IAAU,EAAE,IAAY,IAAS,CAAC;CAC3C;AAED,SAAe,uBAAuB,CACpC,GAA4B,EAC5B,OAA+B,EAC/B,OAAY,EACZ,WAAwB,EACxB,KAAY,EACZ,QAAgB,EAChB,SAAoB;;QAEpB,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,CACxB,IAAA,8CAAkB,EAAC,QAAQ,EAAE,IAAA,mDAAoB,EAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CACvE,CAAC;QACF,OAAO,MAAM,YAAY,CACvB,GAAG,EACH,WAAW,EACX,KAAK,EACL,OAAO,EACP,EAAE,EACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAC9B,OAAO,CACR,CAAC;IACJ,CAAC;CAAA;AAED,SAAe,YAAY,CACzB,GAA4B,EAC5B,WAAwB,EACxB,KAAY,EACZ,OAA+B,EAC/B,WAAmB,EACnB,KAAa,EACb,OAAY;;QAEZ,MAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,MAAM,qDAAqD,GACzD,IAAA,4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,CAAC;AAED,SAAS,2BAA2B,CAClC,MAAW,EACX,aAEC;;IAED,MAAM,QAAQ,GAA0B,MAAA,MAAM,CAAC,kBAAkB,mCAAI,EAAE,CAAC;IACxE,MAAM,sBAAsB,GAAG,aAAa;QAC1C,CAAC,CAAC,MAAA,aAAa,CAAC,sBAAsB,mCAAI,CAAC,OAAO,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC;IACP,wDAAwD;IACxD,KAAK,MAAM,MAAM,IAAI,sBAAsB,EAAE;QAC3C,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC1C,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YACpB,MAAM;YACN,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"distributed-execution.runner.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/lib/core/runners/distributed-execution/distributed-execution.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAA8C;AAC9C,yDAAyD;AACzD,sGAAgG;AAChG,gEAMwC;AACxC,oEAAoE;AACpE,kFAA6E;AAC7E,sDAAmD;AACnD,qEAAgE;AAChE,6EAAuE;AACvE,sEAAkE;AAClE,kEAA8D;AAG9D,2EAGqC;AACrC,iFAAsE;AACtE,6DAAwD;AAExD,MAAM,EACJ,MAAM,EACN,aAAa,EACb,UAAU,EACV,KAAK,GACN,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAY7C,MAAM,aAAa;IACjB,YAAY,CAAC,IAAU,IAAS,CAAC;IAEjC,SAAS,CAAC,IAAU,IAAS,CAAC;IAE9B,QAAQ,CAAC,KAAmB,IAAS,CAAC;CACvC;AAED,SAAe,uBAAuB,CACpC,GAA4B,EAC5B,OAA+B,EAC/B,OAAY,EACZ,WAAwB,EACxB,KAAY,EACZ,QAAgB,EAChB,SA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AAC,CAAC,MAAA,aAAa,CAAC,sBAAsB,mCAAI,CAAC,OAAO,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC;IACP,wDAAwD;IACxD,KAAK,MAAM,MAAM,IAAI,sBAAsB,EAAE;QAC3C,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC1C,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YACpB,MAAM;YACN,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1 +1,37 @@
1
- const a9_0x1db5=['map','values','defineProperty','size','splitTasksIntoStages','push','__esModule','delete','tasks'];(function(_0x23153a,_0x1db5c8){const _0x45b6b1=function(_0xb630a2){while(--_0xb630a2){_0x23153a['push'](_0x23153a['shift']());}};_0x45b6b1(++_0x1db5c8);}(a9_0x1db5,0xf7));const a9_0x45b6=function(_0x23153a,_0x1db5c8){_0x23153a=_0x23153a-0x0;let _0x45b6b1=a9_0x1db5[_0x23153a];return _0x45b6b1;};'use strict';Object[a9_0x45b6('0x7')](exports,a9_0x45b6('0x2'),{'value':!![]});exports[a9_0x45b6('0x0')]=void 0x0;function splitTasksIntoStages(_0x2bdcf6){const _0x3e7040=[];const _0x2fc7cf=new Set(Object[a9_0x45b6('0x6')](_0x2bdcf6[a9_0x45b6('0x4')])[a9_0x45b6('0x5')](_0x160df9=>_0x160df9['id']));let _0x43ca68=0x0;while(_0x2fc7cf[a9_0x45b6('0x8')]>0x0){const _0x16db1c=_0x3e7040[_0x43ca68]=[];for(const _0x45409d of _0x2fc7cf){let _0x4c30bd=!![];for(const _0xfcaffb of _0x2bdcf6['dependencies'][_0x45409d]){if(_0x2fc7cf['has'](_0xfcaffb)){_0x4c30bd=![];break;}}if(!_0x4c30bd){continue;}const _0x4d5b85=_0x2bdcf6[a9_0x45b6('0x4')][_0x45409d];_0x16db1c[a9_0x45b6('0x1')](_0x4d5b85);}for(const _0x5874dd of _0x16db1c){_0x2fc7cf[a9_0x45b6('0x3')](_0x5874dd['id']);}_0x43ca68++;}return _0x3e7040;}exports[a9_0x45b6('0x0')]=splitTasksIntoStages;
1
+ "use strict";
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 +1,77 @@
1
- const a10_0x9c21=['self','push','addTaskToGraph','tasks','indexOf','keys','defaultTargetDependencies','dependencies','projects','findTask','target','../../../utilities/nx-imports','TaskGraphCreator','add','projectGraph','project','addTaskDependencies','createTaskGraph','find','roots','defineProperty','map','addDependencies','filter','has'];(function(_0x14f61f,_0x9c217){const _0x16ec08=function(_0x437299){while(--_0x437299){_0x14f61f['push'](_0x14f61f['shift']());}};_0x16ec08(++_0x9c217);}(a10_0x9c21,0xbc));const a10_0x16ec=function(_0x14f61f,_0x9c217){_0x14f61f=_0x14f61f-0x0;let _0x16ec08=a10_0x9c21[_0x14f61f];return _0x16ec08;};'use strict';Object[a10_0x16ec('0x7')](exports,'__esModule',{'value':!![]});exports[a10_0x16ec('0x18')]=void 0x0;const {getDependencyConfigs}=require(a10_0x16ec('0x17'));class TaskGraphCreator{constructor(_0x4028dc,_0x383875){this['projectGraph']=_0x4028dc;this['defaultTargetDependencies']=_0x383875;}[a10_0x16ec('0x4')](_0x3e6b94){const _0x50ba59={'roots':[],'tasks':{},'dependencies':{}};for(const _0x46e432 of _0x3e6b94){this[a10_0x16ec('0xe')](_0x46e432,_0x50ba59);const _0xd12746=getDependencyConfigs(_0x46e432['target'],this[a10_0x16ec('0x12')],this[a10_0x16ec('0x1')]);if(!_0xd12746){continue;}this['addTaskDependencies'](_0x46e432,_0xd12746,_0x3e6b94,_0x50ba59);}_0x50ba59[a10_0x16ec('0x6')]=Object[a10_0x16ec('0x11')](_0x50ba59[a10_0x16ec('0x13')])[a10_0x16ec('0xa')](_0x298e99=>_0x50ba59[a10_0x16ec('0x13')][_0x298e99]['length']===0x0);return _0x50ba59;}[a10_0x16ec('0x3')](_0x4f9673,_0x5e0f07,_0x539601,_0x4146b6){for(const _0x69ada2 of _0x5e0f07){if(_0x69ada2[a10_0x16ec('0x14')]===a10_0x16ec('0xc')){for(const _0x1dc25d of _0x539601){if(_0x1dc25d[a10_0x16ec('0x16')][a10_0x16ec('0x2')]===_0x4f9673[a10_0x16ec('0x16')][a10_0x16ec('0x2')]&&_0x1dc25d['target'][a10_0x16ec('0x16')]===_0x69ada2[a10_0x16ec('0x16')]){_0x4146b6[a10_0x16ec('0x13')][_0x4f9673['id']][a10_0x16ec('0xd')](_0x1dc25d['id']);}}}else if(_0x69ada2['projects']===a10_0x16ec('0x13')){const _0x2103cb=new Set();this[a10_0x16ec('0x9')](_0x4f9673[a10_0x16ec('0x16')]['project'],_0x69ada2['target'],_0x539601,_0x4146b6,_0x4f9673['id'],_0x2103cb);}}}['addDependencies'](_0x5570bc,_0x30ac8f,_0x2f5a30,_0x4f96c1,_0x4fc7f1,_0x2c5c1f){_0x2c5c1f[a10_0x16ec('0x0')](_0x5570bc);const _0x532b78=this[a10_0x16ec('0x1')]['dependencies'][_0x5570bc];if(_0x532b78){const _0x21cf0d=_0x532b78[a10_0x16ec('0x8')](_0x52b76d=>_0x52b76d['target']);for(const _0x17f281 of _0x21cf0d){if(_0x2c5c1f[a10_0x16ec('0xb')](_0x17f281)){continue;}const _0x4a36fc=this[a10_0x16ec('0x15')]({'project':_0x17f281,'target':_0x30ac8f},_0x2f5a30);if(_0x4a36fc){if(_0x4f96c1[a10_0x16ec('0x13')][_0x4fc7f1][a10_0x16ec('0x10')](_0x4a36fc['id'])===-0x1){_0x4f96c1[a10_0x16ec('0x13')][_0x4fc7f1][a10_0x16ec('0xd')](_0x4a36fc['id']);}}else{this[a10_0x16ec('0x9')](_0x17f281,_0x30ac8f,_0x2f5a30,_0x4f96c1,_0x4fc7f1,_0x2c5c1f);}}}}[a10_0x16ec('0x15')]({project,target},_0x92c93c){return _0x92c93c[a10_0x16ec('0x5')](_0xf4b8b=>_0xf4b8b[a10_0x16ec('0x16')]['project']===project&&_0xf4b8b[a10_0x16ec('0x16')]['target']===target);}[a10_0x16ec('0xe')](_0x4c99de,_0x353467){_0x353467[a10_0x16ec('0xf')][_0x4c99de['id']]=_0x4c99de;_0x353467[a10_0x16ec('0x13')][_0x4c99de['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;
1
+ "use strict";
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/nx-cloud",
3
- "version": "15.0.3",
3
+ "version": "15.0.4-beta.1",
4
4
  "description": "Nx Cloud plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",