| Age | Commit message (Collapse) | Author |
|
`POST /compute/gemma` now takes a single slot: one job runs at a time
across all callers, a second submission from the same token is refused
immediately with `409 compute_busy` (whatever it would have waited for,
its own job is already in the way), and a submission from another token
waits for the running job and then runs. Nothing else is gated -- ravanan
and /compute/rqtl are untouched.
The gate is one `tokio::sync::Semaphore(1)` (fair: waiters take the
permit in arrival order) plus a `Mutex<HashSet<String>>` of subjects
holding the slot or queued for it, in a per-process static. The claim is
moved into the spawned job task, so a client disconnect -- which does not
kill the child process -- cannot hand the slot to somebody else while the
CPU is still busy.
The endpoint carries none of that: `#[compute_gate(gemma, run_id =
params.id.as_deref())]` expands to a claim and a run, and requires the
handler to take `Ctx` and `AuthToken` (every compute endpoint is
token-only, and the token's sub is the key), so an endpoint that is not
token-gated cannot be decorated. The policy -- the 409's status, code,
wording and next link -- stays in plain Rust (`Gate::claim_or_busy`), so
the gate's own tests cover it; the attribute is decoration over two calls.
* src/compute_gate.rs: new. Gate, Claim (released on drop, including a
panic), Busy, claim/claim_or_busy/run, and four tests, two of them on a
four-thread runtime (the earlier ones ran single-threaded and so never
exercised the cross-thread hand-off; one now asserts at most one task
inside the slot across eight tasks).
* gnauth-macros/src/lib.rs: the `compute_gate` attribute, alongside the
`gnauth` markers it shares `syn`/`quote` with; arguments documented
(gate, endpoint, status, run_id) for the endpoints still to be gated.
* src/routes/gemma.rs: the decorator replaces 57 lines of claim and
spawn plumbing in compute_gemma.
* docs/www/ai-instruction.md (4a, 5): one job at a time per caller, and
that a `compute_busy` 409 means poll, not resubmit.
|
|
* README.md (Running with cargo): "This deployment runs two instances:
3000 (production) and 3001 (development)" -- the table of ports, binaries
and cache directories, both start-up invocations, and why the caches are
separate while the database, index and auth stub are shared. Also notes
that in-memory state is per instance, so the dev server is not a capacity
test of production.
* docs/www/ai-instruction.md:
- /version now described honestly: git (with -dirty), dirty,
source_digest, database reachable/unreachable -- and that
`unreachable` means stop and report, not retry in a loop.
- error table: 413 (plain text, not the JSON object: over the 64 MiB
body limit), 500 database_error with a connection-loss detail is
transient (retry once), and 409 run_id_in_use pointing at the status
endpoint.
- covariates: case_attribute is the smallest form (nothing posted),
which is also the answer to a 413 from sending a value per individual.
|
|
A caller posting a mapping result back to /plot/rqtl -- or a compute
request carrying a value per individual plus covariates -- was refused
with `413 Failed to buffer the request body: length limit exceeded`. That
is axum's DefaultBodyLimit, 2 MiB, which nothing here had raised: a real
GEMMA run on the BXD WGS panel is ~1.9 MB, so the plot endpoints sat just
under the cap and anything bigger (a genome-sized run, or every animal's
covariate value) fell over it. nginx's 10m was never the binding limit.
* src/lib.rs (BODY_LIMIT_BYTES): 64 MiB, with the reasoning and the note
that a proxy has to allow as much or it refuses first.
* etc/nginx-vesuvio.pu.ac.ke.conf, docs/nginx.md: client_max_body_size
64m, so the two limits agree instead of the proxy cutting in at 10m.
* README.md ("Request body size"): both caps, and that a request does not
need to be large -- `{"case_attribute": "Sex"}` has the server read the
attribute and align it, where posting a value per animal is pure payload.
Verified: the 11.9 MB body that was refused now returns an SVG; 67 MB
still gets axum's 413.
|
|
Every database-backed endpoint 500'd with `CodecError { IO error: Broken
pipe }` while the process answered /version quite happily. The cause was
ours: `pool()` turns off the driver's `check_health` (a ping at checkout,
dead connections replaced) to save a round trip -- sound against a
database 130 ms away, worth nothing against loopback, and it costs the
pool its self-healing. One server-side close of an idle session then
becomes one failed request per dead socket: ten in a row, until a
restart.
* src/db.rs: `SQL_CHECK_HEALTH` (default true) decides the ping;
`is_connection_loss` recognises the errors that mean the peer went away
(broken pipe, reset, went away, lost connection, closed);
`forget_pool` drops the cached pool so the next call rebuilds it;
`health` probes reachability, cached ten seconds. One pool static shared
by pool()/forget_pool (they had drifted into two).
* src/error.rs (ApiError::from_db): on a connection loss, forget the pool
-- the one place every database error passes through, so recovery does
not depend on each caller.
* src/lib.rs (/version): `"database": "reachable" | "unreachable"`; a
service that answers while nothing behind it works is now visible.
* src/config.rs: the switch, with the trade written down.
* tests/db_recovery.rs: kills every pooled session from a second
connection, then asserts the next twelve requests all succeed -- the
scenario that produced the outage, now a regression test.
* tests/...: unit test for the classifier (its own IO error text and the
"this is a bad query, do not retry" cases).
* README.md ("Database connections"), docs/www/operator-checklist.md:
the knob, why it defaults on, and what /version reports.
|
|
R/qtl has always been able to fit covariates; the API now passes them
through. `covariates` takes one or more specs, each either a case
attribute of the group by name -- which the server reads, aligns onto the
panel and codes -- or explicit per-sample numbers:
{"case_attribute": "Sex"}
{"case_attribute": "Diet", "map": {"HFD": 0, "LFD": 1}}
{"name": "age_days", "kind": "numerical", "values": [...]}
The coding is the server's job because the phenotype file is numeric:
text with 2-20 levels is coded 0..k-1 in sorted order and declared
`categorical` (the wrapper dummy-expands more than two levels), numeric
text goes through as `numerical`, and one level, more than 20 levels, or
an explicit map that misses a value is a 422 asking for a map rather than
an invented ordering. An attribute the group does not define is a 422
that lists the ones it has. Missing values become `x`/NA and R/qtl drops
those individuals.
Everything that decides the model goes into the cache key -- covariate
names *and* kinds, since a categorical covariate's dummy expansion is not
the same model as a numeric one -- and the response says what happened:
Covariate Sex: categorical coded F=0, M=1, 3281 of 3281 samples have a
value, 3281 with both the trait and the covariate
Measured on BXD-Longevity AgeAtDeath (3281 animals, WGS panel, 21056
markers): LOD 23.100 without the covariate, 23.522 with Sex, same peak
(rs30847416, chr 1, 5.0 Mb), ~15s more for the covariate run.
* src/rqtl.rs (Covariate, CovariateKind, code_case_attribute,
write_covarstruct_file): the coding rules, the extra pheno columns, the
covarstruct file, `--addcovar --covarstruct`, and the model's cache key;
five unit tests.
* src/routes/rqtl.rs (RqtlCovariate): the request shape, resolution
through the group's case attributes, duplicate/limit/ambiguity checks
(8 covariates at most), and the per-covariate note.
* tests/rqtl.rs: a real covariate run on UM-HET3 (894 markers, so the
test stays a test) asserting the coding note and the `--addcovar` line,
plus the unknown-attribute 422.
* README.md, docs/www/ai-instruction.md (4a): how to pass them, and that
the note's coding and complete-case count are the things to read.
|
|
The trait-values endpoint stays about trait values; a covariate needs the
study's metadata for the same samples, aligned the same way. So:
GET /groups/{group}/traits/{trait_id}/case-attributes/{attribute}
returns one attribute's values for exactly that trait's samples, **in the
trait's own order**, which is what makes it usable without the caller
re-sorting anything:
/groups/BXD-Longevity/traits/10001/case-attributes/Sex
-> 3281 values in AgeAtDeath's order, F x 3101, M x 180
-> order identical to /traits/10001/values (asserted in the tests)
Alongside the values it reports `distinct` (each value with its count,
commonest first) and `num_values`. That is the check that decides whether
an attribute can serve as a covariate at all -- a constant one cannot --
and it saves a second request just to find out.
Attributes are per group, so an unknown one is a 404 whose `next` is the
group's attribute list: BXD has no Sex, BXD-Longevity does.
* src/db.rs (get_trait_case_attribute, get_group_trait_samples): the
group's attribute values aligned onto the trait's sample list, joining
CaseAttribute/CaseAttributeXRefNew on (InbredSetId, CaseAttributeId) as
the group endpoint does; empty text is reported as no value.
* src/routes/groups.rs: the handler, token-gated, with the response
shapes and the two `next` links (the trait's values, the group's
attributes).
* tests/case_attributes.rs: alignment against an independent /values
response, `distinct` accounting, ordering, and the 404s for BXD (no Sex)
and for a non-existent attribute.
* README.md, docs/www/ai-instruction.md (3. Case attributes): the
endpoint, and "ask per trait rather than sorting the group's attributes
yourself".
|
|
The §3 table had one line for /groups/{group}/case-attributes and nothing
else, so an assistant could find the endpoint and still not use it: the
response shape, the fact that the values are free text (`"Sex": "F"`,
`"Status": "Live"`), that `strain` is the group's mapping unit rather
than always a strain line, that which attributes exist is a property of
the study (BXD has no Sex; BXD-Longevity and eight other BXD-family
studies do), and that a published trait is the easier source when the
study has one.
Written around the worked case we settled on: AgeAtDeath in
BXD-Longevity, sex per animal available as a case attribute or as trait
10010 (1.0/0.0), and why that covariate matters there -- it varies
within the panel and has its own QTL (LRS 76 at rs13481466).
* docs/www/ai-instruction.md (3. What you can read): "Case attributes",
ahead of Search, matching the table's order.
|
|
The plot endpoints ran the mapping themselves, which meant the picture
could come from a different run than the one the caller was looking at,
and cost a scan to draw. They now take the mapping's own response -- the
JSON /compute/{rqtl,gemma} returned, posted back -- and hand it straight
to the plotter, which is what the scripts were written for
(`python3 plot-rqtl.py result.json -o out.svg --trait …`).
Validation replaces the run: `/plot/rqtl` needs `data.markers` with
positional 4+ column rows, `/plot/gemma` needs `data` rows *and*
`meta.columns` (its plotter reads the column names to find `p_lrt`), and
anything else is a 422 saying "post that response back". `/plot/rqtl`
also accepts just the `data` member; GEMMA cannot, and says why.
The mapping's `actions` suggestion now describes posting its own response
and carries no body -- duplicating a 21 000-row response into a
suggestion would double the envelope for nothing, and the caller already
holds it.
* src/routes/plot.rs: posted result, shape validation, `?trait`/`?title`
and `?bonferroni=false` passthrough to the scripts; no compute imports.
* src/routes/{rqtl,gemma}.rs: the plot suggestion loses its body.
* tests/plot.rs: canned results instead of real mappings -- the tests now
need only the plotter, no Rscript or gemma; covers both engines, the
bare-`data` form, and the 422 for a body that is a request.
* README.md, docs/www/ai-instruction.md (4a), docs/www/operator-checklist.md:
"post the response back", and why GEMMA needs `meta.columns`.
|
|
The two plotters Pjotr added (scripts/plot-rqtl.py, plot-gemma.py) turn a
saved mapping response into an SVG Manhattan panel. They are now
endpoints, and the mapping that produces the response suggests them:
POST /plot/rqtl same body as /compute/rqtl -> image/svg+xml
POST /plot/gemma same body as /compute/gemma -> image/svg+xml
Taking the mapping's own body rather than the mapping's output means one
call gets you the picture, and the plot cannot describe a run you did not
do: the handlers call the compute handlers and hand the resulting
envelope to the script, exactly as the scripts' docstrings describe
(they read `data.markers`, `data.permutation` and the notes' strain
counts). The mapping is re-run, but through the engines' own caches --
seconds on BXD.
The reply is an SVG, not the JSON envelope: an image is not JSON, and the
plotter's one-line peak summary rides back in `x-plot-summary` so a
caller that cannot see the picture still learns where the peak is.
Both compute responses gain the matching suggestion: `actions` carries
"the same request, plotted" (built from the request that ran, like the
permutation suggestion), so an assistant can map, look, and only then
decide whether the peak is worth the 100-permutation run.
* src/plot.rs: run the configured script over the envelope, read the
SVG back, clean up; a missing script is a 502 naming interpreter and
script, not a panic.
* src/routes/plot.rs: the two handlers (token-gated), delegating to
compute_rqtl/compute_gemma so validation and alignment stay in one
place; `x-plot-summary` sanitised into a header.
* src/routes/{rqtl,gemma}.rs: the plot suggestion, before the
permutation one.
* src/config.rs: PLOT_PYTHON, RQTL_PLOTTER, GEMMA_PLOTTER.
* tests/plot.rs: the suggestion resolves to a complete SVG with a peak
summary, and an invalid mapping request is the mapping's own 422.
* tests/{rqtl,phewas}.rs: find suggestions by href rather than position.
* README.md, docs/www/ai-instruction.md (4a), docs/www/operator-checklist.md
(new "Plotting": python3 must be on the server's PATH).
|
|
A scan gives LOD scores; the thresholds that make them readable come from
permuting the phenotype, which R/qtl supports (nperm) and this API
already ran -- but nothing told a caller to run it. So an unpermuted
R/qtl scan now ends with the same scan at nperm=100 in `actions` (a POST,
so not a `next` link), rebuilt from what actually ran: group + version +
the caller's own named samples, or the genotype file. The description
says what the thresholds are for and that it costs about 100 scans.
GEMMA is the honest half: it has no permutation test, and this endpoint
passes it nothing that would create one, so there is no nperm to suggest.
Its response says so in a note -- judge a peak against the smallest
p_lrt, not a genome-wide threshold -- and its `actions` suggests the
R/qtl permutation run over the same group and values instead. That is
real and runnable rather than a flag that would do nothing.
(gemma-wrapper does have `--permutate n`, which shuffles the phenotype
file and writes a permutation-stats file; wiring it up is a separate
job -- docs/genotypes.md and the README say it is not passed.)
* src/routes/rqtl.rs: the nperm=100 suggestion when nperm was 0, built
from the request that ran (original named samples, not the aligned
panel-length vector -- thousands of entries on a real panel).
* src/routes/gemma.rs: the note, and the cross-engine suggestion.
* tests/rqtl.rs: a path-based scan's suggestion reuses the same files.
* tests/phewas.rs: a group-scoped scan suggests both -- the PheWAS in
`next` (resolved) and the permutation run in `actions`.
* README.md, docs/www/ai-instruction.md (4a): what thresholds are, that
R/qtl offers them and GEMMA does not, and what to do about it.
|
|
A mapping's job is not finished when the rows come back: the next two
questions are "what else peaks here?" and "show me". So a group-scoped
mapping response now ends with both --
- `next`: `/groups/{group}/phewas?locus=<peak>&window=10000`, the peak
being the strongest LOD (R/qtl, column 4) or the smallest p_lrt (GEMMA,
last column). A GET that resolves 200, which is what `next` promises;
measured: R/qtl's peak rs48756159 -> 3 traits, GEMMA's
rsm10000005700 -> 12.
- a note saying which two columns to plot: chr against LOD (R/qtl) or
against -log10 of p_lrt (GEMMA). Rows are positional with meta.columns
naming them, so plotting needs no reshaping -- the API does not render
images, and saying exactly what to plot is more useful than pretending
to.
Path-based requests get neither: without a `group` there is no group to
PheWAS over, and the note alone would be noise.
* src/rqtl.rs, src/gemma.rs (peak_marker): strongest LOD / smallest
p_lrt, with unit tests for both shapes and the empty cases.
* src/routes/{rqtl,gemma}.rs: the `next` link and the plot note, when the
request named a group.
* docs/www/ai-instruction.md: 4b rewritten around what a reader does with
a PheWAS -- where the position comes from (a mapping's `next`, a
trait's `locus`, or chr+mb), the parameter table, what a hit contains,
and how to read it (the 460 LRS cap, `traits: []` versus `markers: []`,
peak-only and published-only limits, several traits on one marker),
with the chr 9 example; 4a points at the new forward.
|
|
PublishXRef records the marker each published trait's QTL peaks at
(Locus) with its LRS, which is a PheWAS waiting to happen: fix a
position, find the markers within a window of it, and ask which traits
peak at those markers.
GET /groups/{group}/phewas?locus=rs30524230&window=10000
GET /groups/{group}/phewas?chr=9&mb=29.940961&window=10000
The window is in base pairs, centred, default 10 kb either side -- the
"10K up and downstream" case. Positions come from the group's genotype
marker table (the endpoint added last round), so `genotype_version`
selects whose markers define the window and the answer reports them
alongside the traits: an empty `traits` list is then readable as
"nothing peaks that close" rather than a failure, and a ten-times wider
window is offered as `next`.
Measured on real data, ±10 kb around rs30524230 (chr 9, 29.94 Mb, a BXD
QTL peak at LRS 460): 4 markers, 10 traits, from LOD 99.9 down to 2.68 --
ANPEP_band, then microbiome/haematology/infectious-disease traits. That
cluster of 99.9s is the 460 LRS cap, not a spectrum, which the notes say.
* src/db.rs (get_phewas_traits): PublishXRef rows for a set of peak
markers, joining Phenotype/Publication through the existing
trait_info_sql, strongest first; marker names are re-validated before
they reach the IN list.
* src/routes/phewas.rs: the endpoint, token-gated; window/centre
validation (422 for none or negative), 404 for an unknown locus, notes
for the empty cases, and a unit test for the version/group helper.
* tests/phewas.rs: markers in the window, traits sorted by LRS with
lod = lrs/4.604, every hit peaking at a listed marker, zero-width window,
the two failure modes, and that the suggested wider window resolves.
* README.md, docs/www/ai-instruction.md (new 4b: how to read a PheWAS),
docs/www/operator-checklist.md: the endpoint and its reading.
|
|
*tests/envelope.rs* uses /version as its example of a response whose
`notes` is an empty array; adding a note there broke that check for no
gain -- the fields document themselves, and tests/version.rs asserts
their shape.
* src/lib.rs (version): drop the with_note, with a comment saying why.
|
|
* README.md (/version): the example carries dirty/source_digest/branch,
and the prose says why a stamp can lag a commit -- a binary built from a
dirty tree must not claim that commit -- and that build.rs re-stamps on
a commit because it watches the ref, not just .git/HEAD.
* docs/www/ai-instruction.md: comparing against a clone means comparing
the part before "-dirty", with source_digest for the exact build.
* tests/version.rs: `dirty` mirrors the suffix, branch is non-empty, and
source_digest is 16 hex digits or unknown.
|
|
/version reported 4831e5a while HEAD had moved on to 18d18b1: the stamp
is written at build time and build.rs only declared .git/HEAD, which
keeps saying "ref: refs/heads/main" across commits, so a rebuild after a
commit reused the old hash. It now declares the ref file and the index
as well, which is what actually makes a rebuild re-stamp.
Three additions make the stamp trustworthy rather than merely newer:
- `-dirty` when the working tree had uncommitted changes at build time,
so a binary built pre-commit can never claim to be that commit;
- `source_digest`, a hash over the compiled source files, which tells
apart two builds of the same commit -- or of the same dirty tree --
where a commit hash cannot;
- `branch`, so a detached HEAD is visible.
* build.rs: watch .git/HEAD, the ref it points at, and .git/index;
stamp dirty, digest and branch as well as the hash and commit date.
* src/lib.rs (VersionInfo): the three new fields, plus a note saying a
stamp is never advanced by committing without rebuilding.
|
|
The listing named versions but not files; a caller could pick one and
still not see what was in it. Three token-gated routes now describe a
version completely, short of the matrix:
GET /groups/{group}/genotypes versions, files, sizes, current
GET /groups/{group}/genotypes/{version} file name, header labels,
individuals, strains, chromosomes
GET /groups/{group}/genotypes/{version}/markers markers (name, chr, cM, Mb), paged
The detail reads the file's own `@`-labels (type, mat, pat, het, unk,
scale) and its panel in column order, and reports both the whole panel
and the strains a mapping uses after the parents/F1s rule -- so a caller
can check a request before sending it and interpret a result after.
Markers come back as positional rows with `meta.columns`, paged with
`?page`/`?limit` and filterable with `?chr`, following /compute/gemma's
shape rather than inventing one.
The genotype calls stay on the server: file_meta() reads the matrix to
skip it, and nothing returns a cell.
* src/genotypes.rs (Marker, FileMeta, file_meta; GenotypeFile::file):
header labels, individuals and marker positions; unit test.
* src/routes/genotypes.rs: the two new handlers, token-gated like the
listing, plus `file` in the listing and counts in the detail.
* tests/genotypes.rs: the listing carries file names but no paths.
* README.md, docs/genotypes.md, docs/www/ai-instruction.md: what the
three routes give, and that the matrix is not among them.
|
|
Until now /compute/{rqtl,gemma} took server paths, so the caller had to
know the deployment's layout, pick a version, and expand a trait's values
onto the panel in the file's order -- none of which the API told it. The
listing endpoint and the group-scoped request remove all three:
GET /groups/{group}/genotypes versions, newest first, no paths
POST /compute/rqtl {group, [genotype_version], samples}
POST /compute/gemma {group, [genotype_version], samples}
The resolver (src/genotypes.rs) applies GeneNetwork2's rule -- the
group's genotype/<Group>.json `genofile` list is newest-first and its
first entry is current; groups with no JSON (HET3-ITP) fall back to the
highest version number, and the listing's notes say which happened --
reads the panel from the .geno header the way GN3 does, and excludes
parents and F1s by default (GN2's `incparentsf1` off, GN3's
`get_sample_list(inc_par=False, inc_f1=False)`).
Excluding them has to subset the genotype matrix, not null-fill the
values: a null keeps an individual out of the fit but not out of GEMMA's
kinship or R/qtl's cross. So `prepare` writes a panel-subset file under
the engine's cache directory, keyed by panel, and reuses it.
Nothing in the listing or the mapping response carries a path: the
endpoint reports versions and sizes, and `notes` names the resolved
version, the panel size and how many values aligned. Explicit
`genotype_file`/`snps_file` remain as an override for files outside the
layout, and the two request shapes are mutually exclusive (422).
* src/genotypes.rs: new. Discovery, resolution, panel parse, parent/F1
exclusion, subset preparation, name alignment; 10 unit tests.
* src/routes/genotypes.rs: new endpoint, with a test that its list has no
path or file name in it.
* src/routes/{rqtl,gemma}.rs: group + genotype_version +
include_parents_f1; named `samples` aligned server-side; notes record
what resolved. gemma also accepts named samples where it used to insist
on positional trait_values.
* src/suggest.rs: suggestions from /groups/{group}/traits/{id}/values now
carry `group` and no placeholders; the dataset-scoped ones keep the
placeholder and say to add the group.
* src/routes/groups.rs: the group record points at /genotypes.
* src/config.rs: GENOTYPE_FILES (default the gn4-data directory).
* tests/genotypes.rs: new integration test (skips without the directory).
* README.md, docs/genotypes.md, docs/www/*: the flow is now "ask for the
versions, map by group" -- measured runs, the parent/F1 rule, the
subsetting requirement, and the restart list unchanged.
|
|
Paths travel in the request and no panel is cached in-process; both
engines key their caches on file contents (rqtl hashes the genotype file
into the output name, gemma-wrapper hashes into its kinship cache), so a
changed file is recomputed rather than silently reused.
The restart list is the useful half: new binary, GENENETWORK4_TEST_TOKEN
(decided when the router is built), and the environment fixed at first
use -- PATH/R_LIBS_SITE for R, SQL_URI's pool, the Xapian handle -- while
edits to scripts/rqtl_wrapper.R take effect immediately, since it runs
per request.
* docs/genotypes.md: "No restart is needed to use a new genotype file".
|
|
Asked whether the BXD mappings ran GN2/GN3's default (no parents, no
F1s): they did not. BXD.8's panel is 198 RI strains + 37 F1s and no
parent columns at all, and the runs passed all 235 with `null` for the
F1s -- phenotypes right, but GEMMA's kinship and R/qtl's cross spanning
235 individuals instead of 198.
Measured on trait 10001, both engines, both panels: identical answers
(GEMMA p 5.9e-07 at rsm10000005700 chr 8, R/qtl LOD 2.9320 at
rs48756159 chr 8), so nothing published from those runs is wrong. The
lesson is that null-filling excludes an individual from the fit but not
from the model; excluding it means subsetting the genotype file.
* docs/genotypes.md: "Parents and F1s are excluded by default" -- the
GN2 (`incparentsf1`) and GN3 (`get_sample_list(inc_par=False,
inc_f1=False)`) mechanisms, what each panel actually holds, the
both-ways measurement, and the rule for the alignment work.
* docs/www/ai-instruction.md (4a), docs/www/operator-checklist.md: the
same, in a sentence and a paragraph respectively.
|
|
docs/genotypes.md explained the convention; the endpoint docs still left
a caller guessing which file to pass and how big the panel is. So:
* README.md (/compute/gemma): GEMMA wants the BIMBAM pair
`genotype/bimbam/<file>_geno.txt` + `<file>_snps.txt`, not the `.geno`
file; `trait_values` is one entry per individual in that file's column
order; BXD's current panel stated (235 x 21056), with the 17.1 s
measurement against the 19 s the 7 320-marker fixtures take.
* README.md (/compute/rqtl): the file is `genotype/<file>.geno`
(BXD.8: 235 x 21057; HET3-ITP.12: 6447 x 894), `MappingMethodId`
decides the engine, and the two measured runs with the UM-HET3 peak.
* README.md (/compute/gemma/ravanan): same input convention as gemma.
* docs/genotypes.md: how each measurement was made, step by step, so
they can be repeated; and that step 3 (expanding values onto the panel)
is the API's job in the next iteration.
* docs/www/ai-instruction.md (4a): a table of the BXD files per engine
with panel sizes, the UM-HET3 file, "ask the operator for any other
panel" with where GN2 records which one is current, and the measured
times. Values must be one per individual, in file order -- position, not
name -- and the API does not re-index yet, so a mapping is prepared for
the caller rather than guessed.
* docs/www/operator-checklist.md: MappingMethodId per group, and the
three measurements.
|
|
The compute endpoints take server-side paths, so callers need to know
the deployment's genotype-file layout and which version is current --
neither of which is discoverable from this repository, and both of which
are spread across GN2 and GN3 (GN2's per-group genotype/<Group>.json
whose `genofile` list is newest-first and is the actual authority -- the
GenoFile table still lists only the classic files; GEMMA fed from
genotype/bimbam/<file>_geno.txt, R/qtl from genotype/<file>.geno; GN3
reading the sample order out of the .geno header; InbredSet.
MappingMethodId deciding which engine a group offers).
Measured on this deployment, with the newest genotypes and values
re-indexed onto each panel's sample order:
BXD BXD.8.geno (WGS Mar2022) GEMMA 17.1s 21055 rows
BXD BXD.8.geno R/qtl 7.5s 21056 markers
HET3-ITP.12 (Apr2023, 6447 individuals) R/qtl 83.1s 893 markers,
lifespan peak LOD 7.95 at 1_24042124 (chr1, 24.04 Mb)
That last run is the shape of what Rob Williams wants: UM-HET3 is a
4-way cross (MappingMethodId=3, R/qtl), and its genotype files are
versioned per cohort with no JSON recording which is current, and no
per-cohort trait split -- 6438 of lifespan's 23879 animal values fall in
the .12 panel, the rest are silently dropped. Recorded as the known
messiness rather than hidden.
* docs/genotypes.md: new. Layout, how GN2/GN3 choose, the alignment
rule, per-group engines, the measurements, what is still messy.
* README.md: pointer.
* docs/www/operator-checklist.md: replace "only the test fixtures exist"
with the real panels, and name the missing alignment step.
|
|
Asked to map a 9-strain trait, the wrapper scanned it against the
6-individual fixture cross and returned six markers with LOD scores and
`state: complete` -- a plausible answer belonging to nobody. R recycled
and truncated the values silently, and nothing downstream could tell.
GeneNetwork3's copy of this script has the same hole.
The cross-file format carries no per-sample names, so the count is the
only check available; order remains the caller's responsibility (and the
reason values and genotype file must come from the same panel). With the
check, the same request is a 502 rqtl_failed quoting both counts, and the
correctly-shaped request still returns the documented LODs.
* scripts/rqtl_wrapper.R: compare the pheno file's rows with nind() of
the cross, and stop.
* README.md (/compute/rqtl): the second fix relative to gn3, and what
stays the caller's job.
* docs/www/ai-instruction.md (4a): values and genotypes must describe the
same individuals, one for one, in the same order.
* docs/www/operator-checklist.md (Compute): what genotype files actually
exist on this box (test fixtures, 198 BXD individuals) and why a database
trait, with its own strain subset, cannot be mapped against them.
|
|
Fetching one trait's value per strain is usually the step before mapping
that trait, and the API can do the mapping. Those calls are POSTs with a
body, so they cannot go in `next` -- a `next` link is a GET that returns
200, which is what makes `next` safe to follow blindly and what
tests/envelope.rs relies on. Hence a fifth envelope member, `actions`,
holding method + href + description + body, and omitted entirely when
there is nothing to suggest (most responses keep the four-member shape).
The three per-trait values endpoints now carry a `POST /compute/rqtl`
and a `POST /compute/gemma` suggestion with the values already in the
body, in the response's own sample order. Genotype/SNP paths stay
bracketed placeholders: they must exist on the server, which the server
cannot know on the caller's behalf.
The instruction page says, in the same breath, never to run R/qtl or
GEMMA locally -- a local scan would use genotypes that are not the
panel's and would disagree with GeneNetwork's own results -- and that
results are cached, so repeat calls are cheap (measured: ~2 s cached
against ~20 s cold on the BXD fixtures).
Also fixes a flake the new test exposed rather than caused:
config::tests read and write process-global env vars and Config::load()
reads all of them, so the RAVANAN_* tests could fail
search_engine_keys_follow_env_over_default_layering on an unrelated
assertion. One module-level lock serialises them.
* src/response.rs (SuggestedCall, Envelope::actions/with_action/
with_actions): the new member, omitted when empty; unit tests for both.
* src/suggest.rs: new. Builds the two suggestions for either value type
(db::TraitValue, db::ProbeSetValue), with its own unit tests.
* src/routes/{traits,groups,datasets}.rs: the three values handlers.
* tests/compute_suggestions.rs: new. Suggestions present with values in
order, on all three routes; absent elsewhere; `next` still GET-only and
still returns 200.
* src/config.rs (tests): env_guard, taken by the 11 config tests.
* README.md (Success responses): the `actions` member, with an example.
* docs/www/ai-instruction.md (4a): never compute locally, why, caching,
and how to use the suggested bodies.
* docs/www/operator-checklist.md: the caching numbers.
|
|
R/qtl and GEMMA are part of the service now, so the blanket 403 goes:
the handlers already require an AuthToken, which is the whole gate
("token_only", not resource-checked). What that buys and costs is now
written down rather than implied -- any token holder can name
server-side paths for R and gemma to read, and the public-data-only
restriction on traits/datasets does not apply here at all.
The box also has to be able to run them: PATH must carry Rscript,
gemma-wrapper and gemma, *and* R_LIBS_SITE must point at the profile's
site-library or scripts/rqtl_wrapper.R dies on `there is no package
called 'optparse'` -- which reads like a token or proxy fault and is
neither.
Verified through nginx with a token: POST /gn4/compute/rqtl 200 in 0.4s
with the fixture's marker rows, POST /gn4/compute/gemma 200 in 2.1s with
7 320 marker rows (identical to the documented run's first row),
GET /gn4/compute/gemma/status/<id> ending in "GN4: computation
complete", /compute/correlation 200; all four 401 without a token.
* etc/nginx-vesuvio.pu.ac.ke.conf: drop the /compute 403 locations, keep
them commented as the way back; timeouts/body-size comments now apply.
* docs/www/ai-instruction.md: new §4a, "Running QTL mapping (compute)" --
shapes, server-side paths, ?id= + status polling, what to do with a 504.
* docs/www/operator-checklist.md: compute moves from "must be off" to
"proxied, know what it grants", plus what the box needs (PATH,
R_LIBS_SITE, ravanan) and the measured results.
* docs/nginx.md: same, in the deployment and checking sections.
|
|
The instruction page is now also the way to get the rest of the docs:
clone the repo and read docs/. Measured, so the numbers are real -- a
--depth 1 --sparse clone of docs is ~2.5 MB in a couple of seconds; the
plain --depth 1 clone is 17 MB, almost all of it source tree the reader
does not need.
Why clone rather than fetch: the forge's tree pages sit behind Anubis (a
browser proof-of-work challenge) and its raw endpoint answers 403, so a
plain HTTPS fetch of a Markdown file returns an HTML challenge page. The
git smart-HTTP endpoints pass, so clone works -- which is what makes
this instruction usable at all.
Also says how to tell whether the docs match the running build
(`git log -1 --format=%h` against the `git` field of /gn4/version).
* docs/www/ai-instruction.md: "Get this document, and the rest of the
docs, by cloning", ahead of the numbered sections.
|
|
The AI instructions described the field prefixes but not the semantics,
so a reader would reasonably assume AND between words, working quoted
phrases and wildcard prefixes -- none of which is true here. Measuring
against the production index: juxtaposition is OR (`alcohol` 1 200 vs
`alcohol AND dependence` 45), free text is stemmed and
case-insensitive, quoted phrases and NEAR/ADJ match *nothing* because
the stemmed terms carry no positions (a hyphenated word is a phrase, so
`insulin-like` also matches nothing), and wildcards are not enabled
(`alcohol*` is just `alcohol`).
* docs/www/ai-instruction.md (3. Search): rewritten around the Xapian
QueryParser semantics and a table of exact / stemmed / numeric-range
fields.
* docs/search-engines.md: the same, for whoever maintains the engine,
plus the gn3-forward-vs-native difference in what counts as a field.
|
|
The page said a human issues tokens and to "stop and ask", without
saying whose door to knock on -- and the operator commands belong in the
operator file anyway. State it as the GeneNetwork team, with wording the
assistant can relay to its user: what a token is for, how long the
default lasts, and to pass it out of band rather than through a public
issue or a shared chat. Same wording for renewal, since a 401 is the one
failure the assistant cannot fix itself.
* docs/www/ai-instruction.md (1. Get a token): "If you do not have one"
and "If it stops working", the latter quoting request_id and retrying
exactly once; the summary line and the 401 row of the error table say
GeneNetwork team rather than "the operator".
* docs/www/operator-checklist.md (Token issuance): the request path, so
the team knows what the ask they receive looks like.
* .gitignore: *.swp, after one got swept into this commit.
|
|
ai-instruction.md was written before anything was deployed: it took a
placeholder base URL, did not say where the API is mounted, and buried
the operator's deployment notes in an appendix labelled "not for the AI
reader" -- awkward to hand to an assistant, and confusing when it is.
So: the AI-facing page now names the deployment
(https://vesuvio.pu.ac.ke/gn4) and is self-contained, and the operator
material moves to operator-checklist.md. Everything in the page was
exercised against the running deployment.
Content changes, beyond the move:
* `next` hrefs arrive already prefixed (`/gn4/groups/BXD/strains`), so
they resolve against the origin -- joining them to the current URL's
directory double-prefixes them. Said plainly, since it is the one
thing the prefix breaks.
* says what cannot work and should not be retried: get-test-token is a
404, /compute/* is a 403 from the front end, and neither is a
permissions problem to work around.
* `/publications/{pubmed_id}/traits` wants the PubMed id, not the
internal `publication_id` in the same trait record, which 404s.
* states the current rate-limit position (none configured) instead of
implying a 429 policy that does not exist yet.
* docs/www/ai-instruction.md: rewritten, paste-ready.
* docs/www/operator-checklist.md: new file, the former appendix, updated
with what is now enforced at the proxy and a record of the verified
request matrix.
* README.md, docs/nginx.md, etc/nginx-vesuvio.pu.ac.ke.conf: point at
the operator checklist by its new name.
|
|
Without it /search forwards to GeneNetwork3 at GN3_URL (:5003) and
answers 502 backend_unreachable when nothing is listening there -- a
correct error, with the error body's links rewritten, but easy to
misread as the proxy being wrong. The deployment has an index, so native
is what it wants.
* docs/nginx.md (The server behind nginx): add the variable and say what
the default does.
* etc/nginx-vesuvio.pu.ac.ke.conf: same, in the start-up comment.
|
|
Reproduced from a mirror of the deployed /etc/nginx: with
sites-enabled/default still present, nginx logs
conflicting server name "vesuvio.pu.ac.ke" on 0.0.0.0:443, ignored
and answers 443 with the default site -- stock welcome page at /,
nginx's own 404 for /gn4/..., HTTP/1.1 despite `http2 on` in this block.
sites-enabled/* is globbed alphabetically and the first block whose
server_name matches wins, so `default` (edited by certbot to serve this
hostname) shadows the gn4 block. Removing it gives the expected 302 /
301 / 200 / 404 / 403 matrix.
* docs/nginx.md (nginx): say to install the snippet instead of the
distribution default, and what the shadowing looks like from outside.
|
|
The installed copy merged certbot's port-80 redirect into the TLS block,
which makes that block an HTTP one (listen 80) -- so the /gn4 mount was
only reachable over plain HTTP and https://…/gn4 fell through to the
default server. The same redirect left inside a restored `listen 443 ssl`
block would point at itself, since hosts matching `$host` would be
redirected to the URL they already asked for.
So the port 80 block exists only for the redirect, and www is dropped
from server_name: the certificate's subjectAltName is only
vesuvio.pu.ac.ke, so https://www.<host> cannot be served until the
certificate covers it.
* etc/nginx-vesuvio.pu.ac.ke.conf (server): new listen-80 redirect block;
drop www from the TLS block's server_name.
|
|
The certificate on :443 carries subjectAltName DNS:vesuvio.pu.ac.ke, and
vesuvio.pu.ac.uk does not resolve at all, so the config as committed
could not have matched a request for the real name: nginx falls through
to the default server, which is why /gn4/... answered 404 from nginx
rather than a 502 from genenetwork4.
* etc/nginx-vesuvio.pu.ac.uk.conf -> etc/nginx-vesuvio.pu.ac.ke.conf:
server_name and the certificate paths.
* docs/nginx.md: the same rename, and a "Checking it" section that
starts from what actually gets in the way on the box -- TLS validates
the URL hostname rather than a Host: header, so on-box checks need
--resolve against the name on the certificate, and a mismatch there and
in server_name look identical (default server answers).
|
|
docs/nginx.md explained the pieces; this is the assembled file for the
deployment actually being set up, so it can be reviewed and installed
without stitching anything together. It lives in etc/ rather than
docs/, being deployable configuration rather than prose.
It refuses /compute/*, which the README-based template did not: those
endpoints take server-side file paths and run gemma/ravanan/R on them,
so any token holder able to reach them can read the box -- the operator
checklist in docs/www/ai-instruction.md already said to keep them on the
internal listener, and this is that rule where it belongs.
* etc/nginx-vesuvio.pu.ac.uk.conf: new file. TLS, http2, log format
carrying x-request-id, / and /gn4 redirects, proxy_pass with the
prefix-stripping trailing slash, raised timeouts, sub_filter rewriting
of href/next/spec_url/type, and 403/404 refusals for /compute/ and
/get-test-token.
* docs/nginx.md: point at it, and say why /compute/ is refused.
|
|
|
|
The page told the operator to mint with POST /get-test-token, which is
gn-auth's dev password grant and does not exist in the deployment being
set up. Issuing a second user's token also had no good answer: the stub
minted exactly one token per process, so a new user meant starting a
throwaway instance, grabbing --token-file and killing it.
So add --mint-only: mint for --subject, print, write --token-file and
exit without listening. Verification only depends on the key (committed,
so shared by every instance) and on iss, which now falls back to
AUTH_SERVER_URL -- a token minted this way verifies against the
long-running stub untouched.
* scripts/gn-auth-stub.py (main): --mint-only; --issuer defaults to
AUTH_SERVER_URL before the port-derived default. Docstring says how a
second user's token is issued.
* docs/www/ai-instruction.md (1. Get a token): the operator's command is
the stub, not /get-test-token; the token lasts whatever --expires-in said
rather than an hour, and there is no early revocation. (4. What is
public): minting is operator-side. Appendix: "Token issuance" rewritten
around the stub -- public-data-only, expiry as the only revocation, sub
as attribution, one token per user -- with gn-auth kept as what replaces
it later; the stub is no longer listed as a dev leftover to delete, but
as the auth server that must never be routed publicly.
* README.md (Tests): mention --mint-only next to the stub's other flags.
|
|
Nothing about a bearer token is kept server side -- no session table, no
issued-token list, no denylist -- so restarting genenetwork4 (or the
auth server) loses no tokens, and restarting is not a way to revoke
them. The two in-process caches (the key set for an hour, authorisation
answers for a minute) are refresh intervals, not lifetimes; the hour
only bites when the auth server is unreachable, after which every
request is a 401 with a JWKS-fetch detail while the tokens themselves
are still valid.
Also records that `exp` is optional in this validation, so a
hand-minted token without one never expires -- which is exactly what the
gn-auth dev token mentioned a few paragraphs earlier is doing.
* README.md (Development): "Tokens are stateless", plus a note on the
gn-auth dev token not carrying `exp`, and the config keys paragraph
moved back above the section it belongs to.
|
|
The deployment being set up is https://vesuvio.pu.ac.uk/gn4 proxying to
a loopback port, with no gn-auth yet. Two things there are not obvious
and neither is discoverable from the README's /get-test-token section:
every link the API emits is root-relative, so under /gn4 they resolve
outside the mount point; and /compute/* runs for minutes in a single
request, so nginx's one-minute default read timeout cuts it off
mid-computation.
The link rewriting is the delicate part -- the server's serde output is
compact ("href":"/"), not the pretty-printed shape the README examples
show, so a filter written from those examples silently does nothing.
Both spellings of all four affected keys (href, next, spec_url, type)
are in the config, and the envelope's "next":[ array is deliberately
left alone.
* docs/nginx.md: new file. Server environment, the nginx block, what the
prefix does to links and the three ways to handle it, stub-minted
tokens instead of gn-auth, and how to check the result.
* README.md (Behind nginx or in a container): point at it.
|
|
A stub token had a fixed 24h lifetime, and nothing said what an
ungranted one can reach. Both matter for the case that is not a test
run: handing a caller or an agent a long-lived token that may only read
public data. An ungranted stub token already is exactly that -- the
restriction lives in the authorisation lookup genenetwork4 consults for
anything not public, not in the token's scope -- so only the lifetime
was missing.
* scripts/gn-auth-stub.py (duration): new helper, "30d"/"24h"/"60m"/s.
(sign): take expires_in instead of a hard-coded 86400.
(main): --expires-in, defaulting to 24h as before; docstring says what
an ungranted token can reach and why the key's fixity makes a month-long
token safe.
* README.md (Tests): the public-data-only token, what stays visible
(dataset metadata), the --expires-in example and the iss/port coupling.
|
|
A second instance started while one is already listening used to write
its own token to --token-file (and print it) before failing to bind,
leaving a token nothing was serving in the place the first instance's
token was expected -- tests then failed as if the stub had issued it.
Bind first, then write and print.
* scripts/gn-auth-stub.py (main): construct the server before writing
--token-file or printing the token.
|
|
The suites skip rather than fail whatever needs a database, an index or
a token they cannot get, which is right in the build sandbox but leaves
most endpoints unexercised. With a live MariaDB, a full Xapian index
(GN4_FULL_INDEX) and a token, the same commands run the whole suite:
225 Rust tests pass with 0 failures, and the Python suite runs all 94
with no skips -- as against 77 skipped without them.
The token was the only piece with no local stand-in, so add
scripts/gn-auth-stub.py: it serves the JWKS matching the committed test
key, answers /auth/token (so POST /get-test-token works) and answers
both authorisation endpoints with "no privileges", the stranger case
the non-public 403 tests assert. --grant-resource-id grants one
resource id to the fixture token for the owner-side tests.
* scripts/gn-auth-stub.py: new file.
* README.md (Tests): "Against a real database and index", what the
three inputs are, the full run, and what still skips and why.
|
|
The xapian-rs git revision Cargo.toml pins was written against Xapian
1.4: it generates bindings for Xapian::InMemory::open, which Xapian 2.0
removed (2.x spells it as the Xapian::DB_BACKEND_INMEMORY flag), and
autocxx then aborts with "the 'generate' or 'generate_pod' directive for
'Xapian::InMemory::open' did not result in any code being generated".
2.x's headers also need C++17, where autocxx hands the parser a fixed
-std=c++14 that 1.4's headers accept. Guix's own xapian has moved to
2.1.0, so guix build -f guix.scm stopped working; pin the last 1.4
release instead of tracking it.
* guix.scm (xapian-1.4): new variable, Xapian 1.4.29 inheriting
xapian's inputs, with 1.4's own check targets.
(genenetwork4-git)[inputs]: use xapian-1.4.
(use-modules): (guix download), for url-fetch.
* README.md (Running with cargo): "Building with cargo, outside a bare
toolchain", the guix shell -D variables that a bare cargo build lacks.
(Running with Guix): why xapian is pinned, and when to drop it.
|
|
docs/www/ai-instruction.md is the AI-facing page: you are handed a JWT
(the operator mints it on the server's loopback interface, so there is no
token endpoint on the public host and no flow for the model to follow),
send it as a bearer token, and read the envelope. It covers discovery
(/openapi.json, /version), the readable endpoints, search's grammar and
paging cost, the public-data rule (public > 0 && confidentiality < 1, or
older than five years), error classes and what to do with each, and a
worked example.
The operator appendix records the deployment findings from this session:
* /get-test-token is now the minting route and only a loopback peer
check plus proxy-header refusal keeps it off the internet -- it must
not be proxied and the app must stay bound to 127.0.0.1;
* POST /compute/* takes server-side file paths and is token_only, so it
is an arbitrary-read/execution surface and stays internal;
* the public rule is enforced per dataset for values, while metadata
endpoints are token_only by design and do reveal non-public dataset
records -- a decision to make, not an accident;
* the index must be built with the public filter (GN4's indexer does;
gn3's index-genenetwork has no WHERE clause). Verified on the current
full index: the confidentiality=1 HCPPublish and the public=0
BR_U_0303_M dataset both return zero hits;
* error detail can carry the database address, and tokens minted this way
all carry gn-auth's development user as sub, so the audit trail is
"someone with a token" until client_credentials exists.
|
|
mark_failed_appends_failure_marker_with_the_error and
create_run_log_rejects_a_reused_id both worked in
/tmp/gn4-streaming-test-<pid>, and the second removes the directory when
it is done, so under cargo's parallel test threads it could delete the
first one's log mid-assertion -- an intermittent failure that has
nothing to do with either test's subject. Give each its own directory.
|
|
The suite covered each half of /search separately: tests/search.rs pins
the MariaDB side (locus, abbreviation, complete/partial) but through the
gn3 stub engine, and the search_native* tests pin the native engine
against a dev index and never need a database. Native engine + live
db_webqtl -- the combination that actually runs in production -- was
only ever checked by hand.
tests/search_native_db.rs closes that: route level, dataset:bxdpublish
must come back 200 with meta.state complete and annotated hits; at the
engine seam, dataset:BXDPublish must match the same documents as
dataset:bxdpublish; and the match set's ids must be the database's
PublishXRef ids for the BXD group.
The strict id comparison runs only against a full index, selected with
GN4_FULL_INDEX (skipped by default, like GN4_PARITY_FIXTURES). Against
the dev index the ids are printed as reference data instead: it is a
different snapshot, missing 1 772 of the database's traits and holding
349 the database no longer has, which is exactly what made the strict
form worth having.
|
|
The index stores every boolean term in lowercase and holds no
mixed-case variants at all: XDSbxdpublish (15 060 docs), Awilliams
(10 958), XSmouse, XCx, XYbdnf, XImrna all exist, while XDSBXDPublish,
AWilliams, XSMouse, XCX, XYBDNF and XIMRNA report "not in database" on
both the dev index and a full production one. Matching the value
exactly therefore rejected the way a caller naturally writes it --
dataset:BXDPublish returned 0 hits against an index holding 15 060
BXDPublish traits, author:Williams 0 against 10 958 williams authors.
Lowercase the value for every boolean prefix, generalising the
group-only rule gn3 already has (search.py:204-209). No graded parity
shape changes: they all use lowercase values already.
Pinned per prefix in boolean_prefixes_parse_to_exact_index_terms, so a
registration that regresses to an exact add_boolean_prefix fails there
instead of silently returning zero hits.
|
|
Measured the same request (BXD fixtures, three chromosomes) through
/compute/gemma, ravanan's single-machine backend and ravanan on Slurm,
cold and warm. The Slurm backend is dispatch-bound at this size -- one
scheduler tick per step, with each job itself running in under a second
-- so cold and warm are identical there, and the README's 16.7s figure
belongs to the single-machine backend.
Also document the Slurm-side requirement behind that measurement: a
completed job has to stay queryable for as long as the workflow runs.
Once slurmctld purges the record ravanan falls back to slurmdbd, and on
a cluster without accounting the workflow aborts on a 404 long after the
job succeeded.
|
|
The cache dir was keyed by chromosome only and shared across requests,
so a request with different inputs (another trait, or another snps or
genotype file) left a second *-gemma-cXX.tar.xz in the same chr-N dir.
gemma-wrapper names those archives by a content hash, so the workflow's
single-File glob output binding then matched more than one path and the
step failed -- silently, since ravanan's user-error only logs when
%log-level is set, which never happens inside a generated job script.
Key the cache root by a hash of the input set (genotype path and size,
snps contents, trait values, lmm) as well as by chromosome, so repeated
identical requests still hit gemma-wrapper's cache while different
input sets cannot see each other's archives. chromosomes_in reads the
snps file, so it now takes the already-read contents (chromosomes_from)
to avoid reading it twice.
cwl/README.md: describe the two-part keying, and note that a node needs
a writable HOME -- ravanan forwards the submitting process's HOME into
the job (as sbatch would) and gemma-wrapper writes its lock file there.
|
|
Spell out why the current design needs the store visible (ravanan
submits a store path and Slurm does not substitute, so an absent path is
an immediate ENOENT), then list the five ways out as a table -- shared
store, realise-then-run wrapper, per-workflow realise job, guix publish
plus wrapper, shipping closures -- with what runs, what each needs on
the nodes, and what it costs in caching.
Also records where the wrapper would live (build-gexp-script already
builds the derivation but returns only its output path; submit-job in
ravanan/slurm-api.scm assembles the script field), that nothing of it is
implemented here, and the four costs that decide the question: channel
skew, build time inside the job's time limit, caching on ephemeral node
stores, and guix publish as the sane companion.
Tables tightened so no line runs past ~170 characters.
|
|
cwl/README.md explains the whole path (API -> ccwl compile -> ravanan ->
slurmrestd -> slurmd), where Guix sits (front end only: nodes just need
the same /gnu/store mounted, plus bash, a writable ravanan store for
data/logs, and scratch for the job's working directory), the two caches
(ravanan's work reuse, checked before submitting; gemma-wrapper's
per-chromosome --cache-dir, inside the job) and why the latter is what
actually saves work for this endpoint.
It also answers "can the nodes rebuild the tools instead of sharing a
store": yes in principle, since Guix is deterministic and a node
building the same derivations would materialise identical store paths,
but ravanan submits a store path and Slurm does not substitute
automatically -- so it needs a realise-then-run wrapper (ravanan's
slurm backend already holds the script's derivation), a per-workflow
realise job, or guix publish plus a node-side daemon, with the costs
and channel-pinning caveats listed. The timing table from the test
cluster (cached: identical; fresh: waves vs synchronous steps) is
included so expectations are explicit.
docs/ravanan-slurm.md and README.md link to it.
|
|
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.
|