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/zen/cmds/workspaces_cmd.cpp | |
| parent | bugfix release - v5.7.23 (#851) (diff) | |
| download | archived-zen-eba410c4168e23d7908827eb34b7cf0c58a5dc48.tar.xz archived-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/zen/cmds/workspaces_cmd.cpp')
| -rw-r--r-- | src/zen/cmds/workspaces_cmd.cpp | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/src/zen/cmds/workspaces_cmd.cpp b/src/zen/cmds/workspaces_cmd.cpp index 220ef6a9e..9e49b464e 100644 --- a/src/zen/cmds/workspaces_cmd.cpp +++ b/src/zen/cmds/workspaces_cmd.cpp @@ -127,14 +127,36 @@ WorkspaceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) std::vector<char*> SubCommandArguments; cxxopts::Options* SubOption = nullptr; int ParentCommandArgCount = GetSubCommand(m_Options, argc, argv, m_SubCommands, SubOption, SubCommandArguments); - if (!ParseOptions(ParentCommandArgCount, argv)) + + if (SubOption == nullptr) + { + if (!ParseOptions(ParentCommandArgCount, argv)) + { + return; + } + throw OptionParseException("'verb' option is required", m_Options.help()); + } + + // Parse subcommand permissively — forward unrecognised options to the parent parser. + std::vector<std::string> SubUnmatched; + if (!ParseOptionsPermissive(*SubOption, gsl::narrow<int>(SubCommandArguments.size()), SubCommandArguments.data(), SubUnmatched)) { return; } - if (SubOption == nullptr) + // Build parent arg list: original parent args (without subcommand name) + forwarded unmatched. + std::vector<char*> ParentArgs; + ParentArgs.reserve(static_cast<size_t>(ParentCommandArgCount - 1) + SubUnmatched.size()); + ParentArgs.push_back(argv[0]); + std::copy(argv + 1, argv + ParentCommandArgCount - 1, std::back_inserter(ParentArgs)); + for (std::string& Arg : SubUnmatched) { - throw OptionParseException("'verb' option is required", m_Options.help()); + ParentArgs.push_back(Arg.data()); + } + + if (!ParseOptions(static_cast<int>(ParentArgs.size()), ParentArgs.data())) + { + return; } m_HostName = ResolveTargetHostSpec(m_HostName); @@ -150,11 +172,6 @@ WorkspaceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) std::filesystem::path StatePath = m_SystemRootDir / "workspaces"; - if (!ParseOptions(*SubOption, gsl::narrow<int>(SubCommandArguments.size()), SubCommandArguments.data())) - { - return; - } - if (SubOption == &m_CreateOptions) { if (m_Path.empty()) @@ -376,14 +393,36 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** std::vector<char*> SubCommandArguments; cxxopts::Options* SubOption = nullptr; int ParentCommandArgCount = GetSubCommand(m_Options, argc, argv, m_SubCommands, SubOption, SubCommandArguments); - if (!ParseOptions(ParentCommandArgCount, argv)) + + if (SubOption == nullptr) + { + if (!ParseOptions(ParentCommandArgCount, argv)) + { + return; + } + throw OptionParseException("'verb' option is required", m_Options.help()); + } + + // Parse subcommand permissively — forward unrecognised options to the parent parser. + std::vector<std::string> SubUnmatched; + if (!ParseOptionsPermissive(*SubOption, gsl::narrow<int>(SubCommandArguments.size()), SubCommandArguments.data(), SubUnmatched)) { return; } - if (SubOption == nullptr) + // Build parent arg list: original parent args (without subcommand name) + forwarded unmatched. + std::vector<char*> ParentArgs; + ParentArgs.reserve(static_cast<size_t>(ParentCommandArgCount - 1) + SubUnmatched.size()); + ParentArgs.push_back(argv[0]); + std::copy(argv + 1, argv + ParentCommandArgCount - 1, std::back_inserter(ParentArgs)); + for (std::string& Arg : SubUnmatched) { - throw OptionParseException("'verb' option is required", m_Options.help()); + ParentArgs.push_back(Arg.data()); + } + + if (!ParseOptions(static_cast<int>(ParentArgs.size()), ParentArgs.data())) + { + return; } m_HostName = ResolveTargetHostSpec(m_HostName); @@ -403,11 +442,6 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** std::filesystem::path StatePath = m_SystemRootDir / "workspaces"; - if (!ParseOptions(*SubOption, gsl::narrow<int>(SubCommandArguments.size()), SubCommandArguments.data())) - { - return; - } - if (SubOption == &m_CreateOptions) { if (m_WorkspaceRoot.empty()) |