diff options
| author | Pjotr <wrk@bosa.lan> | 2026-10-24 09:33:40 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-24 09:33:40 +0000 |
| commit | a7ffb1cfecbdb8ac3fcc6286d7a09f7285c95d67 (patch) | |
| tree | 1cb865784d901fad979aed32694b77474019468d /src/gemma.rs | |
| parent | cda325b6334ef36e3f49501cfd77d68a7bd6a295 (diff) | |
| download | genenetwork4-a7ffb1cfecbdb8ac3fcc6286d7a09f7285c95d67.tar.gz | |
gemma: Make ravanan's batch system configurable (optional Slurm).
POST /compute/gemma/ravanan used to run every CWL step locally, because compute_ravanan never passed ravanan a batch system. Add a RavananBatch setting: - RAVANAN_BATCH_SYSTEM=single-machine (default) or slurm-api, failing closed on anything else, exactly like GN4_DB_MODE; - slurm-api adds --batch-system=slurm-api, --slurm-api-endpoint, --slurm-jwt (a *file*, which is what ravanan reads) and, when set, --slurm-partition/--slurm-nice; a slurm selection without an endpoint or a JWT file refuses to start rather than 502-ing every request; - --scratch defaults to ravanan_cache_dir for slurm, so the store and the job scratch space live on the same shared filesystem (with slurm that directory has to be visible to the compute nodes); - the response's ravanan note records which backend ran. The switch building is RavananBatch::ravanan_args so it is unit testable; compute_ravanan takes the backend and the scratch directory, and the route passes them from config. docs/ravanan-slurm.md documents the keys, the shared-directory requirement, and the slurm-side auth wiring (AuthType=auth/munge + AuthAltTypes=auth/jwt with SLURM_JWT in slurmrestd's environment) that makes REST-submitted jobs actually run.
Diffstat (limited to 'src/gemma.rs')
| -rw-r--r-- | src/gemma.rs | 25 |
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 \ |
