Skip to content

Commit 23dc004

Browse files
committed
feat: adds pattern for settings checker using extensions
1 parent 81121b7 commit 23dc004

4 files changed

Lines changed: 66 additions & 1 deletion

File tree

configs/resident/settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ distributed_time_factor_nonwork_stddev: 0.6
154154
distributed_time_factor_min: 0.1
155155
distributed_time_factor_max: 10
156156

157+
check_model_settings: True
158+
157159
models:
158160
### mp_init_proto_pop (single process)
159161
- initialize_proto_population # Separate step so proto tables can be split for multiprocess.

configs/resident/settings_mp.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ memory_profile: False
1515
# (Shadow pricing requires fail_fast setting in multiprocessing mode)
1616
fail_fast: True
1717

18-
resume_after:
18+
resume_after:
19+
20+
check_model_settings: True
1921

2022
models:
2123
### mp_init_proto_pop (single process)

extensions/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from . import transponder_ownership
55
from . import airport_returns
66
from . import adjust_auto_operating_cost
7+
from . import settings_checker

extensions/settings_checker.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
from .av_ownership import AVOwnershipSettings
2+
from .external_identification import ExternalIdentificationSettings
3+
from .transponder_ownership import TransponderOwnershipSettings
4+
5+
from activitysim.core.configuration.base import PydanticReadable
6+
from activitysim.core.configuration.logit import (
7+
TourLocationComponentSettings,
8+
TourModeComponentSettings,
9+
)
10+
from activitysim.core.workflow import State
11+
12+
13+
14+
### SETTINGS FORMAT ###
15+
### {"<model_name>": {"settings_cls": <PydanticSettings Object>, "settings_file": "<name of YAML file"}}
16+
### If a specific Pydantic data model is not defined, map to PydanticReadable to expose .read_settings_file() method
17+
### If required, an alternate set of spec/coefficients to resolve together can be defined for a model using
18+
### "spec_coefficient_keys": [{"spec": "OUTBOUND_SPEC", "coefs": "OUTBOUND_COEFFICIENTS"}, ...]
19+
EXTENSION_CHECKER_SETTINGS = {
20+
"airport_returns": {
21+
"settings_cls": PydanticReadable,
22+
"settings_file": "airport_returns.yaml"
23+
},
24+
"av_ownership": {
25+
"settings_cls": AVOwnershipSettings,
26+
"settings_file": "av_ownership.yaml"
27+
},
28+
"external_student_identification": {
29+
"settings_cls": ExternalIdentificationSettings,
30+
"settings_file": "external_student_identification.yaml"
31+
},
32+
"external_non_mandatory_tour_identification": {
33+
"settings_cls": ExternalIdentificationSettings,
34+
"settings_file": "external_non_mandatory_identification.yaml"
35+
},
36+
"external_joint_tour_identification": {
37+
"settings_cls": ExternalIdentificationSettings,
38+
"settings_file": "external_joint_tour_identification.yaml"
39+
},
40+
"external_school_location": {
41+
"settings_cls": TourLocationComponentSettings,
42+
"settings_file": "external_school_location.yaml"
43+
},
44+
"external_workplace_location": {
45+
"settings_cls": TourLocationComponentSettings,
46+
"settings_file": "external_workplace_location.yaml"
47+
},
48+
"external_non_mandatory_destination": {
49+
"settings_cls": TourLocationComponentSettings,
50+
"settings_file": "external_non_mandatory_destination.yaml"
51+
},
52+
"external_joint_tour_destination": {
53+
"settings_cls": TourLocationComponentSettings,
54+
"settings_file": "external_joint_tour_destination.yaml"
55+
},
56+
"transponder_ownership": {
57+
"settings_cls": TransponderOwnershipSettings,
58+
"settings_file": "transponder_ownership.yaml"
59+
},
60+
}

0 commit comments

Comments
 (0)