nx 22.7.0-beta.12 → 22.7.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schemas/nx-schema.json +25 -0
- package/dist/schemas/project-schema.json +25 -0
- package/dist/src/adapter/ngcli-adapter.js +11 -12
- package/dist/src/command-line/daemon/daemon.js +8 -4
- package/dist/src/command-line/graph/graph.js +8 -1
- package/dist/src/command-line/show/show-target/utils.js +4 -3
- package/dist/src/command-line/yargs-utils/shared-options.js +5 -1
- package/dist/src/config/nx-json.d.ts +3 -1
- package/dist/src/config/workspace-json-project-json.d.ts +2 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +10 -3
- package/dist/src/daemon/client/client.js +21 -31
- package/dist/src/daemon/client/daemon-environment.d.ts +4 -0
- package/dist/src/daemon/client/daemon-environment.js +119 -0
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +2 -5
- package/dist/src/daemon/client/daemon-socket-messenger.js +1 -1
- package/dist/src/daemon/message-types/daemon-message.d.ts +6 -0
- package/dist/src/daemon/message-types/daemon-message.js +6 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +1 -1
- package/dist/src/daemon/server/handle-hash-tasks.js +1 -1
- package/dist/src/daemon/server/handle-outputs-tracking.d.ts +4 -4
- package/dist/src/daemon/server/handle-outputs-tracking.js +11 -11
- package/dist/src/daemon/server/outputs-tracking.d.ts +18 -3
- package/dist/src/daemon/server/outputs-tracking.js +49 -22
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +2 -1
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +20 -4
- package/dist/src/daemon/server/server.js +71 -40
- package/dist/src/executors/run-commands/running-tasks.js +2 -3
- package/dist/src/executors/run-script/run-script.impl.js +16 -8
- package/dist/src/hasher/hash-task.d.ts +9 -1
- package/dist/src/hasher/hash-task.js +41 -14
- package/dist/src/hasher/native-task-hasher-impl.d.ts +1 -1
- package/dist/src/hasher/native-task-hasher-impl.js +4 -6
- package/dist/src/hasher/task-hasher.d.ts +20 -9
- package/dist/src/hasher/task-hasher.js +34 -6
- package/dist/src/native/index.d.ts +34 -7
- package/dist/src/native/native-bindings.js +1 -1
- package/dist/src/native/nx.wasi-browser.js +0 -1
- package/dist/src/native/nx.wasi.cjs +0 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/utils/register.js +83 -4
- package/dist/src/project-graph/error-types.js +31 -11
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +9 -0
- package/dist/src/project-graph/plugins/isolation/message-types.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +9 -0
- package/dist/src/project-graph/plugins/isolation/messaging.js +2 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +36 -68
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +6 -0
- package/dist/src/tasks-runner/cache.d.ts +6 -0
- package/dist/src/tasks-runner/cache.js +58 -0
- package/dist/src/tasks-runner/init-tasks-runner.js +13 -7
- package/dist/src/tasks-runner/run-command.js +13 -5
- package/dist/src/tasks-runner/task-env.js +17 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +79 -7
- package/dist/src/tasks-runner/task-orchestrator.js +327 -120
- package/dist/src/tasks-runner/tasks-schedule.d.ts +5 -2
- package/dist/src/tasks-runner/tasks-schedule.js +31 -17
- package/dist/src/tasks-runner/utils.d.ts +3 -3
- package/dist/src/tasks-runner/utils.js +5 -6
- package/package.json +12 -12
- package/dist/src/daemon/client/exec-is-server-available.d.ts +0 -1
- package/dist/src/daemon/client/exec-is-server-available.js +0 -11
- package/dist/src/daemon/client/generate-help-output.d.ts +0 -1
- package/dist/src/daemon/client/generate-help-output.js +0 -26
|
@@ -25,6 +25,7 @@ export declare class TaskOrchestrator {
|
|
|
25
25
|
private taskDetails;
|
|
26
26
|
private cache;
|
|
27
27
|
private readonly tuiEnabled;
|
|
28
|
+
private readonly projects;
|
|
28
29
|
private forkedProcessTaskRunner;
|
|
29
30
|
private runningTasksService;
|
|
30
31
|
private tasksSchedule;
|
|
@@ -34,6 +35,7 @@ export declare class TaskOrchestrator {
|
|
|
34
35
|
private processedTasks;
|
|
35
36
|
private completedTasks;
|
|
36
37
|
private waitingForTasks;
|
|
38
|
+
private pendingDiscreteWorkers;
|
|
37
39
|
private groups;
|
|
38
40
|
private continuousTasksStarted;
|
|
39
41
|
private bailed;
|
|
@@ -48,16 +50,50 @@ export declare class TaskOrchestrator {
|
|
|
48
50
|
constructor(hasher: TaskHasher, initiatingProject: string | undefined, initiatingTasks: Task[], projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: NxArgs & DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient, outputStyle: string, taskGraphForHashing?: TaskGraph);
|
|
49
51
|
init(): Promise<void>;
|
|
50
52
|
run(): Promise<{
|
|
51
|
-
[
|
|
53
|
+
[k: string]: TaskStatus;
|
|
52
54
|
}>;
|
|
53
55
|
nextBatch(): Batch;
|
|
54
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Coordinator loop. All batch operations (hashing, cache resolution)
|
|
58
|
+
* happen on this single thread — no races. Cache misses are dispatched
|
|
59
|
+
* as fire-and-forget workers. Workers signal completion via
|
|
60
|
+
* scheduleNextTasksAndReleaseThreads which wakes all waiting loops.
|
|
61
|
+
*
|
|
62
|
+
* Safety: the dispatch phase (step 5) is fully synchronous — no
|
|
63
|
+
* worker can run during it. So all tasks picked up by nextTask()
|
|
64
|
+
* are guaranteed to be in processedTasks from step 1.
|
|
65
|
+
*/
|
|
66
|
+
private executeCoordinatorLoop;
|
|
55
67
|
private executeContinuousTaskLoop;
|
|
56
|
-
private processTasks;
|
|
57
68
|
private processTask;
|
|
58
69
|
processAllScheduledTasks(): void;
|
|
59
70
|
private applyCachedResults;
|
|
60
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Batch cache lookup + filter to successful entries. Handles both
|
|
73
|
+
* local (one rarray SQL call) and remote (parallel HTTP retrievals)
|
|
74
|
+
* inside DbCache.getBatch.
|
|
75
|
+
*/
|
|
76
|
+
private fetchCacheHits;
|
|
77
|
+
/**
|
|
78
|
+
* For each confirmed cache hit: decide whether to copy outputs from
|
|
79
|
+
* the cache (skipping if the on-disk outputs already match the
|
|
80
|
+
* recorded hash), copy in parallel, derive the task status, print
|
|
81
|
+
* terminal output, and return the assembled results.
|
|
82
|
+
*/
|
|
83
|
+
private finalizeCacheHits;
|
|
84
|
+
/**
|
|
85
|
+
* Coordinator wrapper around {@link resolveCachedTasks}: peeks at
|
|
86
|
+
* scheduledTasks (without removing anything from the schedule),
|
|
87
|
+
* filters to cacheable hashed discrete candidates, and delegates the
|
|
88
|
+
* cache fetch + lifecycle to the public method. Returns true if any
|
|
89
|
+
* tasks were resolved.
|
|
90
|
+
*
|
|
91
|
+
* The coordinator relies on this running unconditionally (when cache
|
|
92
|
+
* is enabled): tasks dispatched in step 5 via runTaskDirectly skip
|
|
93
|
+
* their own cache lookup on the assumption that this has already
|
|
94
|
+
* confirmed them as misses. Don't add length-based bails.
|
|
95
|
+
*/
|
|
96
|
+
private resolveCachedTasksBulk;
|
|
61
97
|
/**
|
|
62
98
|
* Hash all batch tasks and resolve cache hits topologically.
|
|
63
99
|
*
|
|
@@ -70,7 +106,43 @@ export declare class TaskOrchestrator {
|
|
|
70
106
|
private hashBatchTasks;
|
|
71
107
|
applyFromCacheOrRunBatch(doNotSkipCache: boolean, batch: Batch, groupId: number): Promise<TaskResult[]>;
|
|
72
108
|
private runBatch;
|
|
73
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Bulk-resolve cache hits for a set of tasks: fetch cached entries,
|
|
111
|
+
* copy outputs as needed, fire lifecycle, and return the TaskResults
|
|
112
|
+
* for the hits. Tasks that aren't in the cache (or aren't cacheable)
|
|
113
|
+
* are silently omitted from the return value — callers are responsible
|
|
114
|
+
* for running those via {@link runTaskDirectly}.
|
|
115
|
+
*
|
|
116
|
+
* Fires scheduleTask lifecycle for hits that haven't been through
|
|
117
|
+
* processAllScheduledTasks yet. That's a coordinator gap-filler and
|
|
118
|
+
* a no-op for callers that pre-process the schedule.
|
|
119
|
+
*
|
|
120
|
+
* The caller provides `groupId` — cache hits share one slot since they
|
|
121
|
+
* don't actually compete for parallelism.
|
|
122
|
+
*/
|
|
123
|
+
resolveCachedTasks(doNotSkipCache: boolean, tasks: Task[], groupId: number): Promise<TaskResult[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Fire a discrete-task worker and track it in pendingDiscreteWorkers until
|
|
126
|
+
* it settles. Uses runTaskDirectly (not applyFromCacheOrRun*) because
|
|
127
|
+
* resolveCachedTasksBulk already confirmed this task is a cache miss —
|
|
128
|
+
* another lookup would re-query the DB and (for Nx Cloud users) repeat
|
|
129
|
+
* the remote HTTP retrieval.
|
|
130
|
+
*/
|
|
131
|
+
private dispatchDiscreteWorker;
|
|
132
|
+
/**
|
|
133
|
+
* Route a worker rejection (e.g. remote cache errors) through the normal
|
|
134
|
+
* failure path instead of letting it become an unhandled promise. Guard
|
|
135
|
+
* against double-finalize: completeTasks() populates `completedTasks`,
|
|
136
|
+
* so a rejection arriving after postRunSteps has already finalized the
|
|
137
|
+
* task must not run postRunSteps again.
|
|
138
|
+
*/
|
|
139
|
+
private handleDiscreteWorkerFailure;
|
|
140
|
+
/**
|
|
141
|
+
* Spawn and wait on a task's child process, unconditionally — no cache
|
|
142
|
+
* lookup. Callers must have already confirmed the task is a cache miss
|
|
143
|
+
* (or disabled caching entirely).
|
|
144
|
+
*/
|
|
145
|
+
runTaskDirectly(doNotSkipCache: boolean, task: Task, groupId: number): Promise<TaskResult>;
|
|
74
146
|
private runTask;
|
|
75
147
|
private runTaskInForkedProcess;
|
|
76
148
|
startContinuousTask(task: Task, groupId: number): Promise<RunningTask | SharedRunningTask>;
|
|
@@ -91,8 +163,8 @@ export declare class TaskOrchestrator {
|
|
|
91
163
|
private shouldCacheTaskResult;
|
|
92
164
|
private closeGroup;
|
|
93
165
|
private openGroup;
|
|
94
|
-
private
|
|
95
|
-
private
|
|
166
|
+
private shouldCopyOutputsFromCacheBatch;
|
|
167
|
+
private recordOutputsHashBatch;
|
|
96
168
|
private handleContinuousTaskExit;
|
|
97
169
|
private completeContinuousTask;
|
|
98
170
|
private cleanup;
|