Per-user major operation limit for classification grids and exports

Aperta
#2,869 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
django, python
Ambito
backend, data

Direzione di ricerca

Read library/django_utils/major_operation.py and MajorOperationViewMixin first, then inspect the listed export views and the classification and grouping DataTables grids. Decide how limits should differ for exports and machine users, how streamed operations refresh slot expiry, and how statement timeouts interact with batch reads. Done means the uncovered exports and grids have suitable per-user concurrency limits, with streamed slots held for the operation's duration.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

🤖 Written by Claude

Classification exports have no per-user concurrency limit, so one user can run several heavy exports at once. Several JSON exports running together is what led to #2867.

What exists: library/django_utils/major_operation.py:major_operation caps a user's concurrent heavy operations and lowers statement_timeout while one runs. MajorOperationViewMixin opts a class-based view in with major_operation_name, and for a streamed response it holds the slot until the stream finishes or the client disconnects. Only the node grid (analysis/views/views_grid.py) and three variantopedia grids (variant_tags, all_variants, tagged_variants) use it.

Not covered:

  • classification_grouping_export (classification/views/exports_grouping/classification_grouping_export_view.py:serve_export): JSON, CSV, VCF, Franklin.
  • export_classifications_grid / export_classifications_grid_redcap (classification/views/views.py).
  • classification_export_api (classification/views/classification_export_view.py:ClassificationApiExportView).
  • The classification and grouping DataTables grids.

Things to settle:

  • Limit size: MAJOR_OPERATION_MAX_CONCURRENT_PER_USER is 20 and shared by every operation type, so it wouldn't stop a handful of exports. Exports may need a lower limit of their own, e.g. an optional per-operation limit in major_operation.
  • Slot expiry vs export length: MAJOR_OPERATION_SLOT_EXPIRE_SECONDS is 10 minutes, a safety expiry for crashed requests. A large JSON export can stream for longer than that, after which its slot is freed while it is still running. The streamed-response holder may need to refresh the expiry as it yields.
  • Statement timeout: MAJOR_OPERATION_STATEMENT_TIMEOUT_SECONDS (5 minutes) applies to each statement. That is fine once #2867 reads in batches, but a single .iterator() cursor query would hit it.
  • Machine users: the API export is used by integrations and sync, whose accounts might legitimately run several at once. Decide whether they share the limit.
  • Function views: serve_export and the grid export views are function views, so they need major_operation used directly and the streamed response wrapped the same way MajorOperationViewMixin does it (_StreamHoldingOperation). Factoring that wrapping out would serve both.
Lingua principale
Python
Stelle
31
Fork
4
Merge medio
4h 52m
PR unite (30g)
183

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SACGF/variantgrid

Tutte le issue di SACGF/variantgrid

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.