Skip to content

Commit

Permalink
Validate submit_whole.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 9, 2024
1 parent 6bb2793 commit 57e5927
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 11 additions & 2 deletions src/cli/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ pub fn submit<W: Write>(
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));
}

Expand Down Expand Up @@ -136,8 +147,6 @@ pub fn submit<W: Write>(
return Ok(());
}

// TODO: Validate submit_whole

if args.dry_run {
let scheduler = project.scheduler();
info!("Would submit the following scripts...");
Expand Down
9 changes: 3 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 57e5927

Please sign in to comment.