diff options
| author | Stefan Boberg <[email protected]> | 2026-03-18 11:19:10 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-18 11:19:10 +0100 |
| commit | eba410c4168e23d7908827eb34b7cf0c58a5dc48 (patch) | |
| tree | 3cda8e8f3f81941d3bb5b84a8155350c5bb2068c /src/zenserver | |
| parent | bugfix release - v5.7.23 (#851) (diff) | |
| download | zen-eba410c4168e23d7908827eb34b7cf0c58a5dc48.tar.xz zen-eba410c4168e23d7908827eb34b7cf0c58a5dc48.zip | |
Compute batching (#849)
### Compute Batch Submission
- Consolidate duplicated action submission logic in `httpcomputeservice` into a single `HandleSubmitAction` supporting both single-action and batch (actions array) payloads
- Group actions by queue in `RemoteHttpRunner` and submit as batches with configurable chunk size, falling back to individual submission on failure
- Extract shared helpers: `MakeErrorResult`, `ValidateQueueForEnqueue`, `ActivateActionInQueue`, `RemoveActionFromActiveMaps`
### Retracted Action State
- Add `Retracted` state to `RunnerAction` for retry-free rescheduling — an explicit request to pull an action back and reschedule it on a different runner without incrementing `RetryCount`
- Implement idempotent `RetractAction()` on `RunnerAction` and `ComputeServiceSession`
- Add `POST jobs/{lsn}/retract` and `queues/{queueref}/jobs/{lsn}/retract` HTTP endpoints
- Add state machine documentation and per-state comments to `RunnerAction`
### Compute Race Fixes
- Fix race in `HandleActionUpdates` where actions enqueued between session abandon and scheduler tick were never abandoned, causing `GetActionResult` to return 202 indefinitely
- Fix queue `ActiveCount` race where `NotifyQueueActionComplete` was called after releasing `m_ResultsLock`, allowing callers to observe stale counters immediately after `GetActionResult` returned OK
### Logging Optimization and ANSI improvements
- Improve `AnsiColorStdoutSink` write efficiency — single write call, dirty-flag flush, `RwLock` instead of `std::mutex`
- Move ANSI color emission from sink into formatters via `Formatter::SetColorEnabled()`; remove `ColorRangeStart`/`End` from `LogMessage`
- Extract color helpers (`AnsiColorForLevel`, `StripAnsiSgrSequences`) into `helpers.h`
- Strip upstream ANSI SGR escapes in non-color output mode. This enables colour in log messages without polluting log files with ANSI control sequences
- Move `RotatingFileSink`, `JsonFormatter`, and `FullFormatter` from header-only to pimpl with `.cpp` files
### CLI / Exec Refactoring
- Extract `ExecSessionRunner` class from ~920-line `ExecUsingSession` into focused methods and a `ExecSessionConfig` struct
- Replace monolithic `ExecCommand` with subcommand-based architecture (`http`, `inproc`, `beacon`, `dump`, `buildlog`)
- Allow parent options to appear after subcommand name by parsing subcommand args permissively and forwarding unmatched tokens to the parent parser
### Testing Improvements
- Fix `--test-suite` filter being ignored due to accumulation with default wildcard filter
- Add test suite banners to test listener output
- Made `function.session.abandon_pending` test more robust
### Startup / Reliability Fixes
- Fix silent exit when a second zenserver instance detects a port conflict — use `ZEN_CONSOLE_*` for log calls that precede `InitializeLogging()`
- Fix two potential SIGSEGV paths during early startup: guard `sentry_options_new()` returning nullptr, and throw on `ZenServerState::Register()` returning nullptr instead of dereferencing
- Fail on unrecognized zenserver `--mode` instead of silently defaulting to store
### Other
- Show host details (hostname, platform, CPU count, memory) when discovering new compute workers
- Move frontend `html.zip` from source tree into build directory
- Add format specifications for Compact Binary and Compressed Buffer wire formats
- Add `WriteCompactBinaryObject` to zencore
- Extended `ConsoleTui` with additional functionality
- Add `--vscode` option to `xmake sln` for clangd / `compile_commands.json` support
- Disable compute/horde/nomad in release builds (not yet production-ready)
- Disable unintended `ASIO_HAS_IO_URING` enablement
- Fix crashpad patch missing leading whitespace
- Clean up code triggering gcc false positives
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/compute/computeserver.cpp | 16 | ||||
| -rw-r--r-- | src/zenserver/frontend/html/compute/compute.html | 6 | ||||
| -rw-r--r-- | src/zenserver/frontend/html/compute/hub.html | 7 | ||||
| -rw-r--r-- | src/zenserver/frontend/html/compute/orchestrator.html | 7 | ||||
| -rw-r--r-- | src/zenserver/frontend/html/util/sanitize.js | 9 | ||||
| -rw-r--r-- | src/zenserver/main.cpp | 5 | ||||
| -rw-r--r-- | src/zenserver/xmake.lua | 10 |
7 files changed, 24 insertions, 36 deletions
diff --git a/src/zenserver/compute/computeserver.cpp b/src/zenserver/compute/computeserver.cpp index 724ef9ad2..d1875f41a 100644 --- a/src/zenserver/compute/computeserver.cpp +++ b/src/zenserver/compute/computeserver.cpp @@ -721,21 +721,7 @@ ZenComputeServer::InitializeOrchestratorWebSocket() return; } - // Convert http://host:port → ws://host:port/orch/ws - std::string WsUrl = m_CoordinatorEndpoint; - if (WsUrl.starts_with("http://")) - { - WsUrl = "ws://" + WsUrl.substr(7); - } - else if (WsUrl.starts_with("https://")) - { - WsUrl = "wss://" + WsUrl.substr(8); - } - if (!WsUrl.empty() && WsUrl.back() != '/') - { - WsUrl += '/'; - } - WsUrl += "orch/ws"; + std::string WsUrl = HttpToWsUrl(m_CoordinatorEndpoint, "/orch/ws"); ZEN_INFO("establishing WebSocket link to orchestrator at {}", WsUrl); diff --git a/src/zenserver/frontend/html/compute/compute.html b/src/zenserver/frontend/html/compute/compute.html index 66c20175f..c07bbb692 100644 --- a/src/zenserver/frontend/html/compute/compute.html +++ b/src/zenserver/frontend/html/compute/compute.html @@ -6,6 +6,7 @@ <title>Zen Compute Dashboard</title> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script> <link rel="stylesheet" type="text/css" href="../zen.css" /> + <script src="../util/sanitize.js"></script> <script src="../theme.js"></script> <script src="../banner.js" defer></script> <script src="../nav.js" defer></script> @@ -456,11 +457,6 @@ }); // Helper functions - function escapeHtml(text) { - var div = document.createElement('div'); - div.textContent = text; - return div.innerHTML; - } function formatBytes(bytes) { if (bytes === 0) return '0 B'; diff --git a/src/zenserver/frontend/html/compute/hub.html b/src/zenserver/frontend/html/compute/hub.html index 32e1b05db..620349a2b 100644 --- a/src/zenserver/frontend/html/compute/hub.html +++ b/src/zenserver/frontend/html/compute/hub.html @@ -4,6 +4,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="../zen.css" /> + <script src="../util/sanitize.js"></script> <script src="../theme.js"></script> <script src="../banner.js" defer></script> <script src="../nav.js" defer></script> @@ -62,12 +63,6 @@ const BASE_URL = window.location.origin; const REFRESH_INTERVAL = 2000; - function escapeHtml(text) { - var div = document.createElement('div'); - div.textContent = text; - return div.innerHTML; - } - function showError(message) { document.getElementById('error-container').innerHTML = '<div class="error">Error: ' + escapeHtml(message) + '</div>'; diff --git a/src/zenserver/frontend/html/compute/orchestrator.html b/src/zenserver/frontend/html/compute/orchestrator.html index a519dee18..d1a2bb015 100644 --- a/src/zenserver/frontend/html/compute/orchestrator.html +++ b/src/zenserver/frontend/html/compute/orchestrator.html @@ -4,6 +4,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="../zen.css" /> + <script src="../util/sanitize.js"></script> <script src="../theme.js"></script> <script src="../banner.js" defer></script> <script src="../nav.js" defer></script> @@ -128,12 +129,6 @@ const BASE_URL = window.location.origin; const REFRESH_INTERVAL = 2000; - function escapeHtml(text) { - var div = document.createElement('div'); - div.textContent = text; - return div.innerHTML; - } - function showError(message) { document.getElementById('error-container').innerHTML = '<div class="error">Error: ' + escapeHtml(message) + '</div>'; diff --git a/src/zenserver/frontend/html/util/sanitize.js b/src/zenserver/frontend/html/util/sanitize.js new file mode 100644 index 000000000..1b0f32e38 --- /dev/null +++ b/src/zenserver/frontend/html/util/sanitize.js @@ -0,0 +1,9 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +// Shared utility functions for compute dashboard pages. + +function escapeHtml(text) { + var div = document.createElement('div'); + div.textContent = text; + return div.innerHTML; +} diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index 26ae85ae1..9d786c209 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -319,6 +319,11 @@ main(int argc, char* argv[]) { ServerMode = kTest; } + else if (argv[1][0] != '-') + { + fprintf(stderr, "unknown mode '%s'. Available modes: hub, store, compute, proxy, test\n", argv[1]); + return 1; + } } switch (ServerMode) diff --git a/src/zenserver/xmake.lua b/src/zenserver/xmake.lua index fe279ebb2..b619c5548 100644 --- a/src/zenserver/xmake.lua +++ b/src/zenserver/xmake.lua @@ -19,7 +19,7 @@ target("zenserver") add_headerfiles("**.h") add_rules("utils.bin2c", {extensions = {".zip"}}) add_files("**.cpp") - add_files("frontend/html.zip") + add_files("$(buildir)/frontend/html.zip") add_files("zenserver.cpp", {unity_ignored = true }) if is_plat("linux") and not (get_config("toolchain") or ""):find("clang") then @@ -84,7 +84,8 @@ target("zenserver") on_load(function(target) local html_dir = path.join(os.projectdir(), "src/zenserver/frontend/html") - local zip_path = path.join(os.projectdir(), "src/zenserver/frontend/html.zip") + local zip_dir = path.join(os.projectdir(), get_config("buildir") or "build", "frontend") + local zip_path = path.join(zip_dir, "html.zip") -- Check if zip needs regeneration local need_update = not os.isfile(zip_path) @@ -100,18 +101,19 @@ target("zenserver") if need_update then print("Regenerating frontend zip...") + os.mkdir(zip_dir) os.tryrm(zip_path) import("detect.tools.find_7z") local cmd_7z = find_7z() if cmd_7z then - os.execv(cmd_7z, {"a", "-mx0", zip_path, path.join(html_dir, ".")}) + os.execv(cmd_7z, {"a", "-mx0", "-bso0", zip_path, path.join(html_dir, ".")}) else import("detect.tools.find_zip") local zip_cmd = find_zip() if zip_cmd then local oldir = os.cd(html_dir) - os.execv(zip_cmd, {"-r", "-0", zip_path, "."}) + os.execv(zip_cmd, {"-r", "-0", "-q", zip_path, "."}) os.cd(oldir) else raise("Unable to find a suitable zip tool (need 7z or zip)") |