Move the simulation executor to policyengine.py 6.14.0 and keep accepting US 2022 and 2023

Đang mở
#1,012 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 2 ngày

@anth-volk đang làm issue này rồi.

Từ ngày 5/11/2026.

  • #1013 của @anth-volk — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Read _load_dataset in projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py and the dependency lists in projects/policyengine-simulation-executor/pyproject.toml; inspect the existing unit tests and the precompute calls. Update the dependency and lockfile, add the temporary opt-out and a test for US 2022 or 2023, then confirm precompute calls are unchanged.

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

Mô tả

Problem

Since policyengine.py 6.13.0 (PolicyEngine/policyengine.py#730), create_datasets and ensure_datasets raise UnsupportedDatasetYearError when a requested year is outside the years the installed country model supports the source dataset for. For the US, that refuses 2022 and 2023, which come before the 2024 data year of the certified dataset. Passing allow_unsupported_years=True skips the check. Year files that already exist are loaded without it, so the check applies whenever a year file has to be created.

The executor loads the dataset year for every simulation job through country_module.ensure_datasets(...) in _load_dataset (projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py). That covers the main simulation runtime and the Stage 12 society-wide worker. The Public API and the app still offer US 2022 and 2023 for society-wide runs. If the executor moved to policyengine.py 6.13.0 or later without a change, those runs would fail partway through with an error the caller is not told the reason for.

The executor pins policyengine[models]==6.12.0, whose ensure_datasets has no allow_unsupported_years argument, so the opt-out and the version change have to ship in the same pull request. The automated update pull requests (#1011 for 6.14.0, #1002 for 6.13.0 and #990 for 6.12.1) change only the version.

Plan

  1. Move the executor to policyengine.py 6.14.0, and pass allow_unsupported_years=True from _load_dataset, so the simulation service keeps accepting every year the Public API offers. The precompute steps that build dataset year files keep the check; they build 2025, 2026 and 2027, which are supported.
  2. The Public API stops offering US 2022 and 2023 for society-wide runs and refuses them with a 400.
  3. This repository then removes the opt-out, so the executor refuses unsupported years as well.

This issue covers step 1. Until step 3, policyengine.py updates are not held back by the year check.

Acceptance criteria

  • projects/policyengine-simulation-executor/pyproject.toml requires policyengine[models]==6.14.0 in both of its dependency lists, and uv.lock is regenerated.
  • _load_dataset passes allow_unsupported_years=True to ensure_datasets, with a comment saying the opt-out is temporary and when it is removed.
  • The precompute calls to ensure_datasets are unchanged.
  • A unit test with a fake country module shows that a request for US 2022 or 2023 loads its dataset.
Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
2 ngày 48 phút
Pull request đã merge (30 ngày)
87

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.