Skip to content

Commit 8bac1b6

Browse files
authored
Merge pull request #4 from camsys/main
Reduce test runtime
2 parents ad384fa + 7dca5fb commit 8bac1b6

File tree

3 files changed

+1
-120
lines changed

3 files changed

+1
-120
lines changed

configs/resident/external_workplace_location.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ local_dist,,_DIST@skims['DIST'],1
33
util_dist,,"@np.minimum(_DIST,10)",coef_dist_capped
44
util_size_variable,Size variable,@(df['size_term']).apply(np.log1p),coef_size
55
util_no_attractions,No attractions,@df['size_term']==0,-999
6-
mode_choice_logsum,Mode choice logsum,@df.mode_choice_logsum if 'mode_choice_logsum' in df.columns else 0,coef_mode_logsum
6+
mode_choice_logsum,Mode choice logsum,"@df.get('mode_choice_logsum', 0)",coef_mode_logsum

configs/resident/external_workplace_location_archive.csv

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/test_sandag_abm3.py

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -38,119 +38,6 @@ def regress(out_dir: Path, regress_dir: Path = None):
3838
pdt.assert_frame_equal(final_trips_df, regress_trips_df)
3939

4040

41-
def run_test_sandag_abm3(multiprocess=False, chunkless=False, sharrow=False):
42-
file_path = os.path.join(os.path.dirname(__file__), "..", "simulation.py")
43-
44-
run_args = []
45-
46-
if multiprocess:
47-
run_args.extend(
48-
[
49-
"-c",
50-
_test_path("configs_mp"),
51-
"-c",
52-
_example_path("configs_mp"),
53-
]
54-
)
55-
elif chunkless:
56-
run_args.extend(
57-
[
58-
"-c",
59-
_test_path("configs_chunkless"),
60-
]
61-
)
62-
elif sharrow:
63-
run_args.extend(
64-
[
65-
"-c",
66-
_test_path("configs_sharrow"),
67-
]
68-
)
69-
if os.environ.get("GITHUB_ACTIONS") != "true":
70-
run_args.append("--persist-sharrow-cache")
71-
else:
72-
run_args.extend(
73-
[
74-
"-c",
75-
_example_path(r"configs/resident"),
76-
]
77-
)
78-
79-
out_dir = _test_path(
80-
f"output-{'mp' if multiprocess else 'single'}"
81-
f"-{'chunkless' if chunkless else 'chunked'}"
82-
f"-{'sharrow' if sharrow else 'no_sharrow'}"
83-
)
84-
85-
# create output directory if it doesn't exist and add .gitignore
86-
Path(out_dir).mkdir(exist_ok=True)
87-
Path(out_dir).joinpath(".gitignore").write_text("**\n")
88-
89-
run_args.extend(
90-
[
91-
"-c",
92-
_example_path("configs"),
93-
"-d",
94-
_example_path("data"),
95-
"-o",
96-
out_dir,
97-
]
98-
)
99-
100-
if os.environ.get("GITHUB_ACTIONS") == "true":
101-
subprocess.run(["coverage", "run", "-a", file_path] + run_args, check=True)
102-
else:
103-
subprocess.run([sys.executable, file_path] + run_args, check=True)
104-
105-
regress(out_dir, _test_path("regress/hh500"))
106-
107-
108-
def test_sandag_abm3_cli():
109-
run_test_sandag_abm3(multiprocess=False)
110-
111-
112-
def test_sandag_abm3():
113-
from activitysim import abm # noqa: F401
114-
115-
# make a temp directory for output that will persist for review
116-
tmp_path = Path(__file__).parent.joinpath("output-test_sandag_abm3")
117-
tmp_path.mkdir(exist_ok=True)
118-
119-
state = workflow.State.make_default(
120-
configs_dir=(
121-
_example_path(r"configs/common"),
122-
_example_path(r"configs/resident"),
123-
),
124-
data_dir=_example_path("data"),
125-
output_dir=tmp_path,
126-
settings=dict(
127-
cleanup_pipeline_after_run=False,
128-
# recode_pipeline_columns=True,
129-
treat_warnings_as_errors=True,
130-
households_sample_size=100,
131-
# households_sample_size=500, == 12min 43 sec
132-
chunk_size=0,
133-
use_shadow_pricing=True,
134-
),
135-
)
136-
state.import_extensions("../extensions")
137-
state.filesystem.persist_sharrow_cache()
138-
state.run.all(resume_after=None)
139-
regress(tmp_path, _test_path("regress/hh500"))
140-
141-
142-
def test_sandag_abm3_chunkless():
143-
run_test_sandag_abm3(multiprocess=False, chunkless=True)
144-
145-
146-
def test_sandag_abm3_mp():
147-
run_test_sandag_abm3(multiprocess=True)
148-
149-
150-
def test_sandag_abm3_sharrow():
151-
run_test_sandag_abm3(sharrow=True)
152-
153-
15441
EXPECTED_MODELS = [
15542
"initialize_proto_population",
15643
"compute_disaggregate_accessibility",

0 commit comments

Comments
 (0)