Skip to content

Commit f28ed09

Browse files
committed
CLI and library build with more optional inputs.
1 parent 434af56 commit f28ed09

File tree

8 files changed

+153
-76
lines changed

8 files changed

+153
-76
lines changed

src/cli/submit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn submit<W: Write>(
9292
for group in &groups {
9393
if !whole_groups.contains(group) {
9494
return Err(Box::new(row::Error::PartialGroupSubmission(
95-
action.name().clone(),
95+
action.name().into(),
9696
)));
9797
}
9898
}
@@ -231,7 +231,7 @@ pub fn submit<W: Write>(
231231
"[{}/{}] Submitting action '{}' on directory {}",
232232
HumanCount((index + 1) as u64),
233233
HumanCount(action_directories.len() as u64),
234-
style(action.name().clone()).blue(),
234+
style(action.name().to_string()).blue(),
235235
style(directories[0].display().to_string()).bold()
236236
);
237237
if directories.len() > 1 {

src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ pub enum Error {
105105
PostcardSerialize(PathBuf, #[source] postcard::Error),
106106

107107
// workflow errors
108-
#[error("Found duplicate action definition '{0}'.")]
109-
DuplicateAction(String),
110-
111108
#[error("Previous action '{0}' not found in action '{1}'.")]
112109
PreviousActionNotFound(String, String),
113110

src/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl Project {
252252
} else if self.state.is_submitted(action.name(), &directory_name) {
253253
status.submitted.push(directory_name);
254254
} else if action
255-
.previous_actions
255+
.previous_actions()
256256
.iter()
257257
.all(|a| completed[a].contains(&directory_name))
258258
{

src/scheduler/bash.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export ACTION_WALLTIME_IN_MINUTES="{}"
9999
self.cluster_name, self.action.name(), self.total_processes, self.walltime_in_minutes,
100100
);
101101

102-
if let Processes::PerDirectory(processes_per_directory) = self.action.resources.processes {
102+
if let Processes::PerDirectory(processes_per_directory) = self.action.resources.processes() {
103103
let _ = writeln!(
104104
result,
105105
"export ACTION_PROCESSES_PER_DIRECTORY=\"{processes_per_directory}\"",
@@ -158,16 +158,16 @@ trap 'printf %s\\n "${{directories[@]}}" | {row_executable} scan --no-progress -
158158
let contains_directories = self.action.command().contains("{directories}");
159159
if contains_directory && contains_directories {
160160
return Err(Error::ActionContainsMultipleTemplates(
161-
self.action.name().clone(),
161+
self.action.name().into(),
162162
));
163163
}
164164

165165
// Build up launcher prefix
166166
let mut launcher_prefix = String::new();
167167
let mut process_launchers = 0;
168-
for launcher in &self.action.launchers {
168+
for launcher in self.action.launchers() {
169169
let launcher = self.launchers.get(launcher).ok_or_else(|| {
170-
Error::LauncherNotFound(launcher.clone(), self.action.name().clone())
170+
Error::LauncherNotFound(launcher.clone(), self.action.name().into())
171171
})?;
172172
launcher_prefix
173173
.push_str(&launcher.prefix(&self.action.resources, self.directories.len()));
@@ -178,12 +178,12 @@ trap 'printf %s\\n "${{directories[@]}}" | {row_executable} scan --no-progress -
178178

179179
if self.total_processes > 1 && process_launchers == 0 {
180180
return Err(Error::NoProcessLauncher(
181-
self.action.name().clone(),
181+
self.action.name().into(),
182182
self.total_processes,
183183
));
184184
}
185185
if process_launchers > 1 {
186-
return Err(Error::TooManyProcessLaunchers(self.action.name().clone()));
186+
return Err(Error::TooManyProcessLaunchers(self.action.name().into()));
187187
}
188188

189189
if contains_directory {
@@ -207,7 +207,7 @@ done
207207
"#
208208
))
209209
} else {
210-
Err(Error::ActionContainsNoTemplate(self.action.name().clone()))
210+
Err(Error::ActionContainsNoTemplate(self.action.name().into()))
211211
}
212212
}
213213

@@ -283,7 +283,7 @@ impl Scheduler for Bash {
283283
},
284284
Some(code) => format!("exited with code {code}"),
285285
};
286-
return Err(Error::ExecuteAction(action.name().clone(), message));
286+
return Err(Error::ExecuteAction(action.name().into(), message));
287287
}
288288

289289
Ok(None)

src/scheduler/slurm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl Scheduler for Slurm {
190190
},
191191
Some(code) => format!("sbatch exited with code {code}"),
192192
};
193-
Err(Error::SubmitAction(action.name().clone(), message))
193+
Err(Error::SubmitAction(action.name().into(), message))
194194
}
195195
}
196196

src/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl State {
181181
// Ensure that completed has keys for all actions in the workflow.
182182
for action in &workflow.action {
183183
if !state.completed.contains_key(action.name()) {
184-
state.completed.insert(action.name().clone(), HashSet::new());
184+
state.completed.insert(action.name().into(), HashSet::new());
185185
}
186186
}
187187

@@ -527,7 +527,7 @@ impl State {
527527
/// Remove missing completed actions and directories.
528528
fn remove_missing_completed(&mut self, workflow: &Workflow) {
529529
let current_actions: HashSet<String> =
530-
workflow.action.iter().map(|a| a.name().clone()).collect();
530+
workflow.action.iter().map(|a| a.name().into()).collect();
531531

532532
let actions_to_remove: Vec<String> = self
533533
.completed
@@ -560,7 +560,7 @@ impl State {
560560
/// Remove missing submitted actions and directories.
561561
fn remove_missing_submitted(&mut self, workflow: &Workflow) {
562562
let current_actions: HashSet<String> =
563-
workflow.action.iter().map(|a| a.name().clone()).collect();
563+
workflow.action.iter().map(|a| a.name().into()).collect();
564564

565565
let actions_to_remove: Vec<String> = self
566566
.submitted

0 commit comments

Comments
 (0)