diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-22 10:53:07 +0000 |
|---|---|---|
| committer | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-22 10:53:07 +0000 |
| commit | ca32dd4c8c64f8fa5ed18b30fe2594dbe9f5ad98 (patch) | |
| tree | d30e44fba06f4bae6716a054846e867c9e2c0097 | |
| parent | 58de629953a75daad50daca795465784d37c7359 (diff) | |
| download | genenetwork4-ca32dd4c8c64f8fa5ed18b30fe2594dbe9f5ad98.tar.gz | |
gemma: the store step runs gemma-wrapper's geno2mdb binary, not python
The converter became an Odin binary in gemma-wrapper e244f99 and is packaged in
guix-bioinformatics (built in the package, installed as bin/geno2mdb). This
switches the store workflow to it: no interpreter, no python-lmdb, no
PYTHONPATH in the job, which is what the python version cost this deployment
twice -- a hand-exported PYTHONPATH on the API host and three python packages
in the artifact manifest.
Three things had to change, each of them measured:
- `store.scm` runs `#:run "geno2mdb"` and no longer takes the script as a File
input. ccwl appends every declared input to the command line, so a staged copy
of the binary arrived as argv[1] and geno2mdb read its own ELF header as the
BIMBAM file ("16 genotypes, expected 14, line 1").
- the server stops supplying `store_script`; the pre-flight input check named
the disagreement, as designed.
- artifact runs keep GUIX_PACKAGE_PATH set. Clearing it saved ~4 s of Guile per
run, but the artifact manifest now names gemma-wrapper, which only exists in
the channel: cleared, the job died with "gemma-wrapper: unknown package"
before reading a marker. Correctness over four seconds, and the artifact memo
means most requests never pay it.
Verified on a cold artifact path (BXD.8, impute=mean, engine=pangemma):
artifacts built in 19,263 ms, 41 cluster jobs (prepare + store + 19 kinship + 20
gwa), workflow 14,793 ms, 21,056 rows. The packaged binary was earlier checked
to produce a store identical to bin/geno2mdb.py's, on BXD.8 and on the 3.9 GB
HSNIH-Palmer_true panel.
| -rw-r--r-- | cwl/gemma/manifest-artifacts.scm | 7 | ||||
| -rw-r--r-- | cwl/gemma/store.scm | 17 | ||||
| -rw-r--r-- | src/gemma.rs | 22 | ||||
| -rw-r--r-- | src/routes/gemma.rs | 12 |
4 files changed, 32 insertions, 26 deletions
diff --git a/cwl/gemma/manifest-artifacts.scm b/cwl/gemma/manifest-artifacts.scm index 8a8eb07..c4d248d 100644 --- a/cwl/gemma/manifest-artifacts.scm +++ b/cwl/gemma/manifest-artifacts.scm @@ -10,7 +10,9 @@ ;; r-minimal + r-qtl2: `hmm' runs qtl2-impute-bimbam.R (maxmarg on the cross's ;; genotype probabilities). r-qtl2 propagates r-qtl, r-rcpp, r-jsonlite and ;; r-data-table, so nothing else is listed. -;; python + python-numpy + python-lmdb: geno2mdb.py, which writes the store. +;; gemma-wrapper: its bin/geno2mdb, the store writer (Odin, no interpreter). +;; python and its packages are kept only for the R-side helpers; the store step +;; no longer needs them. ;; ;; ravanan sets these packages' search paths (PYTHONPATH among them) inside the ;; job, so `python3' here finds numpy and lmdb without any wrapper script -- @@ -22,4 +24,5 @@ ;; silently. (specifications->manifest (list "bash" "coreutils" "gawk" "r-minimal" "r-qtl2" - "python" "python-numpy" "python-lmdb")) + "python" "python-numpy" "python-lmdb" + "gemma-wrapper")) diff --git a/cwl/gemma/store.scm b/cwl/gemma/store.scm index 6a60628..5b01a6f 100644 --- a/cwl/gemma/store.scm +++ b/cwl/gemma/store.scm @@ -17,19 +17,22 @@ ;; but exact only for integer calls (0/1/2 -> 0/127/254). (define store (command - #:inputs (store_script #:type File) - (genotype_file #:type File) + #:inputs (genotype_file #:type File) (snps_file #:type File) - #:run "python3" store_script genotype_file + ;; geno2mdb is a binary now (gemma-wrapper e244f99, built in Odin), so the + ;; step runs it from the job's profile: no interpreter, no python-lmdb, no + ;; PYTHONPATH. It is *not* an input any more -- ccwl appends every input to + ;; the command line, and a staged copy of the binary came out as argv[1], + ;; which geno2mdb then read as the BIMBAM file ("16 genotypes, expected 14", + ;; from its own ELF header). + #:run "geno2mdb" genotype_file ("--snps" snps_file) ("--format" "Gf") ("--out" "genotypes.mdb") #:outputs (store #:type File #:binding ((glob . "genotypes.mdb"))))) -(workflow ((store_script #:type File) - (genotype_file #:type File) +(workflow ((genotype_file #:type File) (snps_file #:type File)) - (store #:store_script store_script - #:genotype_file genotype_file + (store #:genotype_file genotype_file #:snps_file snps_file)) diff --git a/src/gemma.rs b/src/gemma.rs index 2188530..58d1d53 100644 --- a/src/gemma.rs +++ b/src/gemma.rs @@ -1738,18 +1738,16 @@ pub async fn run_artifact( ]; let batch_args = run.batch.ravanan_args(scratch); args.extend(batch_args.iter().map(String::as_str)); - // With GUIX_PACKAGE_PATH cleared: these manifests name only `(gnu - // packages)` specs (bash, gawk, R/qtl2, python), and leaving the channel - // path set makes guix autoload guix-bioinformatics' module tree for every - // invocation -- an ABI mismatch warning per module and about four seconds - // of Guile per ravanan call (measured: 12.0 s with, 7.9 s without). - let output = streaming::run_streaming_with_env( - run.ravanan_cmd, - &args, - None, - &[("GUIX_PACKAGE_PATH", "")], - ) - .await + // GUIX_PACKAGE_PATH stays set. Clearing it saves ~4 s of Guile per + // artifact call (guix autoloads guix-bioinformatics' module tree, one ABI + // mismatch warning per module) -- but a manifest may name a package that + // only exists in the channel, which is exactly what happened when the store + // step moved to gemma-wrapper's geno2mdb: with the variable cleared the + // job died with "gemma-wrapper: unknown package" before a single marker was + // read. Correctness over four seconds, and the artifact memo means most + // requests never pay it at all. + let output = streaming::run_streaming(run.ravanan_cmd, &args, None) + .await .map_err(|error| GemmaError::Spawn { command: run.ravanan_cmd.to_string(), error, diff --git a/src/routes/gemma.rs b/src/routes/gemma.rs index 548c464..96a0fb2 100644 --- a/src/routes/gemma.rs +++ b/src/routes/gemma.rs @@ -614,11 +614,13 @@ async fn ravanan_artifacts( .unwrap_or_default(), ) } else { + // No converter script: geno2mdb comes from the job's profile + // (gemma-wrapper's bin/geno2mdb, an Odin binary), and ccwl appends + // every declared input to the command line -- a staged copy of the + // binary arrived as argv[1] and was read as the BIMBAM file. let inputs = format!( - "store_script: {{class: File, path: {}}}\n\ - genotype_file: {{class: File, path: {genotype_file}}}\n\ - snps_file: {{class: File, path: {snps_file}}}\n", - absolute(&config.geno2mdb_cmd), + "genotype_file: {{class: File, path: {genotype_file}}}\n\ + snps_file: {{class: File, path: {snps_file}}}\n" ); let run = gemma::ArtifactWorkflow { label: "store", @@ -632,7 +634,7 @@ async fn ravanan_artifacts( }; let outputs = gemma::run_artifact( &run, - &["store_script", "genotype_file", "snps_file"], + &["genotype_file", "snps_file"], &inputs, &["store"], ) |
