From 74523b882bc82a54fbb7781398bfe45e17a68185 Mon Sep 17 00:00:00 2001 From: Madeline Scyphers Date: Thu, 7 Sep 2023 23:51:20 -0400 Subject: [PATCH] rename async opt file, remove old controller constructor from path --- boa/{async-opt.py => _async_opt.py} | 1 + boa/controller.py | 15 --------------- tests/integration_tests/test_async-opt.py | 5 +++++ 3 files changed, 6 insertions(+), 15 deletions(-) rename boa/{async-opt.py => _async_opt.py} (99%) create mode 100644 tests/integration_tests/test_async-opt.py diff --git a/boa/async-opt.py b/boa/_async_opt.py similarity index 99% rename from boa/async-opt.py rename to boa/_async_opt.py index 1339533..7e20379 100644 --- a/boa/async-opt.py +++ b/boa/_async_opt.py @@ -1,3 +1,4 @@ +# weird file name with dash in it because CLI conventions import dataclasses import os import sys diff --git a/boa/controller.py b/boa/controller.py index 480ff74..fef484f 100644 --- a/boa/controller.py +++ b/boa/controller.py @@ -23,7 +23,6 @@ from boa.logger import get_logger from boa.runner import WrappedJobRunner from boa.scheduler import Scheduler -from boa.storage import scheduler_from_json_file from boa.utils import yaml_dump from boa.wrappers.base_wrapper import BaseWrapper from boa.wrappers.wrapper_utils import get_dt_now_as_str, initialize_wrapper @@ -89,20 +88,6 @@ def __init__( self.experiment: Experiment = None self.scheduler: Scheduler = None - @classmethod - def from_scheduler_path(cls, scheduler_path, working_dir=None, **kwargs): - scheduler = scheduler_from_json_file(scheduler_path, **kwargs) - wrapper = scheduler.experiment.runner.wrapper - - inst = cls(wrapper=wrapper, working_dir=working_dir, **kwargs) - inst.logger.info(f"Resuming optimization from scheduler path: {scheduler_path}") - if inst.wrapper.config_path: - inst.logger.info(f"Config path: {inst.wrapper.config_path}") - - inst.scheduler = scheduler - inst.experiment = scheduler.experiment - return inst - @classmethod def from_scheduler(cls, scheduler, working_dir=None, **kwargs): wrapper = scheduler.experiment.runner.wrapper diff --git a/tests/integration_tests/test_async-opt.py b/tests/integration_tests/test_async-opt.py new file mode 100644 index 0000000..fd231cb --- /dev/null +++ b/tests/integration_tests/test_async-opt.py @@ -0,0 +1,5 @@ +from tests.conftest import TEST_CONFIG_DIR + + +def test_async_with_no_gen_strat(): + config_path = TEST_CONFIG_DIR / "test_config_pass_through_metric.yaml"