feat: route dataset validation to the GTFS validation worker

Aperta
#1,919 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
22/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
gcp, google-cloud, python

Direzione di ricerca

This is a multi-part design change spanning enqueueing, the monitor and rollout, and it names behaviors (create_http_gtfs_validator_task, try_acquire, heartbeat, mark_triggered, sync_task_run_status) without naming files. Start by reading the existing create_http_parquet_builder_task helper and parquet_api_impl for the enqueue/commit pattern, then the gtfs_daily_pipeline monitor and the gtfs_validation schema. Done means the validator is reached only via Cloud Tasks on the correct tier, the validation stage reports completed/failed/pending with a working lease sweep, and dev output matches the current pipeline. Given the scope, it needs a maintainer's guidance before anyone starts.

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

Descrizione

Describe the problem

New datasets trigger the gtfs_validator_execution workflow via Eventarc, and rebuild_missing_validation_reports starts the same workflow with an optional validator_endpoint. Validation is not part of the daily pipeline run (#1918).

Proposed solution

Enqueue

  • Shared helper create_http_gtfs_validator_task (alongside create_http_parquet_builder_task): Cloud Task on the tier's queue, HTTP POST to gtfs-validator-<tier>-<env> with an OIDC token, payload {feed_id, dataset_id, validator_variant, bypass_db_update, reports_bucket_name}.
    • Task name derived from dataset id + validator variant + attempt, so a duplicate enqueue is rejected.
    • dispatch_deadline at the Cloud Tasks maximum (30 min). A redelivery while a validation is still running is absorbed by the worker's lease (try_acquire + heartbeat).
  • Before creating the task, the caller runs start_run and mark_triggered(dataset_id) and commits (as parquet_api_impl does); on enqueue failure it calls mark_failed.
  • batch_process_dataset calls the helper after upload. Tier at queue time: feed override first, otherwise the uncompressed size read from the zip's central directory, l when unknown.
  • rebuild_missing_validation_reports calls the helper instead of starting the workflow. Replace validator_endpoint with validator_variant (stable | snapshot); snapshot routes to the snapshot service.

Monitoring

  • Add a validation stage to the gtfs_daily_pipeline monitor: joins gtfs_validation rows by dataset_id, reports completed / failed / pending.
  • Lease sweep in the validation stage: triggered and unclaimed after a threshold -> re-enqueue on the same tier; in_progress with an expired lease -> record_attempt(failed), escalate, re-enqueue.
  • sync_task_run_status for gtfs_validation runs (rebuild_missing_validation_reports): resolve rows by execution_ref type (Workflows execution name -> current path; Cloud Run revision -> lease check).

Rollout

  • Switch per environment. In dev, compare report.json for ~100 datasets of mixed sizes against the current pipeline (ignoring timestamps and duration) before qa and prod.
  • No change to report paths, file names or DB rows.
Alternatives you've considered
  • Keep the Eventarc trigger and point it at the worker: the trigger has no dataset size, so every dataset would start at l.
  • Cloud Tasks retries only: retries stay on the same tier and a killed run is never recorded.
Lingua principale
Python
Stelle
34
Fork
7
Merge medio
2g 22h
PR unite (30g)
21

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 MobilityData/mobility-feed-api

Tutte le issue di MobilityData/mobility-feed-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.