Skip to content

Commit faa9d56

Browse files
anth-volkclaude
andcommitted
Describe the dispatch, the report function and other_call as they work
From the extra review of the reworked 1.06: run_dispatch still said a new call's first check is due shortly (it is the safety check's, one interval later) and that the recording loop collects a call whose record is unknown; report_call_ended's docstring said the reported call has always returned when sim asks Modal (usually it has; otherwise sim answers still_running and the function reports again); and other_call is also the answer for runs that finished without holding any call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1b81c54 commit faa9d56

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

  • libs/policyengine-simulation-contract/src/policyengine_simulation_contract
  • projects
    • policyengine-simulation-entry/src/policyengine_simulation_entry
    • policyengine-simulation-executor/src/modal

‎libs/policyengine-simulation-contract/src/policyengine_simulation_contract/call_reports.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class CallReportStatus(StrEnum):
9090
NOT_CONFIGURED = "not_configured"
9191
# No run, or not every run, the report names exists.
9292
UNKNOWN_RUNS = "unknown_runs"
93-
# The runs hold another Modal call.
93+
# The runs hold another Modal call, or finished without holding one (for
94+
# example failed as abandoned before the call's ID was stored).
9495
OTHER_CALL = "other_call"
9596

9697

‎projects/policyengine-simulation-entry/src/policyengine_simulation_entry/run_dispatch.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
1. claim: move the runs from ``pending`` to ``dispatching``. Only the instance
66
whose claim changes them goes on; every other caller stops here.
77
2. spawn the Modal call and wait only for Modal's acknowledgement.
8-
3. record the call ID, moving the runs to ``running`` with their first check
9-
due shortly; or, when Modal refused the call, fail them.
8+
3. record the call ID, moving the runs to ``running``, with the safety
9+
check's first look due one interval later (the call itself reports when
10+
it ends); or, when starting the call raised, fail them.
1011
11-
If the instance stops between 1 and 3, the runs stay ``dispatching`` until a
12-
recording pass fails them as abandoned. No route starts calls yet.
12+
If the instance stops between 1 and 3, the runs stay ``dispatching`` until the
13+
safety check fails them as abandoned. No route starts calls yet.
1314
"""
1415

1516
from __future__ import annotations
@@ -59,8 +60,9 @@ class DispatchOutcome(StrEnum):
5960
# cancelled.
6061
NOT_RECORDED = "not_recorded"
6162
# Recording the call raised and the database could not say whether the
62-
# record committed; the call is left running. If it did, the recording
63-
# loop collects the call; if not, the runs are failed as abandoned.
63+
# record committed; the call is left running. If it did, the call's report
64+
# or the safety check records its outcome; if not, the safety check fails
65+
# the runs as abandoned.
6466
RECORD_UNKNOWN = "record_unknown"
6567

6668

‎projects/policyengine-simulation-executor/src/modal/v2_app.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,10 @@ def report_call_ended(report: dict) -> str:
520520
"""Tell sim that the call in ``report`` ended; return how that went.
521521
522522
The v2 functions start this as their last step
523-
(``src.modal.call_reports.reporting_call_end``), so the reported call
524-
has returned by the time sim asks Modal for its outcome.
523+
(``src.modal.call_reports.reporting_call_end``) and then return, so the
524+
reported call has usually returned by the time sim asks Modal for its
525+
outcome; when it has not, sim answers still_running and this reports
526+
again after a wait.
525527
"""
526528
from src.modal.call_reports import ( # noqa: PLC0415 # Modal function body: loaded in the worker container, not at deploy time
527529
send_call_ended_report_from_container,

0 commit comments

Comments
 (0)