Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add the simulation job store and background result collection without leases

Đã đóng
#845 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #848 của @anth-volk — đã đóng, không merge

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
github-actions, google-cloud, postgresql, python
Lĩnh vực
backend, cloud, databases

Hướng nghiên cứu

The issue specifies the simulation.jobs and simulation.job_results tables, collection and sweep routes, and concurrency tests, but names no source files or test paths. Start by locating the API's database models, route registration, and test conventions, then trace how Modal calls and Cloud Tasks are handled. Done means jobs can be submitted idempotently, results collected safely without leases, status read from the database, and the stated operator prerequisites are configured; linked PR #848 is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Context

Step 1 of the API v2 migration (item 1A-4, result collection option B) needs a durable record of every calculation the Simulation Entrypoint sends to Modal, and a way to store each finished result without relying on clients that poll. The migration plan's rules: client polling never advances work, and Modal applications get no database credentials.

Scope

  • simulation.jobs: one row per calculation, recording the submitter, an input hash that includes the policyengine.py bundle version, the Modal call ID, status, timings and any error.
  • Idempotent submission: INSERT ... ON CONFLICT on the input hash, so identical requests share one job.
  • A conditional pending -> dispatching update before the Modal spawn, so one Modal call starts per job.
  • An authenticated internal collection route that Cloud Tasks calls: it checks the Modal call without waiting, writes a finished result to Postgres with a conditional update (... WHERE status = 'running') so a second collector changes nothing, and re-enqueues itself with backoff while the call runs. No Postgres leases.
  • simulation.job_results for results that are not reports (report results go to simulation.report_results, added separately).
  • A sweep route that Cloud Scheduler calls, which enqueues a collection task for unfinished jobs not checked recently.
  • Status reads that use only the database and accept either a job UUID or a Modal fc-... call ID.
  • Tests showing the conditional writes are safe when two collectors run at once.

Nothing in production submits jobs yet; no job kind is registered until Step 2.

Operator prerequisites (both environments, before merge)

  • Create the Cloud Tasks queue, its invoker service account and the IAM bindings (the Simulation Entrypoint runtime service accounts may create tasks and act as the invoker; the invoker may invoke the Cloud Run service).
  • Create the Cloud Scheduler job that calls the sweep route with the invoker's OIDC token, audience set to the stable service URL.
  • Confirm the Simulation Entrypoint's ingress setting accepts requests from Cloud Tasks and Cloud Scheduler.
  • Set the RECONCILIATION_QUEUE and RECONCILIATION_INVOKER_SERVICE_ACCOUNT variables in this repository's beta and prod GitHub environments.
Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
57

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine-sim-api

Tất cả issue của PolicyEngine/policyengine-sim-api

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.