@nrwl/nx-cloud 15.3.1-beta.1 → 15.3.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,152 +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 serializer_overrides_1 = require("../../../utilities/serializer-overrides");
17
- const { output } = require('../../../utilities/nx-imports');
18
- class DistributedExecutionApi {
19
- constructor(options) {
20
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
21
- }
22
- start(params) {
23
- var _a;
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const recorder = (0, metric_logger_1.createMetricRecorder)('dteStart');
26
- let resp;
27
- if (environment_1.VERBOSE_LOGGING) {
28
- output.note({
29
- title: 'Starting a distributed execution',
30
- bodyLines: [JSON.stringify(params, null, 2)],
31
- });
32
- }
33
- try {
34
- resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/start', params));
35
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
36
- }
37
- catch (e) {
38
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
39
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
40
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
41
- throw e;
42
- }
43
- if (!resp.data.enabled) {
44
- throw new Error(`Workspace is disabled. Cannot perform distributed task executions.`);
45
- }
46
- if (resp.data.error) {
47
- throw new Error(resp.data.error);
48
- }
49
- return resp.data.id;
50
- });
51
- }
52
- status(id) {
53
- var _a;
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const recorder = (0, metric_logger_1.createMetricRecorder)('dteStatus');
56
- try {
57
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/status', {
58
- id,
59
- }));
60
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
61
- return resp.data;
62
- }
63
- catch (e) {
64
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
65
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
66
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
67
- output.error({
68
- title: e.message,
69
- });
70
- process.exit(1);
71
- }
72
- });
73
- }
74
- completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, error) {
75
- var _a;
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
78
- if (environment_1.VERBOSE_LOGGING) {
79
- output.note({
80
- title: 'Completing with an error',
81
- bodyLines: [
82
- `ciExecutionId: ${ciExecutionId}`,
83
- `ciExecutionEnv: ${ciExecutionEnv}`,
84
- `runGroup: ${runGroup}`,
85
- `error: ${error}`,
86
- ],
87
- });
88
- }
89
- try {
90
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
91
- runGroup,
92
- ciExecutionId,
93
- ciExecutionEnv,
94
- criticalErrorMessage: error,
95
- }), 3);
96
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
97
- }
98
- catch (e) {
99
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
100
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
101
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
102
- }
103
- });
104
- }
105
- }
106
- exports.DistributedExecutionApi = DistributedExecutionApi;
107
- function createStartRequest(branch, runGroup, ciExecutionId, ciExecutionEnv, task, options) {
108
- const tasksToExecute = task.map((arr) => {
109
- return arr.map((t) => {
110
- return {
111
- taskId: t.id,
112
- hash: t.hash,
113
- projectName: t.target.project,
114
- target: t.target.target,
115
- configuration: t.target.configuration || null,
116
- params: (0, serializer_overrides_1.serializeOverrides)(t),
117
- };
118
- });
119
- });
120
- const request = {
121
- command: (0, environment_1.parseCommand)(),
122
- branch,
123
- runGroup,
124
- ciExecutionId,
125
- ciExecutionEnv,
126
- tasks: tasksToExecute,
127
- maxParallel: calculateMaxParallel(options),
128
- };
129
- if (environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT) {
130
- request.agentCount = environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT;
131
- }
132
- if (!environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE) {
133
- request.stopAgentsOnFailure = false;
134
- }
135
- return request;
136
- }
137
- exports.createStartRequest = createStartRequest;
138
- function calculateMaxParallel(options) {
139
- if (options.parallel === 'false' || options.parallel === false) {
140
- return 1;
141
- }
142
- else if (options.parallel === 'true' || options.parallel === true) {
143
- return Number(options.maxParallel || 3);
144
- }
145
- else if (options.parallel === undefined) {
146
- return options.maxParallel ? Number(options.maxParallel) : 3;
147
- }
148
- else {
149
- return Number(options.parallel) || 3;
150
- }
151
- }
152
- //# sourceMappingURL=distributed-execution.api.js.map
1
+ const a10_0x1458=['__esModule','Completing\x20with\x20an\x20error','target','response','../../../utilities/metric-logger','axiosException','axiosMultipleTries','/nx-cloud/executions/start','error:\x20','mapRespToPerfEntry','Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.','false','stopAgentsOnFailure','message','Starting\x20a\x20distributed\x20execution','defineProperty','createStartRequest','recordMetric','agentCount','ciExecutionId:\x20','runGroup:\x20','start','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','project','value','true','DistributedExecutionApi','../../../utilities/axios','dteStatus','ciExecutionEnv:\x20','note','status','completeRunGroupWithError','maxParallel','stringify','parallel','../../../utilities/nx-imports','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','apiAxiosInstance','apply','createMetricRecorder','configuration','enabled','map','completeRunGroup','data','done','createApiAxiosInstance','/nx-cloud/executions/status','post','error','exit','RUNNER_FAILURE_PERF_ENTRY','hash','VERBOSE_LOGGING','serializeOverrides'];(function(_0x549a69,_0x145842){const _0x190abb=function(_0x4d369d){while(--_0x4d369d){_0x549a69['push'](_0x549a69['shift']());}};_0x190abb(++_0x145842);}(a10_0x1458,0x1c7));const a10_0x190a=function(_0x549a69,_0x145842){_0x549a69=_0x549a69-0x0;let _0x190abb=a10_0x1458[_0x549a69];return _0x190abb;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x344caa,_0x17f272,_0x19459b,_0xce14ca){function _0x1b89c2(_0x2a5fbd){return _0x2a5fbd instanceof _0x19459b?_0x2a5fbd:new _0x19459b(function(_0x4b4083){_0x4b4083(_0x2a5fbd);});}return new(_0x19459b||(_0x19459b=Promise))(function(_0x5b24ea,_0x4fce03){function _0x69692b(_0x392f31){try{_0x145a8e(_0xce14ca['next'](_0x392f31));}catch(_0x58cbd2){_0x4fce03(_0x58cbd2);}}function _0x5a2eed(_0x37a8cf){try{_0x145a8e(_0xce14ca['throw'](_0x37a8cf));}catch(_0x381b03){_0x4fce03(_0x381b03);}}function _0x145a8e(_0x241d50){_0x241d50[a10_0x190a('0x27')]?_0x5b24ea(_0x241d50[a10_0x190a('0x11')]):_0x1b89c2(_0x241d50[a10_0x190a('0x11')])['then'](_0x69692b,_0x5a2eed);}_0x145a8e((_0xce14ca=_0xce14ca[a10_0x190a('0x20')](_0x344caa,_0x17f272||[]))['next']());});};Object[a10_0x190a('0x8')](exports,a10_0x190a('0x31'),{'value':!![]});exports[a10_0x190a('0x9')]=exports['DistributedExecutionApi']=void 0x0;const axios_1=require(a10_0x190a('0x14'));const environment_1=require('../../../utilities/environment');const metric_logger_1=require(a10_0x190a('0x35'));const serializer_overrides_1=require('../../../utilities/serializer-overrides');const {output}=require(a10_0x190a('0x1d'));class DistributedExecutionApi{constructor(_0x537713){this['apiAxiosInstance']=(0x0,axios_1[a10_0x190a('0x28')])(_0x537713);}[a10_0x190a('0xe')](_0x354b14){var _0x4d6142;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x126bda=(0x0,metric_logger_1[a10_0x190a('0x21')])('dteStart');let _0x443c11;if(environment_1[a10_0x190a('0x2f')]){output[a10_0x190a('0x17')]({'title':a10_0x190a('0x7'),'bodyLines':[JSON[a10_0x190a('0x1b')](_0x354b14,null,0x2)]});}try{_0x443c11=yield(0x0,axios_1[a10_0x190a('0x37')])(()=>this[a10_0x190a('0x1f')]['post'](a10_0x190a('0x0'),_0x354b14));_0x126bda[a10_0x190a('0xa')]((0x0,metric_logger_1[a10_0x190a('0x2')])(_0x443c11));}catch(_0x57c83f){_0x126bda[a10_0x190a('0xa')](((_0x4d6142=_0x57c83f===null||_0x57c83f===void 0x0?void 0x0:_0x57c83f[a10_0x190a('0x36')])===null||_0x4d6142===void 0x0?void 0x0:_0x4d6142[a10_0x190a('0x34')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x57c83f[a10_0x190a('0x36')][a10_0x190a('0x34')]):metric_logger_1[a10_0x190a('0x2d')]);throw _0x57c83f;}if(!_0x443c11[a10_0x190a('0x26')][a10_0x190a('0x23')]){throw new Error(a10_0x190a('0x3'));}if(_0x443c11[a10_0x190a('0x26')][a10_0x190a('0x2b')]){throw new Error(_0x443c11[a10_0x190a('0x26')][a10_0x190a('0x2b')]);}return _0x443c11[a10_0x190a('0x26')]['id'];});}[a10_0x190a('0x18')](_0x1a97f7){var _0x2a76ef;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x41f8af=(0x0,metric_logger_1[a10_0x190a('0x21')])(a10_0x190a('0x15'));try{const _0x26e398=yield(0x0,axios_1['axiosMultipleTries'])(()=>this['apiAxiosInstance'][a10_0x190a('0x2a')](a10_0x190a('0x29'),{'id':_0x1a97f7}));_0x41f8af[a10_0x190a('0xa')]((0x0,metric_logger_1[a10_0x190a('0x2')])(_0x26e398));return _0x26e398[a10_0x190a('0x26')];}catch(_0x1323b8){_0x41f8af[a10_0x190a('0xa')](((_0x2a76ef=_0x1323b8===null||_0x1323b8===void 0x0?void 0x0:_0x1323b8['axiosException'])===null||_0x2a76ef===void 0x0?void 0x0:_0x2a76ef['response'])?(0x0,metric_logger_1[a10_0x190a('0x2')])(_0x1323b8['axiosException']['response']):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output[a10_0x190a('0x2b')]({'title':_0x1323b8[a10_0x190a('0x6')]});process[a10_0x190a('0x2c')](0x1);}});}[a10_0x190a('0x19')](_0x5b5eec,_0x3f2ca5,_0x8a78b3,_0x290300,_0x43d941){var _0x53740d;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1e304a=(0x0,metric_logger_1[a10_0x190a('0x21')])(a10_0x190a('0x25'));if(environment_1['VERBOSE_LOGGING']){output[a10_0x190a('0x17')]({'title':a10_0x190a('0x32'),'bodyLines':[a10_0x190a('0xc')+_0x8a78b3,a10_0x190a('0x16')+_0x290300,a10_0x190a('0xd')+_0x3f2ca5,a10_0x190a('0x1')+_0x43d941]});}try{const _0x168234=yield(0x0,axios_1[a10_0x190a('0x37')])(()=>this[a10_0x190a('0x1f')][a10_0x190a('0x2a')]('/nx-cloud/executions/complete-run-group',{'runGroup':_0x3f2ca5,'ciExecutionId':_0x8a78b3,'ciExecutionEnv':_0x290300,'criticalErrorMessage':_0x43d941}),0x3);_0x1e304a[a10_0x190a('0xa')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x168234));}catch(_0x506f0){_0x1e304a[a10_0x190a('0xa')](((_0x53740d=_0x506f0===null||_0x506f0===void 0x0?void 0x0:_0x506f0['axiosException'])===null||_0x53740d===void 0x0?void 0x0:_0x53740d[a10_0x190a('0x34')])?(0x0,metric_logger_1[a10_0x190a('0x2')])(_0x506f0[a10_0x190a('0x36')][a10_0x190a('0x34')]):metric_logger_1[a10_0x190a('0x2d')]);}});}}exports[a10_0x190a('0x13')]=DistributedExecutionApi;function createStartRequest(_0x41087c,_0x5c549e,_0x467ef8,_0x5ad565,_0x2b5745,_0x5d802b){const _0x2c34b4=_0x2b5745[a10_0x190a('0x24')](_0x5df308=>{return _0x5df308['map'](_0x3fcd49=>{return{'taskId':_0x3fcd49['id'],'hash':_0x3fcd49[a10_0x190a('0x2e')],'projectName':_0x3fcd49[a10_0x190a('0x33')][a10_0x190a('0x10')],'target':_0x3fcd49['target']['target'],'configuration':_0x3fcd49[a10_0x190a('0x33')][a10_0x190a('0x22')]||null,'params':(0x0,serializer_overrides_1[a10_0x190a('0x30')])(_0x3fcd49)};});});const _0x3d830b={'command':(0x0,environment_1['parseCommand'])(),'branch':_0x41087c,'runGroup':_0x5c549e,'ciExecutionId':_0x467ef8,'ciExecutionEnv':_0x5ad565,'tasks':_0x2c34b4,'maxParallel':calculateMaxParallel(_0x5d802b)};if(environment_1[a10_0x190a('0xf')]){_0x3d830b[a10_0x190a('0xb')]=environment_1[a10_0x190a('0xf')];}if(!environment_1[a10_0x190a('0x1e')]){_0x3d830b[a10_0x190a('0x5')]=![];}return _0x3d830b;}exports['createStartRequest']=createStartRequest;function calculateMaxParallel(_0x1c7679){if(_0x1c7679[a10_0x190a('0x1c')]===a10_0x190a('0x4')||_0x1c7679[a10_0x190a('0x1c')]===![]){return 0x1;}else if(_0x1c7679['parallel']===a10_0x190a('0x12')||_0x1c7679['parallel']===!![]){return Number(_0x1c7679[a10_0x190a('0x1a')]||0x3);}else if(_0x1c7679[a10_0x190a('0x1c')]===undefined){return _0x1c7679[a10_0x190a('0x1a')]?Number(_0x1c7679[a10_0x190a('0x1a')]):0x3;}else{return Number(_0x1c7679[a10_0x190a('0x1c')])||0x3;}}
@@ -1,118 +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 environment_1 = require("../../../utilities/environment");
14
- const metric_logger_1 = require("../../../utilities/metric-logger");
15
- const error_reporter_api_1 = require("../../api/error-reporter.api");
16
- const print_run_group_error_1 = require("../../error/print-run-group-error");
17
- const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
18
- const file_storage_1 = require("../../file-storage/file-storage");
19
- const distributed_execution_api_1 = require("./distributed-execution.api");
20
- const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
21
- const task_graph_creator_1 = require("./task-graph-creator");
22
- const process_tasks_1 = require("./process-tasks");
23
- const dte_artifact_storage_1 = require("../../../utilities/dte-artifact-storage");
24
- const { output } = require('../../../utilities/nx-imports');
25
- class NoopLifeCycle {
26
- scheduleTask(task) { }
27
- startTask(task) { }
28
- endTasks(tasks) { }
29
- }
30
- const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
31
- if (options.skipNxCache) {
32
- output.warn({
33
- title: `--skip-nx-cache is ignored when using distributed tasks execution (DTE).`,
34
- bodyLine: [`DTE needs the cache to share files between agents.`],
35
- });
36
- }
37
- if (environment_1.VERBOSE_LOGGING) {
38
- output.note({
39
- title: 'Starting distributed command execution',
40
- });
41
- }
42
- options.lifeCycle = new NoopLifeCycle();
43
- const branch = (0, environment_1.getBranch)();
44
- const runGroup = (0, environment_1.getRunGroup)();
45
- const ciExecutionId = (0, environment_1.getCIExecutionId)();
46
- const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
47
- if (!(0, print_run_group_error_1.canDetectRunGroup)(runGroup, ciExecutionId)) {
48
- (0, print_run_group_error_1.printRunGroupError)();
49
- process.exit(1);
50
- }
51
- const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
52
- const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
53
- const dteArtifactStorage = new dte_artifact_storage_1.DteArtifactStorage(new file_storage_1.FileStorage(encryption, errorReporter, options, 'dte-main'), (0, environment_1.getNxCacheDirectory)(options));
54
- const api = new distributed_execution_api_1.DistributedExecutionApi(options);
55
- attachSignalListenersToCompleteRunGroupOnError(api, branch, runGroup, ciExecutionId, ciExecutionEnv);
56
- try {
57
- const taskGraph = getTaskGraph(context, tasks, options);
58
- const r = yield runDistributedExecution(api, options, dteArtifactStorage, branch, runGroup, ciExecutionId, ciExecutionEnv, taskGraph);
59
- if (r.commandStatus === 0) {
60
- output.success({
61
- title: 'Successfully completed running the command.',
62
- bodyLines: [`See run details at ${r.runUrl}`],
63
- });
64
- }
65
- else {
66
- output.error({
67
- title: 'Command execution failed.',
68
- bodyLines: [`See run details at ${r.runUrl}`],
69
- });
70
- }
71
- yield (0, metric_logger_1.submitRunMetrics)(options);
72
- process.exit(r.commandStatus);
73
- }
74
- catch (e) {
75
- output.error({
76
- title: 'Unable to complete a run.',
77
- bodyLines: [e.message],
78
- });
79
- if (e.axiosException) {
80
- console.log(e.axiosException);
81
- }
82
- else {
83
- console.log(e);
84
- }
85
- try {
86
- yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, `Main job terminated with an error: "${e.message}"`);
87
- }
88
- finally {
89
- process.exit(1);
90
- }
91
- }
92
- });
93
- exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
94
- function getTaskGraph(context, tasks, options) {
95
- if (context.taskGraph) {
96
- return context.taskGraph;
97
- }
98
- else {
99
- return (0, task_graph_creator_1.createTaskGraphCompat)(options, context.projectGraph, tasks);
100
- }
101
- }
102
- function attachSignalListenersToCompleteRunGroupOnError(api, branch, runGroup, ciExecutionId, ciExecutionEnv) {
103
- process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
104
- yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, 'Main job was terminated via SIGINT');
105
- process.exit(1);
106
- }));
107
- process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
108
- yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, 'Main job was terminated via SIGTERM');
109
- process.exit(1);
110
- }));
111
- }
112
- function runDistributedExecution(api, options, dteArtifactStorage, branch, runGroup, ciExecutionId, ciExecutionEnv, taskGraph) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(branch, runGroup, ciExecutionId, ciExecutionEnv, (0, split_task_graph_into_stages_1.splitTasksIntoStages)(taskGraph), options));
115
- return yield (0, process_tasks_1.processTasks)(api, dteArtifactStorage, id, Object.values(taskGraph.tasks));
116
- });
117
- }
118
- //# sourceMappingURL=distributed-execution.runner.js.map
1
+ const a11_0x5408=['../../../utilities/environment','getBranch','projectGraph','defineProperty','./split-task-graph-into-stages','warn','apply','Unable\x20to\x20complete\x20a\x20run.','value','processTasks','exit','../../../utilities/dte-artifact-storage','done','See\x20run\x20details\x20at\x20','taskGraph','ErrorReporterApi','DteArtifactStorage','Successfully\x20completed\x20running\x20the\x20command.','DistributedExecutionApi','__awaiter','scheduleTask','SIGTERM','tasks','start','canDetectRunGroup','next','skipNxCache','../../file-storage/file-storage','SIGINT','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','./process-tasks','runUrl','createStartRequest','Command\x20execution\x20failed.','ENCRYPTION_KEY','message','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','axiosException','../../error/print-run-group-error','getRunGroup','completeRunGroupWithError','E2EEncryption','nxCloudDistributedTasksRunner','splitTasksIntoStages','dte-main','commandStatus','lifeCycle','../../api/error-reporter.api','error','VERBOSE_LOGGING','encryptionKey','getNxCacheDirectory','note','then','../../../utilities/nx-imports','__esModule','getCIExecutionId','submitRunMetrics','log','success'];(function(_0x5f413b,_0x540898){const _0x51352f=function(_0x1977cc){while(--_0x1977cc){_0x5f413b['push'](_0x5f413b['shift']());}};_0x51352f(++_0x540898);}(a11_0x5408,0x1f4));const a11_0x5135=function(_0x5f413b,_0x540898){_0x5f413b=_0x5f413b-0x0;let _0x51352f=a11_0x5408[_0x5f413b];return _0x51352f;};'use strict';var __awaiter=this&&this[a11_0x5135('0x3b')]||function(_0x2f29c9,_0x536d3d,_0x3f5741,_0x16c305){function _0x33e4b8(_0x267b36){return _0x267b36 instanceof _0x3f5741?_0x267b36:new _0x3f5741(function(_0x63fdff){_0x63fdff(_0x267b36);});}return new(_0x3f5741||(_0x3f5741=Promise))(function(_0x269357,_0x4fb27b){function _0x50b832(_0x4edc23){try{_0x5775b6(_0x16c305['next'](_0x4edc23));}catch(_0x5a1d3a){_0x4fb27b(_0x5a1d3a);}}function _0x1ca838(_0x1cb1a2){try{_0x5775b6(_0x16c305['throw'](_0x1cb1a2));}catch(_0x9ab40b){_0x4fb27b(_0x9ab40b);}}function _0x5775b6(_0x707f82){_0x707f82[a11_0x5135('0x34')]?_0x269357(_0x707f82['value']):_0x33e4b8(_0x707f82[a11_0x5135('0x30')])[a11_0x5135('0x21')](_0x50b832,_0x1ca838);}_0x5775b6((_0x16c305=_0x16c305[a11_0x5135('0x2e')](_0x2f29c9,_0x536d3d||[]))[a11_0x5135('0x5')]());});};Object[a11_0x5135('0x2b')](exports,a11_0x5135('0x23'),{'value':!![]});exports['nxCloudDistributedTasksRunner']=void 0x0;const environment_1=require(a11_0x5135('0x28'));const metric_logger_1=require('../../../utilities/metric-logger');const error_reporter_api_1=require(a11_0x5135('0x1b'));const print_run_group_error_1=require(a11_0x5135('0x12'));const e2e_encryption_1=require('../../file-storage/e2e-encryption');const file_storage_1=require(a11_0x5135('0x7'));const distributed_execution_api_1=require('./distributed-execution.api');const split_task_graph_into_stages_1=require(a11_0x5135('0x2c'));const task_graph_creator_1=require('./task-graph-creator');const process_tasks_1=require(a11_0x5135('0xa'));const dte_artifact_storage_1=require(a11_0x5135('0x33'));const {output}=require(a11_0x5135('0x22'));class NoopLifeCycle{[a11_0x5135('0x0')](_0x4306d6){}['startTask'](_0x31693a){}['endTasks'](_0x48765c){}}const nxCloudDistributedTasksRunner=(_0x51d3c2,_0x34ff69,_0x1aaa2b)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0x34ff69[a11_0x5135('0x6')]){output[a11_0x5135('0x2d')]({'title':'--skip-nx-cache\x20is\x20ignored\x20when\x20using\x20distributed\x20tasks\x20execution\x20(DTE).','bodyLine':['DTE\x20needs\x20the\x20cache\x20to\x20share\x20files\x20between\x20agents.']});}if(environment_1[a11_0x5135('0x1d')]){output[a11_0x5135('0x20')]({'title':'Starting\x20distributed\x20command\x20execution'});}_0x34ff69[a11_0x5135('0x1a')]=new NoopLifeCycle();const _0x2a3b83=(0x0,environment_1[a11_0x5135('0x29')])();const _0x41d92a=(0x0,environment_1[a11_0x5135('0x13')])();const _0x22fb6f=(0x0,environment_1[a11_0x5135('0x24')])();const _0x11e103=(0x0,environment_1['getCIExecutionEnv'])();if(!(0x0,print_run_group_error_1[a11_0x5135('0x4')])(_0x41d92a,_0x22fb6f)){(0x0,print_run_group_error_1['printRunGroupError'])();process[a11_0x5135('0x32')](0x1);}const _0x4dc1d7=new e2e_encryption_1[(a11_0x5135('0x15'))](environment_1[a11_0x5135('0xe')]||_0x34ff69[a11_0x5135('0x1e')]);const _0x8501f1=new error_reporter_api_1[(a11_0x5135('0x37'))](_0x34ff69);const _0xe1f617=new dte_artifact_storage_1[(a11_0x5135('0x38'))](new file_storage_1['FileStorage'](_0x4dc1d7,_0x8501f1,_0x34ff69,a11_0x5135('0x18')),(0x0,environment_1[a11_0x5135('0x1f')])(_0x34ff69));const _0x261d00=new distributed_execution_api_1[(a11_0x5135('0x3a'))](_0x34ff69);attachSignalListenersToCompleteRunGroupOnError(_0x261d00,_0x2a3b83,_0x41d92a,_0x22fb6f,_0x11e103);try{const _0x5e7a2e=getTaskGraph(_0x1aaa2b,_0x51d3c2,_0x34ff69);const _0x47763b=yield runDistributedExecution(_0x261d00,_0x34ff69,_0xe1f617,_0x2a3b83,_0x41d92a,_0x22fb6f,_0x11e103,_0x5e7a2e);if(_0x47763b[a11_0x5135('0x19')]===0x0){output[a11_0x5135('0x27')]({'title':a11_0x5135('0x39'),'bodyLines':[a11_0x5135('0x35')+_0x47763b[a11_0x5135('0xb')]]});}else{output[a11_0x5135('0x1c')]({'title':a11_0x5135('0xd'),'bodyLines':[a11_0x5135('0x35')+_0x47763b[a11_0x5135('0xb')]]});}yield(0x0,metric_logger_1[a11_0x5135('0x25')])(_0x34ff69);process[a11_0x5135('0x32')](_0x47763b[a11_0x5135('0x19')]);}catch(_0x41f90a){output['error']({'title':a11_0x5135('0x2f'),'bodyLines':[_0x41f90a['message']]});if(_0x41f90a['axiosException']){console['log'](_0x41f90a[a11_0x5135('0x11')]);}else{console[a11_0x5135('0x26')](_0x41f90a);}try{yield _0x261d00[a11_0x5135('0x14')](_0x2a3b83,_0x41d92a,_0x22fb6f,_0x11e103,a11_0x5135('0x10')+_0x41f90a[a11_0x5135('0xf')]+'\x22');}finally{process['exit'](0x1);}}});exports[a11_0x5135('0x16')]=nxCloudDistributedTasksRunner;function getTaskGraph(_0x355420,_0x10ef7e,_0x3d4101){if(_0x355420[a11_0x5135('0x36')]){return _0x355420[a11_0x5135('0x36')];}else{return(0x0,task_graph_creator_1['createTaskGraphCompat'])(_0x3d4101,_0x355420[a11_0x5135('0x2a')],_0x10ef7e);}}function attachSignalListenersToCompleteRunGroupOnError(_0x7123cc,_0x157219,_0x427b25,_0x2df856,_0x5def8e){process['on'](a11_0x5135('0x8'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x7123cc['completeRunGroupWithError'](_0x157219,_0x427b25,_0x2df856,_0x5def8e,a11_0x5135('0x9'));process['exit'](0x1);}));process['on'](a11_0x5135('0x1'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x7123cc[a11_0x5135('0x14')](_0x157219,_0x427b25,_0x2df856,_0x5def8e,'Main\x20job\x20was\x20terminated\x20via\x20SIGTERM');process[a11_0x5135('0x32')](0x1);}));}function runDistributedExecution(_0x1fd829,_0x2949ea,_0x4a38b7,_0x199f4b,_0x3f5448,_0x2d0cc9,_0x306e3b,_0x44cb5){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x52432b=yield _0x1fd829[a11_0x5135('0x3')]((0x0,distributed_execution_api_1[a11_0x5135('0xc')])(_0x199f4b,_0x3f5448,_0x2d0cc9,_0x306e3b,(0x0,split_task_graph_into_stages_1[a11_0x5135('0x17')])(_0x44cb5),_0x2949ea));return yield(0x0,process_tasks_1[a11_0x5135('0x31')])(_0x1fd829,_0x4a38b7,_0x52432b,Object['values'](_0x44cb5[a11_0x5135('0x2')]));});}
@@ -1,45 +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.processTask = void 0;
13
- const environment_1 = require("../../../utilities/environment");
14
- const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
15
- const { output } = require('../../../utilities/nx-imports');
16
- function processTask(dteArtifactStorage, tasks, completedTask) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- if (environment_1.VERBOSE_LOGGING) {
19
- output.note({
20
- title: `Processing task ${completedTask.taskId}`,
21
- });
22
- }
23
- const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
24
- if (!matchingTask) {
25
- throw new Error(`Found unknown task: ${completedTask.taskId}`);
26
- }
27
- const terminalOutput = yield dteArtifactStorage.retrieveAndExtract(completedTask.hash, completedTask.url);
28
- output.logCommand(getCommand(matchingTask));
29
- process.stdout.write(terminalOutput);
30
- output.addVerticalSeparator();
31
- });
32
- }
33
- exports.processTask = processTask;
34
- function getCommand(task) {
35
- const config = task.target.configuration
36
- ? `:${task.target.configuration}`
37
- : '';
38
- return [
39
- 'nx',
40
- 'run',
41
- `${task.target.project}:${task.target.target}${config}`,
42
- (0, serializer_overrides_1.serializeOverrides)(task),
43
- ].join(' ');
44
- }
45
- //# sourceMappingURL=process-task.js.map
1
+ const a12_0x4c54=['done','hash','addVerticalSeparator','retrieveAndExtract','__esModule','then','taskId','processTask','../../../utilities/environment','note','../../../utilities/serializer-overrides','__awaiter','value','configuration','target','write','find','VERBOSE_LOGGING','project','join','defineProperty','stdout','next','Processing\x20task\x20','logCommand','Found\x20unknown\x20task:\x20'];(function(_0x2dc14b,_0x4c54d9){const _0x4bb584=function(_0x1b9acf){while(--_0x1b9acf){_0x2dc14b['push'](_0x2dc14b['shift']());}};_0x4bb584(++_0x4c54d9);}(a12_0x4c54,0x124));const a12_0x4bb5=function(_0x2dc14b,_0x4c54d9){_0x2dc14b=_0x2dc14b-0x0;let _0x4bb584=a12_0x4c54[_0x2dc14b];return _0x4bb584;};'use strict';var __awaiter=this&&this[a12_0x4bb5('0x5')]||function(_0x382951,_0x3730ab,_0x33f3b4,_0xb03193){function _0x2b1231(_0x38c6f5){return _0x38c6f5 instanceof _0x33f3b4?_0x38c6f5:new _0x33f3b4(function(_0x2b954a){_0x2b954a(_0x38c6f5);});}return new(_0x33f3b4||(_0x33f3b4=Promise))(function(_0x2361e2,_0x478eee){function _0x570069(_0x3f52f0){try{_0x26d885(_0xb03193[a12_0x4bb5('0x10')](_0x3f52f0));}catch(_0x2de8cd){_0x478eee(_0x2de8cd);}}function _0x31fab9(_0x57ab61){try{_0x26d885(_0xb03193['throw'](_0x57ab61));}catch(_0x2725f0){_0x478eee(_0x2725f0);}}function _0x26d885(_0x435f29){_0x435f29[a12_0x4bb5('0x14')]?_0x2361e2(_0x435f29[a12_0x4bb5('0x6')]):_0x2b1231(_0x435f29[a12_0x4bb5('0x6')])[a12_0x4bb5('0x19')](_0x570069,_0x31fab9);}_0x26d885((_0xb03193=_0xb03193['apply'](_0x382951,_0x3730ab||[]))['next']());});};Object[a12_0x4bb5('0xe')](exports,a12_0x4bb5('0x18'),{'value':!![]});exports[a12_0x4bb5('0x1')]=void 0x0;const environment_1=require(a12_0x4bb5('0x2'));const serializer_overrides_1=require(a12_0x4bb5('0x4'));const {output}=require('../../../utilities/nx-imports');function processTask(_0x4009fb,_0x57ebbe,_0x1796d1){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a12_0x4bb5('0xb')]){output[a12_0x4bb5('0x3')]({'title':a12_0x4bb5('0x11')+_0x1796d1[a12_0x4bb5('0x0')]});}const _0x3422c7=_0x57ebbe[a12_0x4bb5('0xa')](_0x44667a=>_0x1796d1[a12_0x4bb5('0x0')]===_0x44667a['id']);if(!_0x3422c7){throw new Error(a12_0x4bb5('0x13')+_0x1796d1[a12_0x4bb5('0x0')]);}const _0x36318e=yield _0x4009fb[a12_0x4bb5('0x17')](_0x1796d1[a12_0x4bb5('0x15')],_0x1796d1['url']);output[a12_0x4bb5('0x12')](getCommand(_0x3422c7));process[a12_0x4bb5('0xf')][a12_0x4bb5('0x9')](_0x36318e);output[a12_0x4bb5('0x16')]();});}exports[a12_0x4bb5('0x1')]=processTask;function getCommand(_0x1bfece){const _0x3f97d6=_0x1bfece[a12_0x4bb5('0x8')][a12_0x4bb5('0x7')]?':'+_0x1bfece[a12_0x4bb5('0x8')]['configuration']:'';return['nx','run',_0x1bfece[a12_0x4bb5('0x8')][a12_0x4bb5('0xc')]+':'+_0x1bfece[a12_0x4bb5('0x8')][a12_0x4bb5('0x8')]+_0x3f97d6,(0x0,serializer_overrides_1['serializeOverrides'])(_0x1bfece)][a12_0x4bb5('0xd')]('\x20');}
@@ -1,67 +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.processTasks = void 0;
13
- const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
14
- const environment_1 = require("../../../utilities/environment");
15
- const waiter_1 = require("../../../utilities/waiter");
16
- const process_task_1 = require("./process-task");
17
- const { output } = require('../../../utilities/nx-imports');
18
- function processTasks(api, dteArtifactStorage, executionId, tasks) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const processedTasks = {};
21
- const failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
22
- title: `No new completed tasks after ${environment_1.NO_COMPLETED_TASKS_TIMEOUT / 1000} seconds.`,
23
- timeout: environment_1.NO_COMPLETED_TASKS_TIMEOUT,
24
- });
25
- const waiter = new waiter_1.Waiter();
26
- while (true) {
27
- if (environment_1.VERBOSE_LOGGING) {
28
- output.note({
29
- title: 'Waiting...',
30
- });
31
- }
32
- yield waiter.wait();
33
- const r = yield api.status(executionId);
34
- if (environment_1.VERBOSE_LOGGING) {
35
- output.note({
36
- title: `Status update`,
37
- bodyLines: [
38
- `executionId: ${executionId}`,
39
- `executionStatus: ${r.executionStatus}`,
40
- `number of completed tasks: ${r.completedTasks.length}`,
41
- `error: ${r.criticalErrorMessage}`,
42
- ],
43
- });
44
- }
45
- if (r.criticalErrorMessage) {
46
- output.error({
47
- title: 'Distributed Execution Terminated',
48
- bodyLines: ['Error:', r.criticalErrorMessage],
49
- });
50
- process.exit(1);
51
- }
52
- failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout(r.completedTasks.length);
53
- for (const t of r.completedTasks) {
54
- if (processedTasks[t.taskId])
55
- continue;
56
- yield (0, process_task_1.processTask)(dteArtifactStorage, tasks, t);
57
- waiter.reset();
58
- processedTasks[t.taskId] = true;
59
- }
60
- if (r.executionStatus === 'COMPLETED') {
61
- return { commandStatus: r.commandStatus, runUrl: r.runUrl };
62
- }
63
- }
64
- });
65
- }
66
- exports.processTasks = processTasks;
67
- //# sourceMappingURL=process-tasks.js.map
1
+ const a13_0x528c=['status','next','createUnchangedValueTimeout','reset','Error:','processTask','__esModule','number\x20of\x20completed\x20tasks:\x20','exit','__awaiter','apply','processTasks','Waiting...','criticalErrorMessage','executionStatus','value','commandStatus','../../../utilities/waiter','../../../utilities/nx-imports','then','note','done','COMPLETED','Status\x20update','length','NO_COMPLETED_TASKS_TIMEOUT','Waiter','./process-task','wait','Distributed\x20Execution\x20Terminated','taskId','../../../utilities/environment','VERBOSE_LOGGING','No\x20new\x20completed\x20tasks\x20after\x20','completedTasks','runUrl'];(function(_0x385e13,_0x528cac){const _0x290083=function(_0x2299af){while(--_0x2299af){_0x385e13['push'](_0x385e13['shift']());}};_0x290083(++_0x528cac);}(a13_0x528c,0x150));const a13_0x2900=function(_0x385e13,_0x528cac){_0x385e13=_0x385e13-0x0;let _0x290083=a13_0x528c[_0x385e13];return _0x290083;};'use strict';var __awaiter=this&&this[a13_0x2900('0x21')]||function(_0x336ac0,_0x231a42,_0x212e8a,_0x474fa2){function _0x4a604a(_0x2beaa2){return _0x2beaa2 instanceof _0x212e8a?_0x2beaa2:new _0x212e8a(function(_0x39ac97){_0x39ac97(_0x2beaa2);});}return new(_0x212e8a||(_0x212e8a=Promise))(function(_0x10af4c,_0x4492ed){function _0x47e7ff(_0x4590e5){try{_0x51c6c1(_0x474fa2[a13_0x2900('0x19')](_0x4590e5));}catch(_0x1fdfbe){_0x4492ed(_0x1fdfbe);}}function _0x4b76b3(_0x324227){try{_0x51c6c1(_0x474fa2['throw'](_0x324227));}catch(_0x260e1f){_0x4492ed(_0x260e1f);}}function _0x51c6c1(_0x138c9a){_0x138c9a[a13_0x2900('0x9')]?_0x10af4c(_0x138c9a[a13_0x2900('0x3')]):_0x4a604a(_0x138c9a[a13_0x2900('0x3')])[a13_0x2900('0x7')](_0x47e7ff,_0x4b76b3);}_0x51c6c1((_0x474fa2=_0x474fa2[a13_0x2900('0x22')](_0x336ac0,_0x231a42||[]))[a13_0x2900('0x19')]());});};Object['defineProperty'](exports,a13_0x2900('0x1e'),{'value':!![]});exports[a13_0x2900('0x23')]=void 0x0;const create_unchanged_value_timeout_1=require('../../../utilities/create-unchanged-value-timeout');const environment_1=require(a13_0x2900('0x13'));const waiter_1=require(a13_0x2900('0x5'));const process_task_1=require(a13_0x2900('0xf'));const {output}=require(a13_0x2900('0x6'));function processTasks(_0x174a14,_0x37af6a,_0x4cde48,_0xd119ee){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x390970={};const _0x56b3e0=(0x0,create_unchanged_value_timeout_1[a13_0x2900('0x1a')])({'title':a13_0x2900('0x15')+environment_1[a13_0x2900('0xd')]/0x3e8+'\x20seconds.','timeout':environment_1[a13_0x2900('0xd')]});const _0x282246=new waiter_1[(a13_0x2900('0xe'))]();while(!![]){if(environment_1[a13_0x2900('0x14')]){output[a13_0x2900('0x8')]({'title':a13_0x2900('0x0')});}yield _0x282246[a13_0x2900('0x10')]();const _0x81c062=yield _0x174a14[a13_0x2900('0x18')](_0x4cde48);if(environment_1[a13_0x2900('0x14')]){output[a13_0x2900('0x8')]({'title':a13_0x2900('0xb'),'bodyLines':['executionId:\x20'+_0x4cde48,'executionStatus:\x20'+_0x81c062[a13_0x2900('0x2')],a13_0x2900('0x1f')+_0x81c062['completedTasks'][a13_0x2900('0xc')],'error:\x20'+_0x81c062[a13_0x2900('0x1')]]});}if(_0x81c062['criticalErrorMessage']){output['error']({'title':a13_0x2900('0x11'),'bodyLines':[a13_0x2900('0x1c'),_0x81c062[a13_0x2900('0x1')]]});process[a13_0x2900('0x20')](0x1);}_0x56b3e0(_0x81c062[a13_0x2900('0x16')][a13_0x2900('0xc')]);for(const _0xe60542 of _0x81c062[a13_0x2900('0x16')]){if(_0x390970[_0xe60542[a13_0x2900('0x12')]])continue;yield(0x0,process_task_1[a13_0x2900('0x1d')])(_0x37af6a,_0xd119ee,_0xe60542);_0x282246[a13_0x2900('0x1b')]();_0x390970[_0xe60542['taskId']]=!![];}if(_0x81c062['executionStatus']===a13_0x2900('0xa')){return{'commandStatus':_0x81c062[a13_0x2900('0x4')],'runUrl':_0x81c062[a13_0x2900('0x17')]};}}});}exports[a13_0x2900('0x23')]=processTasks;
@@ -1,37 +1 @@
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
+ const a14_0x5839=['tasks','map','splitTasksIntoStages','__esModule','has','dependencies','defineProperty','values','size'];(function(_0x151893,_0x5839a3){const _0x280abd=function(_0x3962c8){while(--_0x3962c8){_0x151893['push'](_0x151893['shift']());}};_0x280abd(++_0x5839a3);}(a14_0x5839,0xbc));const a14_0x280a=function(_0x151893,_0x5839a3){_0x151893=_0x151893-0x0;let _0x280abd=a14_0x5839[_0x151893];return _0x280abd;};'use strict';Object[a14_0x280a('0x7')](exports,a14_0x280a('0x4'),{'value':!![]});exports['splitTasksIntoStages']=void 0x0;function splitTasksIntoStages(_0x5e5b6d){const _0x4006f8=[];const _0x3657cb=new Set(Object[a14_0x280a('0x8')](_0x5e5b6d[a14_0x280a('0x1')])[a14_0x280a('0x2')](_0x5280e5=>_0x5280e5['id']));let _0xfa7e61=0x0;while(_0x3657cb[a14_0x280a('0x0')]>0x0){const _0xb072f=_0x4006f8[_0xfa7e61]=[];for(const _0xafe8ab of _0x3657cb){let _0x1e1949=!![];for(const _0x1da54e of _0x5e5b6d[a14_0x280a('0x6')][_0xafe8ab]){if(_0x3657cb[a14_0x280a('0x5')](_0x1da54e)){_0x1e1949=![];break;}}if(!_0x1e1949){continue;}const _0x3284bb=_0x5e5b6d[a14_0x280a('0x1')][_0xafe8ab];_0xb072f['push'](_0x3284bb);}for(const _0x9a64fa of _0xb072f){_0x3657cb['delete'](_0x9a64fa['id']);}_0xfa7e61++;}return _0x4006f8;}exports[a14_0x280a('0x3')]=splitTasksIntoStages;
@@ -1,100 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaskGraphCreator = exports.createTaskGraphCompat = void 0;
4
- const stripJsonComments = require("strip-json-comments");
5
- const fs_1 = require("fs");
6
- const { getDependencyConfigs, workspaceRoot, } = require('../../../utilities/nx-imports');
7
- function createTaskGraphCompat(options, projectGraph, tasks) {
8
- const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
9
- return new TaskGraphCreator(projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
10
- }
11
- exports.createTaskGraphCompat = createTaskGraphCompat;
12
- function getDefaultDependencyConfigs(nxJson, runnerOptions) {
13
- var _a, _b;
14
- const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
15
- const strictlyOrderedTargets = runnerOptions
16
- ? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
17
- : [];
18
- // Strictly Ordered Targets depend on their dependencies
19
- for (const target of strictlyOrderedTargets) {
20
- defaults[target] = defaults[target] || [];
21
- defaults[target].push({
22
- target,
23
- projects: 'dependencies',
24
- });
25
- }
26
- return defaults;
27
- }
28
- /**
29
- * This is only used for versions of Nx prior to 14 where the task graph
30
- * wasn't part of the context so we have to recreate it
31
- */
32
- class TaskGraphCreator {
33
- constructor(projectGraph, defaultTargetDependencies) {
34
- this.projectGraph = projectGraph;
35
- this.defaultTargetDependencies = defaultTargetDependencies;
36
- }
37
- createTaskGraph(tasks) {
38
- const graph = {
39
- roots: [],
40
- tasks: {},
41
- dependencies: {},
42
- };
43
- for (const task of tasks) {
44
- this.addTaskToGraph(task, graph);
45
- const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
46
- if (!dependencyConfigs) {
47
- continue;
48
- }
49
- this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
50
- }
51
- graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
52
- return graph;
53
- }
54
- addTaskDependencies(task, dependencyConfigs, tasks, graph) {
55
- for (const dependencyConfig of dependencyConfigs) {
56
- if (dependencyConfig.projects === 'self') {
57
- for (const t of tasks) {
58
- if (t.target.project === task.target.project &&
59
- t.target.target === dependencyConfig.target) {
60
- graph.dependencies[task.id].push(t.id);
61
- }
62
- }
63
- }
64
- else if (dependencyConfig.projects === 'dependencies') {
65
- const seen = new Set();
66
- this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
67
- }
68
- }
69
- }
70
- addDependencies(project, target, tasks, graph, taskId, seen) {
71
- seen.add(project);
72
- const dependencies = this.projectGraph.dependencies[project];
73
- if (dependencies) {
74
- const projectDependencies = dependencies.map((dependency) => dependency.target);
75
- for (const projectDependency of projectDependencies) {
76
- if (seen.has(projectDependency)) {
77
- continue;
78
- }
79
- const dependency = this.findTask({ project: projectDependency, target }, tasks);
80
- if (dependency) {
81
- if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
82
- graph.dependencies[taskId].push(dependency.id);
83
- }
84
- }
85
- else {
86
- this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
87
- }
88
- }
89
- }
90
- }
91
- findTask({ project, target }, tasks) {
92
- return tasks.find((t) => t.target.project === project && t.target.target === target);
93
- }
94
- addTaskToGraph(task, graph) {
95
- graph.tasks[task.id] = task;
96
- graph.dependencies[task.id] = [];
97
- }
98
- }
99
- exports.TaskGraphCreator = TaskGraphCreator;
100
- //# sourceMappingURL=task-graph-creator.js.map
1
+ const a15_0x5da6=['indexOf','../../../utilities/nx-imports','dependencies','strictlyOrderedTargets','build','toString','has','addTaskToGraph','projectGraph','addDependencies','addTaskDependencies','target','filter','/nx.json','createTaskGraphCompat','add','defineProperty','self','parse','push','projects','map','defaultTargetDependencies','findTask','roots','project','targetDependencies','TaskGraphCreator','length','createTaskGraph','__esModule','keys'];(function(_0x25a342,_0x5da6bc){const _0xc6b05f=function(_0x43f220){while(--_0x43f220){_0x25a342['push'](_0x25a342['shift']());}};_0xc6b05f(++_0x5da6bc);}(a15_0x5da6,0x102));const a15_0xc6b0=function(_0x25a342,_0x5da6bc){_0x25a342=_0x25a342-0x0;let _0xc6b05f=a15_0x5da6[_0x25a342];return _0xc6b05f;};'use strict';Object[a15_0xc6b0('0xe')](exports,a15_0xc6b0('0x1c'),{'value':!![]});exports[a15_0xc6b0('0x19')]=exports[a15_0xc6b0('0xc')]=void 0x0;const stripJsonComments=require('strip-json-comments');const fs_1=require('fs');const {getDependencyConfigs,workspaceRoot}=require(a15_0xc6b0('0x1f'));function createTaskGraphCompat(_0x4282dd,_0x56dded,_0x321846){const _0x5b2581=JSON[a15_0xc6b0('0x10')](stripJsonComments((0x0,fs_1['readFileSync'])(workspaceRoot+a15_0xc6b0('0xb'))[a15_0xc6b0('0x3')]()));return new TaskGraphCreator(_0x56dded,getDefaultDependencyConfigs(_0x5b2581,_0x4282dd))[a15_0xc6b0('0x1b')](_0x321846);}exports[a15_0xc6b0('0xc')]=createTaskGraphCompat;function getDefaultDependencyConfigs(_0x2cf7d0,_0x47b197){var _0xe8d37f,_0x1f4f2a;const _0x2bbfa1=(_0xe8d37f=_0x2cf7d0[a15_0xc6b0('0x18')])!==null&&_0xe8d37f!==void 0x0?_0xe8d37f:{};const _0x431715=_0x47b197?(_0x1f4f2a=_0x47b197[a15_0xc6b0('0x1')])!==null&&_0x1f4f2a!==void 0x0?_0x1f4f2a:[a15_0xc6b0('0x2')]:[];for(const _0x3dfa02 of _0x431715){_0x2bbfa1[_0x3dfa02]=_0x2bbfa1[_0x3dfa02]||[];_0x2bbfa1[_0x3dfa02][a15_0xc6b0('0x11')]({'target':_0x3dfa02,'projects':a15_0xc6b0('0x0')});}return _0x2bbfa1;}class TaskGraphCreator{constructor(_0x5a7745,_0x1c0ec6){this[a15_0xc6b0('0x6')]=_0x5a7745;this[a15_0xc6b0('0x14')]=_0x1c0ec6;}[a15_0xc6b0('0x1b')](_0x3faf57){const _0x2ccd32={'roots':[],'tasks':{},'dependencies':{}};for(const _0xc290ce of _0x3faf57){this[a15_0xc6b0('0x5')](_0xc290ce,_0x2ccd32);const _0x30fc0f=getDependencyConfigs(_0xc290ce[a15_0xc6b0('0x9')],this[a15_0xc6b0('0x14')],this[a15_0xc6b0('0x6')]);if(!_0x30fc0f){continue;}this[a15_0xc6b0('0x8')](_0xc290ce,_0x30fc0f,_0x3faf57,_0x2ccd32);}_0x2ccd32[a15_0xc6b0('0x16')]=Object[a15_0xc6b0('0x1d')](_0x2ccd32['dependencies'])[a15_0xc6b0('0xa')](_0x4b9e58=>_0x2ccd32[a15_0xc6b0('0x0')][_0x4b9e58][a15_0xc6b0('0x1a')]===0x0);return _0x2ccd32;}[a15_0xc6b0('0x8')](_0x43bc94,_0x44930a,_0x33d845,_0x594ddf){for(const _0x4fbbf3 of _0x44930a){if(_0x4fbbf3[a15_0xc6b0('0x12')]===a15_0xc6b0('0xf')){for(const _0x39e3f4 of _0x33d845){if(_0x39e3f4['target'][a15_0xc6b0('0x17')]===_0x43bc94['target'][a15_0xc6b0('0x17')]&&_0x39e3f4[a15_0xc6b0('0x9')]['target']===_0x4fbbf3[a15_0xc6b0('0x9')]){_0x594ddf[a15_0xc6b0('0x0')][_0x43bc94['id']][a15_0xc6b0('0x11')](_0x39e3f4['id']);}}}else if(_0x4fbbf3[a15_0xc6b0('0x12')]===a15_0xc6b0('0x0')){const _0x29373c=new Set();this['addDependencies'](_0x43bc94[a15_0xc6b0('0x9')][a15_0xc6b0('0x17')],_0x4fbbf3[a15_0xc6b0('0x9')],_0x33d845,_0x594ddf,_0x43bc94['id'],_0x29373c);}}}[a15_0xc6b0('0x7')](_0x5681ec,_0x21b82f,_0x7846fb,_0x3b8859,_0x1b2e29,_0x6f0933){_0x6f0933[a15_0xc6b0('0xd')](_0x5681ec);const _0x843049=this[a15_0xc6b0('0x6')]['dependencies'][_0x5681ec];if(_0x843049){const _0x4699c0=_0x843049[a15_0xc6b0('0x13')](_0x22298d=>_0x22298d['target']);for(const _0x5343a8 of _0x4699c0){if(_0x6f0933[a15_0xc6b0('0x4')](_0x5343a8)){continue;}const _0x94d580=this[a15_0xc6b0('0x15')]({'project':_0x5343a8,'target':_0x21b82f},_0x7846fb);if(_0x94d580){if(_0x3b8859['dependencies'][_0x1b2e29][a15_0xc6b0('0x1e')](_0x94d580['id'])===-0x1){_0x3b8859['dependencies'][_0x1b2e29]['push'](_0x94d580['id']);}}else{this[a15_0xc6b0('0x7')](_0x5343a8,_0x21b82f,_0x7846fb,_0x3b8859,_0x1b2e29,_0x6f0933);}}}}[a15_0xc6b0('0x15')]({project,target},_0x1224c0){return _0x1224c0['find'](_0x3ff52d=>_0x3ff52d[a15_0xc6b0('0x9')][a15_0xc6b0('0x17')]===project&&_0x3ff52d[a15_0xc6b0('0x9')][a15_0xc6b0('0x9')]===target);}[a15_0xc6b0('0x5')](_0x54df5b,_0x9f74b6){_0x9f74b6['tasks'][_0x54df5b['id']]=_0x54df5b;_0x9f74b6[a15_0xc6b0('0x0')][_0x54df5b['id']]=[];}}exports[a15_0xc6b0('0x19')]=TaskGraphCreator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/nx-cloud",
3
- "version": "15.3.1-beta.1",
3
+ "version": "15.3.1",
4
4
  "description": "Nx Cloud plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",