Repository navigation
A re-sent VCF no longer changes a group analysis that wasn't reloaded, warns on node cards, and is labelled on every run page tab (#2929) - #2936
Merged
Conversation
…, warns on the cards of nodes left reading it, and is labelled on every run page tab #2929 A group level SampleNode keeps the samples it loaded with on its NodeVersion (load_data["source_samples"]), so a VCF re-sent or a sample linked afterwards is a warning until the node reloads, rather than changing the grid of an analysis someone is working from. After a re-sent VCF imports, the nodes still reading the VCF it replaced get their card warnings rewritten in place (update_node_warnings), as tag counts are. The run page's Patients and SampleSheet tabs mark the replaced sample and VCF as the Data tab does.
…ing_sources_q over patients.sample_grouping.get_source_ids_for_samples, shared by related analyses, sample delete and the replaced VCF warnings #2929
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Results and testing notes: #2929 (comment). Follow-up to #2930, from the agent-testing comment on #2929.
1. A group sample node reads the samples it loaded with
Cause. A group level
SampleNode(extraction / specimen / patient) worked out its samples on every query (SampleNode._sample_group→get_sample_group), not when it loaded. Its counts and card come from the load, but the grid, grid columns and warnings came from whatever the group held at the time of the request. So when auto-launch left a locked analysis alone after a re-send, it still switched to the new sample at its unchanged node version, and called the sample it was locked on "not included". That is the opposite of the "counts are a cache of a query against an immutable node_version" rule inAnalysisNode.node_counts.Fix. It uses the snapshot hook the node already has:
_get_load_data("snapshot anything else the node worked out at load") already writes the card warnings toNodeVersion.load_data. A group levelSampleNodenow also writesload_data["source_samples"] = {"source": "<level>:<pk>", "sample_ids": [...]}.SampleNode._get_loaded_sample_idsreads it back, andget_sample_group(..., loaded_sample_ids=)then:get_exclusion_reason(keep_replaced=True)). Archived, failed-import and wrong-build samples are still left out, because their data can't be read.Because the snapshot belongs to the NodeVersion, anything that bumps the version re-resolves the group: an edit,
reload_analysis_nodes(auto-launch's in-place reload of an analysis nobody worked in, Analysis Settings → Force Reload All Nodes), or the sample-delete bump. The snapshot is keyed on the source, so an editor form that has just picked a different source (and drops_sample_group) resolves live. A NodeVersion loaded before this deploy has no snapshot and resolves live, as it does now, until its next reload.Behaviour change beyond re-sends: a sample linked to a group after the node loaded (a second sequencing run for the same specimen, a late extraction match) now shows up after the node is reloaded, not straight away in the grid. Until then it is named in a warning. Before this change, such a sample appeared in the grid while the counts stayed stale. The
analysis/AGENTS.mdnote on auto-launch says this now.2. The card shows the replacement warning on nodes that weren't reloaded
Card warnings are
load_data["warnings"], written at load, and nothing reloads an analysis that's left reading a replaced VCF.node_utils.update_node_warnings(nodes_qs)rewrites that key in place on each READY node's current version, with ajsonb_setthat works the same way asupdate_analysis_tag_node_countsdoes for tag counts (no version bump, because the results haven't changed). The new taskupdate_node_warnings_for_replaced_vcfs(vcf_id)is the third link inhandle_vcf_import_success's chain, after the auto-launch reload. It finds the nodes throughget_nodes_reading_sample_q: the sample → nodes Q thathandle_sample_pre_deletealready built, moved intonode_utilsso both callers use it. It also addscohortnode__cohort__vcf. A node that isn't READY writes its own warnings when it loads. I picked this over adding live warnings innodes_status, because that view is polled and would need every node's subclass loaded on every poll. Routed toanalysis_workers.3. Run page labels
New
seqauto/tags/vcf_replaced_badge.html, used by the Data tab (run_vcf.html, the badge it already drew), by the Patients tab rows (run_sample_row.html, on both the sample and the VCF cells) and by the SampleSheet tab's sample cell. The SampleSheet query now prefetchessample__vcf.Tests
analysis.tests.test_sample_node_levels: a loaded extraction node keeps its samples and grid cohorts across a re-send, with both warnings, and switches on a version bump (fails on the oldSampleNode). Also: the warnings task rewrites the card warnings of a sample-level node and a group node left reading the replaced VCF.seqauto.tests.test_sequencing_run_patients: the run page labels the replaced sample on the Patients and SampleSheet tabs.--keepdb --parallel 4: 4822 tests OK.