From 57f2abeb27f72491f5dea9ff80cb87c353b6eb15 Mon Sep 17 00:00:00 2001 From: Benjamin Wingfield <bwingfield@ebi.ac.uk> Date: Mon, 26 Jun 2023 17:53:22 +0100 Subject: [PATCH] fix job submission output and db update --- src/db/job/update.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/db/job/update.rs b/src/db/job/update.rs index b4c82c1..447c54b 100644 --- a/src/db/job/update.rs +++ b/src/db/job/update.rs @@ -1,3 +1,4 @@ +use std::path::Path; use std::process::Command; use log::info; use rusqlite::Connection; @@ -25,7 +26,7 @@ impl JobRequest { info!("Updating {id} with slurm ID {slurm_id}"); conn .execute("UPDATE job SET slurm_id = ? WHERE intervene_id = ?", - &[&id, &slurm_id]) + &[&slurm_id, &id]) .expect("Update"); Ok(()) @@ -44,13 +45,16 @@ impl JobRequest { } fn run_sbatch(&self, job_path: JobPath) -> String { - let wd = job_path.path.parent().unwrap().to_str().unwrap(); + let wd = job_path.path.parent().unwrap(); + let output_path = wd.join(Path::new("%j.out")); + let output_str = output_path.to_str().unwrap(); + info!("Output path: {output_str}"); let job_script_path = job_path.path.to_str().unwrap(); - let arguments = vec!["--parsable", job_script_path]; - let mut sbatch = Command::new("/usr/bin/sbatch"); + let arguments = vec!["--parsable", "--output", output_str, job_script_path]; + + let mut sbatch = Command::new("sbatch"); let cmd = sbatch.args(&arguments); - info!("Running sbatch process "); info!("{:?}", &cmd); let output = cmd.output().expect("failed to execute process").stdout; -- GitLab