Skip to content

Commit e1ee193

Browse files
committed
Reclasified error when a step is run more than once from TableSlicingError to DuplicateWorkflowNameError
1 parent dde2b6f commit e1ee193

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

activitysim/abm/test/test_pipeline/test_pipeline.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
import pytest
1414

1515
from activitysim.core import random, tracing, workflow
16-
from activitysim.core.exceptions import CheckpointNameNotFoundError, TableSlicingError
16+
from activitysim.core.exceptions import (
17+
CheckpointNameNotFoundError,
18+
DuplicateWorkflowNameError,
19+
)
1720

1821
# set the max households for all tests (this is to limit memory use on travis)
1922
HOUSEHOLDS_SAMPLE_SIZE = 50
@@ -236,7 +239,7 @@ def test_mini_pipeline_run2():
236239
regress_mini_auto(state)
237240

238241
# try to run a model already in pipeline
239-
with pytest.raises(TableSlicingError) as excinfo:
242+
with pytest.raises(DuplicateWorkflowNameError) as excinfo:
240243
state.run.by_name("auto_ownership_simulate")
241244
assert "run model 'auto_ownership_simulate' more than once" in str(excinfo.value)
242245

activitysim/core/workflow/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import timedelta
88

99
from activitysim.core import tracing
10-
from activitysim.core.exceptions import DuplicateWorkflowNameError, TableSlicingError
10+
from activitysim.core.exceptions import DuplicateWorkflowNameError
1111
from activitysim.core.workflow.accessor import FromState, StateAccessor
1212
from activitysim.core.workflow.checkpoint import (
1313
CHECKPOINT_NAME,
@@ -265,7 +265,7 @@ def _pre_run_step(self, model_name: str) -> bool | None:
265265
if model_name in checkpointed_models:
266266
if self._obj.settings.duplicate_step_execution == "error":
267267
checkpointed_model_bullets = "\n - ".join(checkpointed_models)
268-
raise TableSlicingError(
268+
raise DuplicateWorkflowNameError(
269269
f"Checkpointed Models:\n - {checkpointed_model_bullets}\n"
270270
f"Cannot run model '{model_name}' more than once"
271271
)

0 commit comments

Comments
 (0)