Skip to content
Snippets Groups Projects
Commit 57f2abeb authored by Benjamin Wingfield's avatar Benjamin Wingfield
Browse files

fix job submission output and db update

parent b0740e51
No related branches found
No related tags found
No related merge requests found
use std::path::Path;
use std::process::Command; use std::process::Command;
use log::info; use log::info;
use rusqlite::Connection; use rusqlite::Connection;
...@@ -25,7 +26,7 @@ impl JobRequest { ...@@ -25,7 +26,7 @@ impl JobRequest {
info!("Updating {id} with slurm ID {slurm_id}"); info!("Updating {id} with slurm ID {slurm_id}");
conn conn
.execute("UPDATE job SET slurm_id = ? WHERE intervene_id = ?", .execute("UPDATE job SET slurm_id = ? WHERE intervene_id = ?",
&[&id, &slurm_id]) &[&slurm_id, &id])
.expect("Update"); .expect("Update");
Ok(()) Ok(())
...@@ -44,13 +45,16 @@ impl JobRequest { ...@@ -44,13 +45,16 @@ impl JobRequest {
} }
fn run_sbatch(&self, job_path: JobPath) -> String { 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 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); let cmd = sbatch.args(&arguments);
info!("Running sbatch process ");
info!("{:?}", &cmd); info!("{:?}", &cmd);
let output = cmd.output().expect("failed to execute process").stdout; let output = cmd.output().expect("failed to execute process").stdout;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment