|
35 | 35 | import json |
36 | 36 | import os |
37 | 37 | import subprocess |
| 38 | +import sys |
38 | 39 | import time |
39 | 40 | import traceback |
40 | 41 | from dataclasses import asdict, dataclass, field |
|
44 | 45 | from typing import Optional |
45 | 46 |
|
46 | 47 | import modal |
47 | | -import sys as _sys |
48 | 48 |
|
49 | 49 | _baked = "/root/policyengine-us-data" |
50 | 50 | _local = str(Path(__file__).resolve().parent.parent) |
51 | 51 | for _p in (_baked, _local): |
52 | | - if _p not in _sys.path: |
53 | | - _sys.path.insert(0, _p) |
| 52 | + if _p not in sys.path: |
| 53 | + sys.path.insert(0, _p) |
54 | 54 |
|
55 | 55 | from modal_app.images import cpu_image as image |
56 | 56 |
|
@@ -253,20 +253,7 @@ def _record_step( |
253 | 253 | # app.include() merges functions from other apps into this one, |
254 | 254 | # ensuring Modal mounts their files and registers their functions |
255 | 255 | # (with their GPU/memory/volume configs) in the ephemeral run. |
256 | | -# |
257 | | -# Inside Modal containers the auto-mounted package root may not be |
258 | | -# on sys.path when the module first loads; ensure it is importable. |
259 | | -import sys |
260 | | - |
261 | | -_parent = str(Path(__file__).resolve().parent.parent) |
262 | | -if _parent not in sys.path: |
263 | | - sys.path.insert(0, _parent) |
264 | | -# The image bakes the repo at /root/policyengine-us-data, but Modal |
265 | | -# auto-mounts the entrypoint elsewhere, so _parent may not contain |
266 | | -# modal_app/. Ensure the baked repo root is always importable. |
267 | | -_baked = "/root/policyengine-us-data" |
268 | | -if _baked not in sys.path: |
269 | | - sys.path.insert(0, _baked) |
| 256 | +# sys.path setup is handled at the top of this file. |
270 | 257 |
|
271 | 258 | from modal_app.data_build import app as _data_build_app |
272 | 259 | from modal_app.data_build import build_datasets |
|
0 commit comments