Skip to content

Commit

Permalink
rename api.py to ensemble.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jlnav committed May 17, 2023
1 parent 3ba47cb commit 6849aec
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ jobs:
- name: Activate API unit test if using mpich
if: matrix.mpi-version == 'mpich'
run: |
mv libensemble/tests/unit_tests/mpich-only_test_api.py libensemble/tests/unit_tests/test_alt_api.py
mv libensemble/tests/unit_tests/mpich-only_test_ensemble.py libensemble/tests/unit_tests/test_ensemble.py
- name: Remove ytopt-heffte test on Python 3.11 (easy way)
if: matrix.python-version == '3.11'
Expand Down
2 changes: 1 addition & 1 deletion docs/libe_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ compatibility.

.. tab-item:: Ensemble Class

.. autoclass:: libensemble.api.Ensemble()
.. autoclass:: libensemble.ensemble.Ensemble()
:members:
:no-undoc-members:

Expand Down
8 changes: 4 additions & 4 deletions libensemble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from libensemble import logger

# try:
# from .api import Ensemble
# except ModuleNotFoundError:
# pass
try:
from .ensemble import Ensemble
except ModuleNotFoundError:
pass
2 changes: 1 addition & 1 deletion libensemble/api.py → libensemble/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def __init__(

def ready(self) -> bool:
"""Quickly verify that all necessary data has been provided"""
return all([i for i in [self.exit_criteria, self.libE_specs]])
return all([i for i in [self.exit_criteria, self.libE_specs, self.sim_specs]])

def run(self) -> (npt.NDArray, dict, int):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import numpy as np

from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble

# Main block is necessary only when using local comms with spawn start method (default on macOS and Windows).
if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble
from libensemble.executors.mpi_executor import MPIExecutor

####################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble

if __name__ == "__main__":
forces = Ensemble()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.extra
def test_ensemble_init():
"""testing init attrs"""
from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble

e = Ensemble(
libE_specs={"comms": "local", "nworkers": 4}
Expand All @@ -21,7 +21,7 @@ def test_ensemble_init():
@pytest.mark.extra
def test_from_files():
"""Test that Ensemble() specs dicts resemble setup dicts"""
from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble

for ft in ["yaml", "json", "toml"]:
e = Ensemble(libE_specs={"comms": "local", "nworkers": 4})
Expand All @@ -48,7 +48,7 @@ def test_from_files():
@pytest.mark.extra
def test_bad_func_loads():
"""Test that Ensemble() raises expected errors (with warnings) on incorrect imports"""
from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble

yaml_errors = {
"./simdir/test_example_badfuncs_attribute.yaml": AttributeError,
Expand All @@ -68,7 +68,7 @@ def test_bad_func_loads():
@pytest.mark.extra
def test_full_workflow():
"""Test initializing a workflow via Specs and Ensemble.run()"""
from libensemble.api import Ensemble
from libensemble.ensemble import Ensemble
from libensemble.specs import ExitCriteria, GenSpecs, LibeSpecs, SimSpecs

LS = LibeSpecs(comms="local", nworkers=4)
Expand Down

0 comments on commit 6849aec

Please sign in to comment.