Skip to content

Commit

Permalink
convert create_[ensemble|model] into instance methods; ignore no-self…
Browse files Browse the repository at this point in the history
…-use
  • Loading branch information
ankona committed Jan 8, 2024
1 parent b35cf37 commit 1fdf37c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions smartsim/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def _exp_path_map(exp: "Experiment") -> str:
_exp_contextualize = method_contextualizer(ctx_exp_path, _exp_path_map)


# pylint: disable=no-self-use
class Experiment:
"""Experiments are the Python user interface for SmartSim.
Expand Down Expand Up @@ -141,12 +142,6 @@ def __init__(
self._launcher = launcher.lower()
self.db_identifiers: t.Set[str] = set()

# # TODO: Still need this loop for the moment for `staticmethods` :(
# ctx_fns = ["create_ensemble", "create_model"]
# for fn_name in ctx_fns:
# fn = getattr(self, fn_name)
# setattr(self, fn_name, contextualize(fn))

@_exp_contextualize
def start(
self,
Expand Down Expand Up @@ -406,9 +401,9 @@ def get_status(self, *args: t.Any) -> t.List[str]:
logger.error(e)
raise

@staticmethod
# TODO: Need to figure out if/how to decorate this
@_exp_contextualize
def create_ensemble(
self,
name: str,
params: t.Optional[t.Dict[str, t.Any]] = None,
batch_settings: t.Optional[base.BatchSettings] = None,
Expand Down Expand Up @@ -481,9 +476,9 @@ def create_ensemble(
logger.error(e)
raise

@staticmethod
# TODO: Need to figure out if/how to decorate this
@_exp_contextualize
def create_model(
self,
name: str,
run_settings: base.RunSettings,
params: t.Optional[t.Dict[str, t.Any]] = None,
Expand Down

0 comments on commit 1fdf37c

Please sign in to comment.