From 96d507a5eeb2103ef303421caae95c835df563cd Mon Sep 17 00:00:00 2001 From: chn Date: Thu, 29 May 2025 13:39:48 +0800 Subject: [PATCH] packages.sbatch-tui: allow set low priority --- packages/sbatch-tui/src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/sbatch-tui/src/main.cpp b/packages/sbatch-tui/src/main.cpp index 63a1a50d..40911951 100644 --- a/packages/sbatch-tui/src/main.cpp +++ b/packages/sbatch-tui/src/main.cpp @@ -19,6 +19,7 @@ int main() std::string CurrentInterface = "Program"; std::string JobName = std::filesystem::current_path().filename().string(); std::string OutputFile = "output.txt"; + bool LowPriority = false; } State; std::vector> Programs; auto ConfigFile = YAML::LoadFile(SBATCH_CONFIG); @@ -68,6 +69,7 @@ int main() Programs[State.ProgramSelected]->get_interface() | with_bottom_heavy, input(&State.JobName, "Job name: "), input(&State.OutputFile, "Output file: "), + checkbox("Low priority", &State.LowPriority), // 操作按钮 ftxui::Container::Horizontal ({ @@ -116,7 +118,8 @@ int main() { State.CurrentInterface = "Confirm"; State.SubmitCommand = Programs[State.ProgramSelected]->get_submit_command() - + "\n--job-name='{}' --output='{}'"_f(State.JobName, State.OutputFile); + + "\n--job-name='{}' --output='{}'{}"_f + (State.JobName, State.OutputFile, State.LowPriority ? " --nice=10000" : ""); } else std::unreachable(); }