Skip to content

Liftover page - retry failed liftovers per tool #1273 - #1845

Open
davmlaw wants to merge 2 commits into
masterfrom
issue_1273_liftover_retry_failed
Open

Liftover page - retry failed liftovers per tool #1273#1845
davmlaw wants to merge 2 commits into
masterfrom
issue_1273_liftover_retry_failed

Conversation

@davmlaw

@davmlaw davmlaw commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Implements #1273 (plan: claude/plans/1273_liftover_retry_failed_plan.md).

Problem

AlleleLiftover.get_failed_conversion_tools() returns every tool that has ever errored on an allele/build, and _get_build_liftover_dicts() skips those permanently. After fixing a bug or config problem (bad chain file, missing bcftools binary, a LiftoverRun.error() that marked a whole batch failed) there was no way to re-run those alleles - the liftover page's "Liftover variants" button, the allele page's "Create Variant" button and the admin "Liftover" action all silently did nothing.

The only workaround was deleting AlleleLiftover rows by hand in the admin, which throws away the error messages you need to diagnose the failure.

Approach

The failed-tool memory is the right default (it stops a ClinGen-less allele being re-queried on every import), so this adds a deliberate per-tool override rather than removing it. retry_conversion_tools is subtracted from each allele's failed set in _get_build_liftover_dicts; earlier failures are kept as history and a retry that fails again lands as a new AlleleLiftover under a new LiftoverRun.

Alleles that have since acquired a variant in the destination build are already excluded by the existing existing_builds check, so the retry queryset can be generous.

Changes

File Change
snpdb/liftover.py retry_conversion_tools= on create_liftover_pipelines, _create_liftover_pipelines_for_batch, _get_build_liftover_dicts, liftover_alleles, allele_can_attempt_liftover
snpdb/models/models_variant.py Allele.failed_liftover_for_build(build, tool) - still-missing alleles that tool has errored on
snpdb/tasks/liftover_tasks.py retry_conversion_tool (enum value, so it survives the Celery message) through both tasks; _alleles_to_liftover() shared by the batcher and the batch re-query
snpdb/views/views_liftover.py parses retry_{build}_{tool} buttons, adds retry_counts context
snpdb/templates/snpdb/liftover/liftover_runs.html per-tool retry table under each "Failed Liftover to build" heading
variantopedia/views_allele.py, classification/variant_card.py, snpdb/admin.py "Create Variant" and the admin action retry all tools - the button now also appears for an allele every tool has failed on
snpdb/management/commands/liftover_alleles.py --retry-tool {SC,CA,DB,NR,PC,CM,BL} for kicking a retry from a shell after a deploy

Also a gotcha line in snpdb/CLAUDE.md and a changelog entry. No migration - no model fields change.

Testing

  • Full suite passes: 3109 tests, OK (--keepdb --parallel 4)
  • Three new tests in snpdb/tests/test_liftover.py: the retry override on _get_build_liftover_dicts (the retried tool comes back, other failed tools stay skipped), failed_liftover_for_build, and allele_can_attempt_liftover with retry
  • vg page /snpdb/liftover --as admin --queries against live data on vg-test2: renders, 18 production queries (3 added, one per build). Real counts e.g. GRCh38 - ClinGen Allele Registry 97, BCFtools/liftover 10
  • scripts/vg map --check and scripts/vg docs check pass

🤖 Generated with Claude Code

https://claude.ai/code/session_01XeLN2A486UE31zfdk9SrRG

A tool that has ever errored on an allele/build was skipped forever by
AlleleLiftover.get_failed_conversion_tools, so the liftover page's
"Liftover variants" button, the allele page's "Create Variant" button and
the admin action all silently did nothing for previously-failed alleles.

Add retry_conversion_tools, subtracted from the per-allele failed set in
_get_build_liftover_dicts. Earlier AlleleLiftover rows are kept as
history - a retry that fails again lands as a new row under a new
LiftoverRun.

- Liftover page: a per-tool "Retry failed liftovers" button under each
  "Failed Liftover to <build>" heading, with the count of alleles it
  would re-attempt (Allele.failed_liftover_for_build)
- liftover_alleles / liftover_allele_batch tasks take the tool value
- "Create Variant" and the admin Liftover action retry every tool, so
  the button also appears for an allele all tools have failed on
- manage.py liftover_alleles --retry-tool <value>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant