diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /src/zennomad | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zennomad')
| -rw-r--r-- | src/zennomad/include/zennomad/nomadclient.h | 6 | ||||
| -rw-r--r-- | src/zennomad/include/zennomad/nomadprovisioner.h | 9 | ||||
| -rw-r--r-- | src/zennomad/nomadclient.cpp | 38 | ||||
| -rw-r--r-- | src/zennomad/nomadprocess.cpp | 2 | ||||
| -rw-r--r-- | src/zennomad/nomadprovisioner.cpp | 11 |
5 files changed, 60 insertions, 6 deletions
diff --git a/src/zennomad/include/zennomad/nomadclient.h b/src/zennomad/include/zennomad/nomadclient.h index 0a3411ace..cebf217e1 100644 --- a/src/zennomad/include/zennomad/nomadclient.h +++ b/src/zennomad/include/zennomad/nomadclient.h @@ -52,7 +52,11 @@ public: /** Build the Nomad job registration JSON for the given job ID and orchestrator endpoint. * The JSON structure varies based on the configured driver and distribution mode. */ - std::string BuildJobJson(const std::string& JobId, const std::string& OrchestratorEndpoint) const; + std::string BuildJobJson(const std::string& JobId, + const std::string& OrchestratorEndpoint, + const std::string& CoordinatorSession = {}, + bool CleanStart = false, + const std::string& TraceHost = {}) const; /** Submit a job via PUT /v1/jobs. On success, populates OutJob with the job info. */ bool SubmitJob(const std::string& JobJson, NomadJobInfo& OutJob); diff --git a/src/zennomad/include/zennomad/nomadprovisioner.h b/src/zennomad/include/zennomad/nomadprovisioner.h index 750693b3f..a8368e3dc 100644 --- a/src/zennomad/include/zennomad/nomadprovisioner.h +++ b/src/zennomad/include/zennomad/nomadprovisioner.h @@ -47,7 +47,11 @@ public: /** Construct a provisioner. * @param Config Nomad connection and job configuration. * @param OrchestratorEndpoint URL of the orchestrator that remote workers announce to. */ - NomadProvisioner(const NomadConfig& Config, std::string_view OrchestratorEndpoint); + NomadProvisioner(const NomadConfig& Config, + std::string_view OrchestratorEndpoint, + std::string_view CoordinatorSession = {}, + bool CleanStart = false, + std::string_view TraceHost = {}); /** Signals the management thread to exit and stops all tracked jobs. */ ~NomadProvisioner(); @@ -83,6 +87,9 @@ private: NomadConfig m_Config; std::string m_OrchestratorEndpoint; + std::string m_CoordinatorSession; + bool m_CleanStart = false; + std::string m_TraceHost; std::unique_ptr<NomadClient> m_Client; diff --git a/src/zennomad/nomadclient.cpp b/src/zennomad/nomadclient.cpp index 9edcde125..4bb09a930 100644 --- a/src/zennomad/nomadclient.cpp +++ b/src/zennomad/nomadclient.cpp @@ -58,7 +58,11 @@ NomadClient::Initialize() } std::string -NomadClient::BuildJobJson(const std::string& JobId, const std::string& OrchestratorEndpoint) const +NomadClient::BuildJobJson(const std::string& JobId, + const std::string& OrchestratorEndpoint, + const std::string& CoordinatorSession, + bool CleanStart, + const std::string& TraceHost) const { ZEN_TRACE_CPU("NomadClient::BuildJobJson"); @@ -94,6 +98,22 @@ NomadClient::BuildJobJson(const std::string& JobId, const std::string& Orchestra IdArg << "--instance-id=nomad-" << JobId; Args.push_back(std::string(IdArg.ToView())); } + if (!CoordinatorSession.empty()) + { + ExtendableStringBuilder<128> SessionArg; + SessionArg << "--coordinator-session=" << CoordinatorSession; + Args.push_back(std::string(SessionArg.ToView())); + } + if (CleanStart) + { + Args.push_back("--clean"); + } + if (!TraceHost.empty()) + { + ExtendableStringBuilder<128> TraceArg; + TraceArg << "--tracehost=" << TraceHost; + Args.push_back(std::string(TraceArg.ToView())); + } TaskConfig["args"] = Args; } else @@ -115,6 +135,22 @@ NomadClient::BuildJobJson(const std::string& JobId, const std::string& Orchestra IdArg << "--instance-id=nomad-" << JobId; Args.push_back(std::string(IdArg.ToView())); } + if (!CoordinatorSession.empty()) + { + ExtendableStringBuilder<128> SessionArg; + SessionArg << "--coordinator-session=" << CoordinatorSession; + Args.push_back(std::string(SessionArg.ToView())); + } + if (CleanStart) + { + Args.push_back("--clean"); + } + if (!TraceHost.empty()) + { + ExtendableStringBuilder<128> TraceArg; + TraceArg << "--tracehost=" << TraceHost; + Args.push_back(std::string(TraceArg.ToView())); + } TaskConfig["args"] = Args; } diff --git a/src/zennomad/nomadprocess.cpp b/src/zennomad/nomadprocess.cpp index 1ae968fb7..deecdef05 100644 --- a/src/zennomad/nomadprocess.cpp +++ b/src/zennomad/nomadprocess.cpp @@ -37,7 +37,7 @@ struct NomadProcess::Impl } CreateProcOptions Options; - Options.Flags |= CreateProcOptions::Flag_Windows_NewProcessGroup; + Options.Flags |= CreateProcOptions::Flag_NewProcessGroup; CreateProcResult Result = CreateProc("nomad" ZEN_EXE_SUFFIX_LITERAL, "nomad" ZEN_EXE_SUFFIX_LITERAL " agent -dev", Options); diff --git a/src/zennomad/nomadprovisioner.cpp b/src/zennomad/nomadprovisioner.cpp index 3fe9c0ac3..e07ce155e 100644 --- a/src/zennomad/nomadprovisioner.cpp +++ b/src/zennomad/nomadprovisioner.cpp @@ -14,9 +14,16 @@ namespace zen::nomad { -NomadProvisioner::NomadProvisioner(const NomadConfig& Config, std::string_view OrchestratorEndpoint) +NomadProvisioner::NomadProvisioner(const NomadConfig& Config, + std::string_view OrchestratorEndpoint, + std::string_view CoordinatorSession, + bool CleanStart, + std::string_view TraceHost) : m_Config(Config) , m_OrchestratorEndpoint(OrchestratorEndpoint) +, m_CoordinatorSession(CoordinatorSession) +, m_CleanStart(CleanStart) +, m_TraceHost(TraceHost) , m_ProcessId(static_cast<uint32_t>(zen::GetCurrentProcessId())) , m_Log(zen::logging::Get("nomad.provisioner")) { @@ -154,7 +161,7 @@ NomadProvisioner::SubmitNewJobs() ZEN_DEBUG("submitting job '{}' (estimated: {}, target: {})", JobId, m_EstimatedCoreCount.load(), m_TargetCoreCount.load()); - const std::string JobJson = m_Client->BuildJobJson(JobId, m_OrchestratorEndpoint); + const std::string JobJson = m_Client->BuildJobJson(JobId, m_OrchestratorEndpoint, m_CoordinatorSession, m_CleanStart, m_TraceHost); NomadJobInfo JobInfo; JobInfo.Id = JobId; |