LocalAI/core/services/nodes
LocalAI [bot] a39e025d64
fix(nodes): make per-node backend install async via gallery job queue (#9928)
* feat(galleryop): add TargetNodeID to ManagementOp for single-node installs

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(galleryop): add NodeScopedKey helpers for per-node opcache rows

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* refactor(galleryop): use strings.Cut for NodeScopedKey parsing, reject empty nodeID

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(nodes): scope DistributedBackendManager.InstallBackend to single node via TargetNodeID

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(http): make /api/nodes/:id/backends/install async via gallery service job queue

The handler previously called unloader.InstallBackend synchronously and
blocked the browser for up to 3 minutes waiting on the NATS reply. It now
enqueues a TargetNodeID-scoped ManagementOp on BackendGalleryChannel and
returns HTTP 202 + jobID immediately, matching /api/backends/install/:id.

The opcache key is built via NodeScopedKey(nodeID, backend) so concurrent
installs of the same backend across different nodes do not stomp each
other. galleryService/opcache/appConfig are threaded through
RegisterNodeAdminRoutes for this.

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* refactor(http): log malformed backend_galleries override and stop test drain goroutine

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(api): expose nodeID for node-scoped backend ops in /api/operations

Node-scoped backend installs land in opcache under "node:<nodeID>:<backend>"
keys. Without splitting that prefix back out, the operations panel renders
the full key as the display name and has no structured way to label which
worker an install is targeting. Detect the prefix, surface nodeID as its own
response field, and reduce the display name back to the bare backend slug.
Bare (non-scoped) ops are left untouched so legacy installs do not gain a
misleading empty nodeID.

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(react-ui): poll job status for node-targeted backend installs

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* fix(react-ui): make NodeInstallPicker state updates pure and surface cancellations as errors

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* refactor(react-ui): clarify async semantics in handleInstallOnTarget

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* refactor(http): use statusUrl casing for node install response to match codebase precedent

Assisted-by: Claude:opus-4-7 [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-21 22:25:53 +02:00
..
distributed_store.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
distributed_store_test.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
file_stager.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
file_stager_http.go feat: track files being staged (#9275) 2026-04-08 14:33:58 +02:00
file_stager_s3.go feat: track files being staged (#9275) 2026-04-08 14:33:58 +02:00
file_staging_client.go feat: wire transcription for llama.cpp, add streaming support (#9353) 2026-04-14 16:13:40 +02:00
file_transfer_server.go fix(distributed): worker container healthcheck always unhealthy 2026-04-27 13:51:57 +00:00
file_transfer_server_test.go feat(distributed): Avoid resending models to backend nodes (#9193) 2026-03-31 16:28:13 +02:00
health.go fix(distributed): cascade-clean stale node_models rows + filter routing by healthy status (#9754) 2026-05-13 21:57:50 +02:00
health_mock_test.go fix(distributed): cascade-clean stale node_models rows + filter routing by healthy status (#9754) 2026-05-13 21:57:50 +02:00
health_test.go fix(distributed): cascade-clean stale node_models rows + filter routing by healthy status (#9754) 2026-05-13 21:57:50 +02:00
inflight.go feat(distributed): support multiple replicas of one model on the same node (#9583) 2026-04-27 21:20:05 +02:00
inflight_test.go feat(realtime): Add Liquid Audio s2s model and assistant mode on talk page (#9801) 2026-05-13 21:57:27 +02:00
interfaces.go feat(concurrency-groups): per-model exclusive groups for backend loading (#9662) 2026-05-05 08:42:50 +02:00
managers_distributed.go fix(nodes): make per-node backend install async via gallery job queue (#9928) 2026-05-21 22:25:53 +02:00
managers_distributed_test.go fix(nodes): make per-node backend install async via gallery job queue (#9928) 2026-05-21 22:25:53 +02:00
model_router.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
model_router_test.go feat(concurrency-groups): per-model exclusive groups for backend loading (#9662) 2026-05-05 08:42:50 +02:00
nodes_suite_test.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
reconciler.go fix(distributed): split NATS backend.upgrade off install + dedup loads (#9717) 2026-05-08 16:24:54 +02:00
reconciler_test.go feat(distributed): support multiple replicas of one model on the same node (#9583) 2026-04-27 21:20:05 +02:00
registry.go fix(distributed): cascade-clean stale node_models rows + filter routing by healthy status (#9754) 2026-05-13 21:57:50 +02:00
registry_test.go fix(distributed): round-robin replicas of the same model (#9695) 2026-05-06 19:40:54 +02:00
router.go fix(distributed): split NATS backend.upgrade off install + dedup loads (#9717) 2026-05-08 16:24:54 +02:00
router_test.go fix(distributed): split NATS backend.upgrade off install + dedup loads (#9717) 2026-05-08 16:24:54 +02:00
staging_keys.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
staging_keys_test.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
staging_progress.go feat: track files being staged (#9275) 2026-04-08 14:33:58 +02:00
unloader.go fix(distributed): split NATS backend.upgrade off install + dedup loads (#9717) 2026-05-08 16:24:54 +02:00
unloader_test.go feat(distributed): support multiple replicas of one model on the same node (#9583) 2026-04-27 21:20:05 +02:00
unloader_upgrade_test.go fix(distributed): split NATS backend.upgrade off install + dedup loads (#9717) 2026-05-08 16:24:54 +02:00