-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
speed up notebooks on github actions by lower pop size (#501)
* speed up notebooks on github actions by lower pop size * test sth * test sth else * test sth else * test sth else * test sth else * test sth else * test sth else * test sth else * test sth else * add nbs * add nbs * add nbs * refactor placement * fix rename
- Loading branch information
1 parent
020f89f
commit bc8720f
Showing
5 changed files
with
116 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,10 @@ | |
ParTrafo, | ||
) | ||
|
||
from .test import ( | ||
bound_pop_size_from_env, | ||
) | ||
|
||
from .log import ( | ||
log_samples, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Util functions for tests.""" | ||
|
||
import os | ||
import logging | ||
|
||
# maximum population size environment variable | ||
PYABC_MAX_POP_SIZE = "PYABC_MAX_POP_SIZE" | ||
|
||
logger = logging.getLogger("ABC.Util") | ||
|
||
|
||
def bound_pop_size_from_env(pop_size: int): | ||
"""Bound population size if corresponding environment variable set. | ||
Parameters | ||
---------- | ||
pop_size: Intended population size | ||
Returns | ||
------- | ||
bounded_pop_size: | ||
Minimum of `pop_size` and environment variable `PYABC_MAX_POP_SIZE`. | ||
""" | ||
if PYABC_MAX_POP_SIZE not in os.environ: | ||
return pop_size | ||
pop_size = min(pop_size, int(os.environ[PYABC_MAX_POP_SIZE])) | ||
|
||
logger.warning( | ||
f"Bounding population size to {pop_size} via environment variable " | ||
f"{PYABC_MAX_POP_SIZE}") | ||
|
||
return pop_size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters