Skip to content

Commit 73a89ca

Browse files
committed
testing updates
school escort seems to interact poorly with pipeline recoding
1 parent 08b864a commit 73a89ca

File tree

5 files changed

+102
-15
lines changed

5 files changed

+102
-15
lines changed

test/ext-configs/settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ output_tables:
4242
- vehicles
4343
- proto_disaggregate_accessibility
4444

45-
recode_pipeline_columns: False
45+
recode_pipeline_columns: True
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
inherit_settings: True
2+
3+
# read cached skims (using numpy memmap) from output directory (memmap is faster than omx )
4+
read_skim_cache: False
5+
# write memmapped cached skims to output directory after reading from omx, for use in subsequent runs
6+
write_skim_cache: False
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
inherit_settings: True
2+
3+
# treat warnings as errors
4+
strict: True
5+
6+
# number of households to simulate
7+
households_sample_size: 10
8+
chunk_size: 0
9+
chunk_training_mode: disabled
10+
11+
# - shadow pricing global switches
12+
use_shadow_pricing: False
13+
14+
# turn writing of sample_tables on and off for all models
15+
# (if True, tables will be written if DEST_CHOICE_SAMPLE_TABLE_NAME is specified in individual model settings)
16+
want_dest_choice_sample_tables: False
17+
18+
cleanup_pipeline_after_run: True
19+
20+
output_tables:
21+
h5_store: False
22+
action: include
23+
prefix: final_
24+
sort: True
25+
tables:
26+
- tablename: trips
27+
decode_columns:
28+
origin: land_use.zone_id
29+
destination: land_use.zone_id
30+
31+
recode_pipeline_columns: True

test/ext-configs_mp/settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ trace_hh_id:
2929
# global switch to turn on or off presampling of destination alternatives at TAZ level (multizone models only)
3030
want_dest_choice_presampling: True
3131

32-
recode_pipeline_columns: False
32+
recode_pipeline_columns: True
3333

3434
output_tables:
3535
h5_store: False

test/test_mtc.py

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def run_test_mtc(
2525
multiprocess=False, chunkless=False, recode=False, sharrow=False, extended=False
2626
):
2727

28-
def regress(ext):
28+
def regress(ext, out_dir):
2929
if ext:
3030
regress_trips_df = pd.read_csv(_test_path("regress/final_trips-ext.csv"))
3131
else:
3232
regress_trips_df = pd.read_csv(_test_path("regress/final_trips.csv"))
33-
final_trips_df = pd.read_csv(_test_path("output/final_trips.csv"))
33+
final_trips_df = pd.read_csv(_test_path(out_dir.joinpath("final_trips.csv")))
3434

3535
# column order may not match, so fix it before checking
3636
assert sorted(regress_trips_df.columns) == sorted(final_trips_df.columns)
@@ -65,12 +65,20 @@ def regress(ext):
6565
]
6666
)
6767
elif chunkless:
68-
run_args.extend(
69-
[
70-
"-c",
71-
_test_path("configs_chunkless"),
72-
]
73-
)
68+
if extended:
69+
run_args.extend(
70+
[
71+
"-c",
72+
_test_path("ext-configs_chunkless"),
73+
]
74+
)
75+
else:
76+
run_args.extend(
77+
[
78+
"-c",
79+
_test_path("configs_chunkless"),
80+
]
81+
)
7482
elif recode:
7583
run_args.extend(
7684
[
@@ -136,7 +144,7 @@ def regress(ext):
136144
else:
137145
subprocess.run([sys.executable, file_path] + run_args, check=True)
138146

139-
regress(extended)
147+
regress(extended, Path(out_dir))
140148

141149

142150
def test_mtc():
@@ -171,10 +179,6 @@ def test_mtc_mp_ext():
171179
run_test_mtc(multiprocess=True, extended=True)
172180

173181

174-
def test_mtc_recode_ext():
175-
run_test_mtc(recode=True, extended=True)
176-
177-
178182
def test_mtc_sharrow_ext():
179183
run_test_mtc(sharrow=True, extended=True)
180184

@@ -244,6 +248,8 @@ def test_mtc_extended_progressive():
244248
output_dir=out_dir,
245249
)
246250
state.filesystem.persist_sharrow_cache()
251+
state.logging.config_logger()
252+
state.settings.trace_hh_id = 1196298
247253

248254
assert state.settings.models == EXPECTED_MODELS
249255
assert state.settings.chunk_size == 0
@@ -263,6 +269,50 @@ def test_mtc_extended_progressive():
263269
print(f"> prototype_mtc_extended {step_name}: ok")
264270

265271

272+
@testing.run_if_exists("reference-pipeline-extended.zip")
273+
def test_mtc_extended_progressive_chunkless():
274+
275+
import activitysim.abm # register components # noqa: F401
276+
277+
out_dir = _test_path("output-progressive-2")
278+
Path(out_dir).mkdir(exist_ok=True)
279+
Path(out_dir).joinpath(".gitignore").write_text("**\n")
280+
281+
state = workflow.State.make_default(
282+
configs_dir=(
283+
_test_path("configs_chunkless"),
284+
_test_path("ext-configs"),
285+
_example_path("ext-configs"),
286+
_test_path("configs"),
287+
_example_path("configs"),
288+
),
289+
data_dir=_example_path("data"),
290+
data_model_dir=_example_path("data_model"),
291+
output_dir=out_dir,
292+
)
293+
state.filesystem.persist_sharrow_cache()
294+
state.logging.config_logger()
295+
state.settings.trace_hh_id = 1196298
296+
297+
assert state.settings.models == EXPECTED_MODELS
298+
assert state.settings.chunk_size == 0
299+
assert not state.settings.sharrow
300+
301+
for step_name in EXPECTED_MODELS:
302+
state.run.by_name(step_name)
303+
try:
304+
pass
305+
# state.checkpoint.check_against(
306+
# Path(__file__).parent.joinpath("reference-pipeline-extended.zip"),
307+
# checkpoint_name=step_name,
308+
# )
309+
except Exception:
310+
print(f"> prototype_mtc_extended {step_name}: ERROR")
311+
raise
312+
else:
313+
print(f"> prototype_mtc_extended {step_name}: ok")
314+
315+
266316
if __name__ == "__main__":
267317
run_test_mtc(multiprocess=False)
268318
run_test_mtc(multiprocess=True)

0 commit comments

Comments
 (0)