feat: GTFS validation worker wrapping the validator CLI

Abierto
#1,915 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
docker, gcp, java, python

Línea de trabajo

Read the existing parquet_builder worker first to see how a containerized worker, TaskExecutionTracker (with try_acquire/heartbeat/mark_completed/record_attempt) and MemorySampler are wired today, then limit_gcp_memory and shared/helpers/sizing.py for the memory/tier math. The new pieces are the Python chunked extraction from GCS, the CLI subprocess invocation with a tier-derived heap, the report upload to <feed>/<dataset>/, and a new validator_policy.py for escalation/demotion. Done looks like a worker that produces report_<ver>.json/.html and system_errors_<ver>.json, clears the volume, and queues process-validation-report with the same payload as the current gtfs-validator-web flow.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the problem

Dataset validation goes through gtfs-validator-web in another region: every run uses 4 vCPU / 16 GiB, datasets and reports cross regions, and the workflow polls GCS for up to 60 min. See product-tasks#234.

Proposed solution

A worker in mobility-feed-api, built as a container (Python + JRE + pinned gtfs-validator-cli.jar), following the parquet_builder pattern:

  • Tracking: TaskExecutionTracker(task_name="gtfs_validation", run_id=<validator version>) (existing task name). try_acquire with K_REVISION, heartbeat while the JVM runs, mark_completed / mark_failed, and record_attempt with tier, peak memory and input size. A delivery that fails try_acquire returns skipped.
  • Input handling (the validator reads files only during the load phase, but keeps a zip input open until the run ends):
    • Never pass a URL or a non-local NIO path to the CLI: both load the whole zip into the heap.
    • Candidates, chosen by measuring peak volume + peak JVM memory per tier in dev:
      1. Streamed, chunked extraction in Python straight from GCS; Python deletes each extracted file once the JVM has closed it, so the volume is empty for validation and reports.
      2. Baseline: zip downloaded to the volume.
  • Runs the CLI as a subprocess, heap set from the tier memory minus the volume (as limit_gcp_memory does), and samples the JVM with MemorySampler.
  • Uploads report.json, report.html, system_errors.json as report_<ver>.json, report_<ver>.html, system_errors_<ver>.json (publicRead) to <feed>/<dataset>/, clears the volume, then queues process-validation-report with the same payload as today.
  • Keeps the skip-if-reports-exist check, bypass_db_update and the reports bucket override.
  • Sizing with shared/helpers/sizing.py and a new validator_policy.py: escalates one tier on JVM OOM or a full volume (max 3 attempts); demotes after DOWNSIZE_STREAK runs under DOWNSIZE_HEADROOM; a locked override blocks both.
  • <ver> must match the version string used today, since file names and DB rows depend on it.
Alternatives you've considered
  • gtfs-validator-api called by a worker or directly by Cloud Tasks: needs a ZIP response or a GCS output option, gives no in-process memory measurement, and leaves no clean way to escalate.
  • GCS FUSE mount of the datasets bucket: rejected as a risk.
Lenguaje dominante
Python
Estrellas
34
Forks
7
Merge medio
2 d 22 h
PR fusionados (30 d)
21

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MobilityData/mobility-feed-api

Todos los issues de MobilityData/mobility-feed-api

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.