Skip to content

Commit 2f407af

Browse files
cleanup
1 parent c0fd05e commit 2f407af

1 file changed

Lines changed: 4 additions & 57 deletions

File tree

activitysim/core/calibration.py

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -356,33 +356,6 @@ def _resolve_checkpoint_name(
356356
)
357357

358358

359-
def _effective_resume_index(
360-
state: workflow.State,
361-
checkpoint_name: str,
362-
) -> int:
363-
"""Return the index of the last model covered by a checkpoint.
364-
365-
For model-level checkpoints this is the model's own index in
366-
``settings.models``. For step-level checkpoints this is the index of
367-
the last model in the enclosing multiprocess step.
368-
"""
369-
all_models = state.settings.models
370-
if checkpoint_name in all_models:
371-
return all_models.index(checkpoint_name)
372-
373-
mp_steps = state.settings.multiprocess_steps or []
374-
step_boundaries = [all_models.index(s.begin) for s in mp_steps]
375-
step_boundaries.append(len(all_models))
376-
377-
for i, step in enumerate(mp_steps):
378-
if step.name == checkpoint_name or (
379-
checkpoint_name.startswith(f"calibration_{step.name}")
380-
):
381-
return step_boundaries[i + 1] - 1
382-
383-
return -1
384-
385-
386359
def _run_precursor_components(
387360
state: workflow.State,
388361
models: list[str],
@@ -1531,36 +1504,10 @@ def _run_in_configured_mode(
15311504
state.checkpoint.add(original_last_model)
15321505
return
15331506

1534-
# Single-process mode: resolve resume_after to an existing checkpoint
1535-
# when the pipeline has step-level checkpoints from a prior multiprocess
1536-
# run (model-level checkpoints won't exist in that pipeline).
1537-
if resume_after:
1538-
pipeline_path = state.checkpoint.default_pipeline_file_path()
1539-
try:
1540-
checkpoint_names = _get_pipeline_checkpoint_names(
1541-
state, pipeline_path
1542-
)
1543-
except Exception:
1544-
checkpoint_names = []
1545-
1546-
if checkpoint_names and resume_after not in checkpoint_names:
1547-
resolved = _resolve_checkpoint_name(
1548-
state, resume_after, checkpoint_names
1549-
)
1550-
# The resolved checkpoint may cover more models than
1551-
# resume_after — trim the models list accordingly.
1552-
end_idx = _effective_resume_index(state, resolved)
1553-
if end_idx >= 0:
1554-
all_models = state.settings.models
1555-
models = [m for m in models if all_models.index(m) > end_idx]
1556-
1557-
if not models:
1558-
state.checkpoint.restore(resolved)
1559-
state.checkpoint.add(original_last_model)
1560-
return
1561-
1562-
resume_after = resolved
1563-
1507+
# Single-process mode: pass resume_after directly to the runner.
1508+
# Single-process pipelines use model-level checkpoint names, so the
1509+
# model name should exist as-is. Cross-mode resume (single-process
1510+
# resuming from a multiprocess pipeline) is not supported.
15641511
state.run(
15651512
models=models,
15661513
resume_after=resume_after,

0 commit comments

Comments
 (0)