Skip to content

Commit

Permalink
batch_run: Default to 1 processes
Browse files Browse the repository at this point in the history
This is a BREAKING CHANGE
  • Loading branch information
rht committed May 1, 2022
1 parent def2c1b commit 34588ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions mesa/batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
def batch_run(
model_cls: Type[Model],
parameters: Mapping[str, Union[Any, Iterable[Any]]],
number_processes: Optional[int] = None,
# We still retain the Optional[int] because users may set it to None (i.e. use all CPUs)
number_processes: Optional[int] = 1,
iterations: int = 1,
data_collection_period: int = -1,
max_steps: int = 1000,
Expand All @@ -50,7 +51,7 @@ def batch_run(
parameters : Mapping[str, Union[Any, Iterable[Any]]],
Dictionary with model parameters over which to run the model. You can either pass single values or iterables.
number_processes : int, optional
Number of processes used. Set to None (default) to use all available processors
Number of processes used, by default 1. Set this to None if you want to use all CPUs.
iterations : int, optional
Number of iterations for each parameter combination, by default 1
data_collection_period : int, optional
Expand Down
4 changes: 2 additions & 2 deletions tests/test_batch_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ def test_batch_run_no_agent_reporters():
]


def test_batch_run_single_core():
batch_run(MockModel, {}, number_processes=1, iterations=10)
def test_batch_run_multi_core():
batch_run(MockModel, {}, number_processes=2, iterations=10)

0 comments on commit 34588ed

Please sign in to comment.