about summary refs log tree commit diff
path: root/src/gemma.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gemma.rs')
-rw-r--r--src/gemma.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gemma.rs b/src/gemma.rs
index af5113a..42a7de9 100644
--- a/src/gemma.rs
+++ b/src/gemma.rs
@@ -532,10 +532,12 @@ fn chromosomes_in(snps_file: &str) -> Result<Vec<String>, GemmaError> {
 /// Backs `POST /compute/gemma/ravanan`.
 pub async fn compute_ravanan(
     ravanan_cmd: &str,
+    batch: &crate::config::RavananBatch,
     ccwl_cmd: &str,
     workflow_scm_path: &str,
     manifest_path: &str,
     cache_dir: &str,
+    scratch_dir: &str,
     genotype_file: &str,
     snps_file: &str,
     trait_values: &TraitValues,
@@ -634,13 +636,32 @@ pub async fn compute_ravanan(
     // on either side alone. Harmless to skip: it's optional, and this
     // code reads paths straight out of ravanan's own --store via its
     // stdout output record, never through --output-directory.
-    let args = vec![
+    // Backend switches: nothing for the default local runner, and
+    // --batch-system=slurm-api plus endpoint/JWT/partition/scratch for a
+    // cluster (see docs/ravanan-slurm.md). `scratch` is the cache dir
+    // unless configured otherwise: with slurm, ravanan stages each job's
+    // scratch there, and the compute nodes have to see the same path.
+    let scratch = if scratch_dir.is_empty() {
+        cache_dir
+    } else {
+        scratch_dir
+    };
+    let mut args = vec![
         store_arg.as_str(),
         manifest_arg.as_str(),
         compiled_workflow_arg.as_str(),
         inputs_yaml_arg.as_str(),
     ];
-    let ravanan_note = format!("ravanan: {ravanan_cmd} {}", args.join(" "));
+    let batch_args = batch.ravanan_args(scratch);
+    args.extend(batch_args.iter().map(String::as_str));
+    let ravanan_note = format!(
+        "ravanan ({ravanan_cmd}, {} backend): {}",
+        match batch {
+            crate::config::RavananBatch::SingleMachine => "single-machine",
+            crate::config::RavananBatch::SlurmApi { .. } => "slurm-api",
+        },
+        args.join(" ")
+    );
     let chromosomes_note = format!(
         "Scattered gemma-wrapper over {} chromosome(s) via CWL scatter \
          (--chromosomes/--no-parallel per job, so GNU parallel is never \