@nrwl/nx-cloud 14.0.3-beta.1 → 14.0.3-beta.2

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.
Files changed (121) hide show
  1. package/bin/nx-cloud.d.ts +2 -0
  2. package/bin/nx-cloud.js +43 -0
  3. package/bin/nx-cloud.js.map +1 -0
  4. package/index.d.ts +2 -0
  5. package/index.js +5 -0
  6. package/index.js.map +1 -0
  7. package/lib/core/api/run-group.api.d.ts +7 -0
  8. package/lib/core/api/run-group.api.js +65 -0
  9. package/lib/core/api/run-group.api.js.map +1 -0
  10. package/lib/core/commands/clean-up-agents.d.ts +1 -0
  11. package/lib/core/commands/clean-up-agents.js +34 -0
  12. package/lib/core/commands/clean-up-agents.js.map +1 -0
  13. package/lib/core/commands/record-output.d.ts +16 -0
  14. package/lib/core/commands/record-output.js +203 -0
  15. package/lib/core/commands/record-output.js.map +1 -0
  16. package/lib/core/commands/start-ci-run.d.ts +1 -0
  17. package/lib/core/commands/start-ci-run.js +38 -0
  18. package/lib/core/commands/start-ci-run.js.map +1 -0
  19. package/lib/core/commands/stop-all-agents.d.ts +1 -0
  20. package/lib/core/commands/stop-all-agents.js +37 -0
  21. package/lib/core/commands/stop-all-agents.js.map +1 -0
  22. package/lib/core/error/print-run-group-error.d.ts +1 -0
  23. package/lib/core/error/print-run-group-error.js +16 -0
  24. package/lib/core/error/print-run-group-error.js.map +1 -0
  25. package/lib/core/file-storage/e2e-encryption.d.ts +9 -0
  26. package/lib/core/file-storage/e2e-encryption.js +46 -0
  27. package/lib/core/file-storage/e2e-encryption.js.map +1 -0
  28. package/lib/core/file-storage/file-storage.d.ts +13 -0
  29. package/lib/core/file-storage/file-storage.js +174 -0
  30. package/lib/core/file-storage/file-storage.js.map +1 -0
  31. package/lib/core/models/cache-urls.model.d.ts +6 -0
  32. package/lib/core/models/cache-urls.model.js +3 -0
  33. package/lib/core/models/cache-urls.model.js.map +1 -0
  34. package/lib/core/models/cloud-task-runner-options.d.ts +20 -0
  35. package/lib/core/models/cloud-task-runner-options.js +3 -0
  36. package/lib/core/models/cloud-task-runner-options.js.map +1 -0
  37. package/lib/core/models/distributed-agent/grouped-tasks.model.d.ts +6 -0
  38. package/lib/core/models/distributed-agent/grouped-tasks.model.js +3 -0
  39. package/lib/core/models/distributed-agent/grouped-tasks.model.js.map +1 -0
  40. package/lib/core/models/distributed-agent/index.d.ts +3 -0
  41. package/lib/core/models/distributed-agent/index.js +20 -0
  42. package/lib/core/models/distributed-agent/index.js.map +1 -0
  43. package/lib/core/models/distributed-agent/task-to-execute.model.d.ts +7 -0
  44. package/lib/core/models/distributed-agent/task-to-execute.model.js +3 -0
  45. package/lib/core/models/distributed-agent/task-to-execute.model.js.map +1 -0
  46. package/lib/core/models/distributed-agent/tasks-api-response.model.d.ts +9 -0
  47. package/lib/core/models/distributed-agent/tasks-api-response.model.js +3 -0
  48. package/lib/core/models/distributed-agent/tasks-api-response.model.js.map +1 -0
  49. package/lib/core/models/machine-info.model.d.ts +6 -0
  50. package/lib/core/models/machine-info.model.js +3 -0
  51. package/lib/core/models/machine-info.model.js.map +1 -0
  52. package/lib/core/models/run-context.model.d.ts +42 -0
  53. package/lib/core/models/run-context.model.js +3 -0
  54. package/lib/core/models/run-context.model.js.map +1 -0
  55. package/lib/core/models/run-data.model.d.ts +11 -0
  56. package/lib/core/models/run-data.model.js +3 -0
  57. package/lib/core/models/run-data.model.js.map +1 -0
  58. package/lib/core/models/task-execution.model.d.ts +13 -0
  59. package/lib/core/models/task-execution.model.js +3 -0
  60. package/lib/core/models/task-execution.model.js.map +1 -0
  61. package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.d.ts +25 -0
  62. package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +138 -0
  63. package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js.map +1 -0
  64. package/lib/core/runners/cloud-enabled/cloud-enabled.runner.d.ts +4 -0
  65. package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +167 -0
  66. package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js.map +1 -0
  67. package/lib/core/runners/cloud-enabled/cloud-remote-cache.d.ts +16 -0
  68. package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +113 -0
  69. package/lib/core/runners/cloud-enabled/cloud-remote-cache.js.map +1 -0
  70. package/lib/core/runners/cloud-enabled/cloud-run.api.d.ts +17 -0
  71. package/lib/core/runners/cloud-enabled/cloud-run.api.js +158 -0
  72. package/lib/core/runners/cloud-enabled/cloud-run.api.js.map +1 -0
  73. package/lib/core/runners/distributed-agent/distributed-agent.api.d.ts +13 -0
  74. package/lib/core/runners/distributed-agent/distributed-agent.api.js +79 -0
  75. package/lib/core/runners/distributed-agent/distributed-agent.api.js.map +1 -0
  76. package/lib/core/runners/distributed-agent/distributed-agent.impl.d.ts +1 -0
  77. package/lib/core/runners/distributed-agent/distributed-agent.impl.js +239 -0
  78. package/lib/core/runners/distributed-agent/distributed-agent.impl.js.map +1 -0
  79. package/lib/core/runners/distributed-execution/distributed-execution.api.d.ts +10 -0
  80. package/lib/core/runners/distributed-execution/distributed-execution.api.js +130 -0
  81. package/lib/core/runners/distributed-execution/distributed-execution.api.js.map +1 -0
  82. package/lib/core/runners/distributed-execution/distributed-execution.runner.d.ts +12 -0
  83. package/lib/core/runners/distributed-execution/distributed-execution.runner.js +306 -0
  84. package/lib/core/runners/distributed-execution/distributed-execution.runner.js.map +1 -0
  85. package/lib/core/terminal-output/end-of-run-message.d.ts +8 -0
  86. package/lib/core/terminal-output/end-of-run-message.js +37 -0
  87. package/lib/core/terminal-output/end-of-run-message.js.map +1 -0
  88. package/lib/core/terminal-output/message-reporter.d.ts +11 -0
  89. package/lib/core/terminal-output/message-reporter.js +71 -0
  90. package/lib/core/terminal-output/message-reporter.js.map +1 -0
  91. package/lib/core/terminal-output/output-obfuscator.d.ts +6 -0
  92. package/lib/core/terminal-output/output-obfuscator.js +48 -0
  93. package/lib/core/terminal-output/output-obfuscator.js.map +1 -0
  94. package/lib/generators/init/init.d.ts +2 -0
  95. package/lib/generators/init/init.js +126 -0
  96. package/lib/generators/init/init.js.map +1 -0
  97. package/lib/nx-cloud-tasks-runner.d.ts +2 -0
  98. package/lib/nx-cloud-tasks-runner.js +102 -0
  99. package/lib/nx-cloud-tasks-runner.js.map +1 -0
  100. package/lib/utilities/axios.d.ts +9 -0
  101. package/lib/utilities/axios.js +73 -0
  102. package/lib/utilities/axios.js.map +1 -0
  103. package/lib/utilities/create-no-new-messages-timeout.d.ts +1 -0
  104. package/lib/utilities/create-no-new-messages-timeout.js +25 -0
  105. package/lib/utilities/create-no-new-messages-timeout.js.map +1 -0
  106. package/lib/utilities/environment.d.ts +24 -0
  107. package/lib/utilities/environment.js +156 -0
  108. package/lib/utilities/environment.js.map +1 -0
  109. package/lib/utilities/metric-logger.d.ts +22 -0
  110. package/lib/utilities/metric-logger.js +70 -0
  111. package/lib/utilities/metric-logger.js.map +1 -0
  112. package/lib/utilities/nx-imports.d.ts +0 -0
  113. package/lib/utilities/nx-imports.js +39 -0
  114. package/lib/utilities/nx-imports.js.map +1 -0
  115. package/lib/utilities/print-message.d.ts +1 -0
  116. package/lib/utilities/print-message.js +35 -0
  117. package/lib/utilities/print-message.js.map +1 -0
  118. package/lib/utilities/waiter.d.ts +6 -0
  119. package/lib/utilities/waiter.js +36 -0
  120. package/lib/utilities/waiter.js.map +1 -0
  121. package/package.json +1 -1
@@ -0,0 +1,239 @@
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.startAgent = void 0;
13
+ const child_process_1 = require("child_process");
14
+ const stripJsonComments = require("strip-json-comments");
15
+ const distributed_agent_api_1 = require("./distributed-agent.api");
16
+ const waiter_1 = require("../../../utilities/waiter");
17
+ const environment_1 = require("../../../utilities/environment");
18
+ const print_run_group_error_1 = require("../../error/print-run-group-error");
19
+ const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
20
+ const fs_1 = require("fs");
21
+ const metric_logger_1 = require("../../../utilities/metric-logger");
22
+ const { output } = require('../../../utilities/nx-imports');
23
+ function executeTasks(options, api) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ let completedStatusCode = 0;
26
+ let apiResponse = null;
27
+ const failIfSameTasksIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
28
+ const waiter = new waiter_1.Waiter();
29
+ let completedTasks = [];
30
+ const startTime = new Date();
31
+ let executedAnyTasks = false;
32
+ while (true) {
33
+ if (environment_1.VERBOSE_LOGGING) {
34
+ output.note({
35
+ title: 'Fetching tasks...',
36
+ });
37
+ }
38
+ apiResponse = yield api.tasks(apiResponse ? apiResponse.executionId : null, completedStatusCode, completedTasks);
39
+ if (environment_1.VERBOSE_LOGGING) {
40
+ output.note({
41
+ title: 'API Response',
42
+ bodyLines: [
43
+ `completed: ${apiResponse.completed}`,
44
+ `retryDuring: ${apiResponse.retryDuring}`,
45
+ `executionId: ${apiResponse.executionId}`,
46
+ `number of tasks: ${apiResponse.tasks.length}`,
47
+ `error: ${apiResponse.criticalErrorMessage}`,
48
+ `maxParallel: ${apiResponse.maxParallel}`,
49
+ ],
50
+ });
51
+ }
52
+ if (apiResponse.criticalErrorMessage) {
53
+ output.error({
54
+ title: 'Distributed Execution Terminated',
55
+ bodyLines: ['Error:', apiResponse.criticalErrorMessage],
56
+ });
57
+ process.exit(0);
58
+ }
59
+ // run group is completed but it might be a rerun
60
+ // we will try several times before going further and
61
+ // completed the response
62
+ // we only do it if we haven't executed any tasks
63
+ if ((apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.retryDuring) &&
64
+ (apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.retryDuring) !== 0 &&
65
+ !executedAnyTasks &&
66
+ new Date().getTime() - startTime.getTime() > apiResponse.retryDuring) {
67
+ yield waiter.wait();
68
+ continue;
69
+ }
70
+ if (apiResponse.completed)
71
+ return;
72
+ failIfSameTasksIn30Mins(apiResponse.tasks.map((t) => t.taskId).join(''));
73
+ if (!apiResponse.executionId) {
74
+ if (environment_1.VERBOSE_LOGGING) {
75
+ output.note({
76
+ title: 'Waiting...',
77
+ });
78
+ }
79
+ yield waiter.wait();
80
+ completedStatusCode = 0;
81
+ completedTasks = [];
82
+ continue;
83
+ }
84
+ waiter.reset();
85
+ executedAnyTasks = true;
86
+ const r = invokeTasksUsingRunMany(options, apiResponse.executionId, apiResponse.tasks, apiResponse.maxParallel);
87
+ completedStatusCode = r.completedStatusCode;
88
+ completedTasks = r.completedTasks;
89
+ }
90
+ });
91
+ }
92
+ function readCompletedTasks(options, distributedExecutionId) {
93
+ const errorMessage = `Command execution failed (distributed task execution: ${distributedExecutionId}). Tasks hashes haven\'t been recorded.`;
94
+ let completedTasks;
95
+ try {
96
+ const cacheDirectory = options.cacheDirectory || './node_modules/.cache/nx';
97
+ const taskHashesFile = `${cacheDirectory}/tasks-hashes-${distributedExecutionId}`;
98
+ completedTasks = JSON.parse((0, fs_1.readFileSync)(taskHashesFile).toString());
99
+ // remove it such that if the next command crashes we don't read an obsolete file
100
+ (0, fs_1.unlinkSync)(taskHashesFile);
101
+ }
102
+ catch (e) {
103
+ throw new Error(errorMessage);
104
+ }
105
+ if (completedTasks.length == 0) {
106
+ throw new Error(errorMessage);
107
+ }
108
+ return completedTasks;
109
+ }
110
+ function invokeTasksUsingRunMany(options, executionId, tasks, maxParallel) {
111
+ let completedStatusCode = 0;
112
+ const completedTasks = [];
113
+ for (const g of groupByTarget(tasks)) {
114
+ const config = g.configuration ? `--configuration=${g.configuration}` : ``;
115
+ const parallel = maxParallel > 1 ? ` --parallel --max-parallel=${maxParallel}` : ``;
116
+ // TODO use pnpx or yarn when needed
117
+ const command = `npx nx run-many --target=${g.target} ${config} --projects=${g.projects.join(',')} ${g.params}${parallel}`;
118
+ if (environment_1.VERBOSE_LOGGING) {
119
+ output.note({
120
+ title: `Executing: '${command}'`,
121
+ });
122
+ }
123
+ try {
124
+ (0, child_process_1.execSync)(command, {
125
+ stdio: ['inherit', 'inherit', 'inherit'],
126
+ env: Object.assign(Object.assign({}, process.env), { NX_CACHE_FAILURES: 'true', NX_CLOUD_DISTRIBUTED_EXECUTION_ID: executionId }),
127
+ });
128
+ }
129
+ catch (e) {
130
+ if (e.status === environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE) {
131
+ throw e;
132
+ }
133
+ else {
134
+ completedStatusCode = 1;
135
+ }
136
+ }
137
+ finally {
138
+ completedTasks.push(...readCompletedTasks(options, executionId));
139
+ }
140
+ }
141
+ return { completedStatusCode, completedTasks };
142
+ }
143
+ function groupByTarget(tasks) {
144
+ const res = [];
145
+ tasks.forEach((t) => {
146
+ const r = res.find((rr) => rr.target === t.target && rr.configuration === t.configuration);
147
+ if (r) {
148
+ r.projects.push(t.projectName);
149
+ }
150
+ else {
151
+ res.push({
152
+ target: t.target,
153
+ projects: [t.projectName],
154
+ params: t.params,
155
+ configuration: t.configuration,
156
+ });
157
+ }
158
+ });
159
+ return res;
160
+ }
161
+ function getAgentName() {
162
+ if (process.env.NX_AGENT_NAME !== undefined) {
163
+ return process.env.NX_AGENT_NAME;
164
+ }
165
+ else if (process.env.CIRCLECI !== undefined) {
166
+ return process.env.CIRCLE_STAGE;
167
+ }
168
+ else {
169
+ return `Agent ${Math.floor(Math.random() * 100000)}`;
170
+ }
171
+ }
172
+ function createAgentLockfile(options, agentName) {
173
+ const cacheDirectory = options.cacheDirectory || './node_modules/.cache/nx';
174
+ const lockFileDirectory = `${cacheDirectory}/lockfiles`;
175
+ const lockFilePath = `${lockFileDirectory}/${agentName}.lock`;
176
+ if (!(0, fs_1.existsSync)(lockFileDirectory)) {
177
+ (0, fs_1.mkdirSync)(lockFileDirectory, { recursive: true });
178
+ }
179
+ // Check for other agents' lockfiles and warn if exist
180
+ const lockFiles = (0, fs_1.readdirSync)(lockFileDirectory);
181
+ if (lockFiles.length) {
182
+ // Check to make sure the current agent name is not in use (only 1/100000 ^ 2 chance of this)
183
+ if (lockFiles.includes(`${agentName}.lock`)) {
184
+ output.error({
185
+ title: 'Duplicate Agent ID Detected',
186
+ bodyLines: [
187
+ 'We have detected another agent with this ID running in this workspace. This should not happen.',
188
+ '',
189
+ 'End all currently running agents, run "npx nx-cloud clean-up-agents", and try again.',
190
+ ],
191
+ });
192
+ process.exit(1);
193
+ }
194
+ output.warn({
195
+ title: 'Other Nx Cloud Agents Detected',
196
+ bodyLines: [
197
+ 'We have detected other agents running in this workspace. This can cause unexpected behavior.',
198
+ '',
199
+ 'This can also be a false positive caused by agents that did not shut down correctly.',
200
+ 'If you believe this is the case, run "npx nx-cloud clean-up-agents".',
201
+ ],
202
+ });
203
+ }
204
+ (0, fs_1.writeFileSync)(lockFilePath, '');
205
+ process.on('exit', () => cleanupAgentLockfile(lockFilePath));
206
+ process.on('SIGINT', () => cleanupAgentLockfile(lockFilePath));
207
+ }
208
+ function cleanupAgentLockfile(lockFilePath) {
209
+ if ((0, fs_1.existsSync)(lockFilePath)) {
210
+ (0, fs_1.unlinkSync)(lockFilePath);
211
+ }
212
+ }
213
+ function startAgent() {
214
+ return __awaiter(this, void 0, void 0, function* () {
215
+ const runGroup = (0, environment_1.getRunGroup)();
216
+ if (!runGroup) {
217
+ (0, print_run_group_error_1.printRunGroupError)();
218
+ return process.exit(1);
219
+ }
220
+ output.note({
221
+ title: 'Starting an agent for running Nx tasks',
222
+ });
223
+ const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString())).tasksRunnerOptions.default.options;
224
+ const agentName = getAgentName();
225
+ createAgentLockfile(options, agentName);
226
+ const api = new distributed_agent_api_1.DistributedAgentApi(options, runGroup, agentName);
227
+ return executeTasks(options, api)
228
+ .then((res) => __awaiter(this, void 0, void 0, function* () {
229
+ yield (0, metric_logger_1.submitRunMetrics)(options);
230
+ return res;
231
+ }))
232
+ .catch((e) => __awaiter(this, void 0, void 0, function* () {
233
+ yield api.completeRunGroupWithError(`Critical Error in Agent: "${e.message}"`);
234
+ throw e;
235
+ }));
236
+ });
237
+ }
238
+ exports.startAgent = startAgent;
239
+ //# sourceMappingURL=distributed-agent.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distributed-agent.impl.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/lib/core/runners/distributed-agent/distributed-agent.impl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAyC;AACzC,yDAAyD;AAEzD,mEAA8D;AAM9D,sDAAmD;AACnD,gEAIwC;AACxC,6EAAuE;AACvE,sGAA+F;AAC/F,2BAOY;AACZ,oEAAoE;AACpE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAE5D,SAAe,YAAY,CACzB,OAA+B,EAC/B,GAAwB;;QAExB,IAAI,mBAAmB,GAAG,CAAC,CAAC;QAC5B,IAAI,WAAW,GAA4B,IAAI,CAAC;QAChD,MAAM,uBAAuB,GAAG,IAAA,2DAA0B,GAAE,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;QAE5B,IAAI,cAAc,GAAG,EAAwC,CAAC;QAE9D,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,gBAAgB,GAAG,KAAK,CAAC;QAE7B,OAAO,IAAI,EAAE;YACX,IAAI,6BAAe,EAAE;gBACnB,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,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/run-context.model';
3
+ export declare class DistributedExecutionApi {
4
+ private apiAxiosInstance;
5
+ constructor(options: CloudTaskRunnerOptions);
6
+ start(params: any): Promise<string>;
7
+ status(id: string): Promise<any>;
8
+ completeRunGroupWithError(runGroup: string, error: string): Promise<void>;
9
+ }
10
+ export declare function createStartRequest(runGroup: string, task: Task[][], options: CloudTaskRunnerOptions): any;
@@ -0,0 +1,130 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distributed-execution.api.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/lib/core/runners/distributed-execution/distributed-execution.api.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAGkC;AAClC,gEAKwC;AACxC,oEAI0C;AAG1C,MAAM,EAAE,MAA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AI,OAAO,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QACnE,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;KACzC;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;QACzC,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9D;SAAM;QACL,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACtC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Task } from '../../models/run-context.model';
2
+ export declare const nxCloudDistributedTasksRunner: any;
3
+ export declare class TaskGraphCreator {
4
+ private readonly projectGraph;
5
+ private readonly defaultTargetDependencies;
6
+ constructor(projectGraph: any, defaultTargetDependencies: Record<string, any[]>);
7
+ createTaskGraph(tasks: Task[]): any;
8
+ private addTaskDependencies;
9
+ private addDependencies;
10
+ private findTask;
11
+ private addTaskToGraph;
12
+ }