From 57e5927f3d4af391e1ed355de5f21d3c8e854a1e Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 9 May 2024 16:24:40 -0400 Subject: [PATCH] Validate submit_whole. --- src/cli/submit.rs | 13 +++++++++++-- src/lib.rs | 9 +++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cli/submit.rs b/src/cli/submit.rs index 91d0a58..bb07528 100644 --- a/src/cli/submit.rs +++ b/src/cli/submit.rs @@ -86,6 +86,17 @@ pub fn submit( let status = project.separate_by_status(action, matching_directories)?; let groups = project.separate_into_groups(action, status.eligible)?; + if action.group.submit_whole { + let whole_groups = + project.separate_into_groups(action, project.state().list_directories())?; + for group in &groups { + if !whole_groups.contains(group) { + return Err(Box::new(row::Error::PartialGroupSubmission( + action.name.clone(), + ))); + } + } + } action_groups.push((&action, groups)); } @@ -136,8 +147,6 @@ pub fn submit( return Ok(()); } - // TODO: Validate submit_whole - if args.dry_run { let scheduler = project.scheduler(); info!("Would submit the following scripts..."); diff --git a/src/lib.rs b/src/lib.rs index 353aedc..12ff797 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,18 +192,15 @@ pub enum Error { #[error("There are submitted jobs. Rerun with --force to bypass this check.")] ForceCleanNeeded, + #[error("Attempting partial submission of action '{0}' when `submit_whole=true`.")] + PartialGroupSubmission(String), + // thread errors #[error("Unexpected error communicating between threads in 'find_completed_directories'.")] CompletedDirectoriesSend(#[from] mpsc::SendError<(PathBuf, String)>), #[error("Unexpected error communicating between threads in 'read_values'.")] ReadValuesSend(#[from] mpsc::SendError<(PathBuf, Value)>), - // evalexpr errors - // #[error("Invalid number {0}")] - // InvalidNumber(String), - - // #[error("Evalexpr error: {0}")] - // Evalexpr(#[from] EvalexprError), } impl MultiProgressContainer {