diff --git a/smartsim/_core/control/launch_history.py b/smartsim/_core/control/launch_history.py index 28b8a6f86..b8b9f4c7e 100644 --- a/smartsim/_core/control/launch_history.py +++ b/smartsim/_core/control/launch_history.py @@ -32,7 +32,7 @@ from smartsim._core.utils import helpers as _helpers if t.TYPE_CHECKING: - from smartsim.settings.dispatch import LauncherProtocol + from smartsim._core.dispatch import LauncherProtocol from smartsim.types import LaunchedJobID diff --git a/smartsim/settings/dispatch.py b/smartsim/_core/dispatch.py similarity index 100% rename from smartsim/settings/dispatch.py rename to smartsim/_core/dispatch.py diff --git a/smartsim/_core/launcher/dragon/dragonLauncher.py b/smartsim/_core/launcher/dragon/dragonLauncher.py index 992707959..26a3d3daf 100644 --- a/smartsim/_core/launcher/dragon/dragonLauncher.py +++ b/smartsim/_core/launcher/dragon/dragonLauncher.py @@ -355,12 +355,13 @@ def _assert_schema_type(obj: object, typ: t.Type[_SchemaT], /) -> _SchemaT: return obj +from smartsim._core.dispatch import ExecutableProtocol, dispatch + # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # TODO: Remove this registry and move back to builder file after fixing # circular import caused by `DragonLauncher.supported_rs` # ----------------------------------------------------------------------------- from smartsim.settings.arguments.launch.dragon import DragonLaunchArguments -from smartsim.settings.dispatch import ExecutableProtocol, dispatch def _as_run_request_args_and_policy( diff --git a/smartsim/experiment.py b/smartsim/experiment.py index 03e3012ee..55ccea7b5 100644 --- a/smartsim/experiment.py +++ b/smartsim/experiment.py @@ -40,10 +40,10 @@ from tabulate import tabulate +from smartsim._core import dispatch from smartsim._core.config import CONFIG from smartsim._core.control.launch_history import LaunchHistory as _LaunchHistory from smartsim.error import errors -from smartsim.settings import dispatch from smartsim.status import InvalidJobStatus, JobStatus from ._core import Controller, Generator, Manifest, previewrenderer @@ -59,8 +59,8 @@ from .log import ctx_exp_path, get_logger, method_contextualizer if t.TYPE_CHECKING: + from smartsim._core.dispatch import ExecutableProtocol from smartsim.launchable.job import Job - from smartsim.settings.dispatch import ExecutableProtocol from smartsim.types import LaunchedJobID logger = get_logger(__name__) diff --git a/smartsim/settings/arguments/launch/alps.py b/smartsim/settings/arguments/launch/alps.py index 1879dd102..6375a4141 100644 --- a/smartsim/settings/arguments/launch/alps.py +++ b/smartsim/settings/arguments/launch/alps.py @@ -28,8 +28,8 @@ import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import set_check_input from ...launchCommand import LauncherType diff --git a/smartsim/settings/arguments/launch/local.py b/smartsim/settings/arguments/launch/local.py index 0bbba2584..97b300bce 100644 --- a/smartsim/settings/arguments/launch/local.py +++ b/smartsim/settings/arguments/launch/local.py @@ -28,8 +28,8 @@ import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import StringArgument, set_check_input from ...launchCommand import LauncherType diff --git a/smartsim/settings/arguments/launch/lsf.py b/smartsim/settings/arguments/launch/lsf.py index 80cd748f1..34db91ff2 100644 --- a/smartsim/settings/arguments/launch/lsf.py +++ b/smartsim/settings/arguments/launch/lsf.py @@ -28,8 +28,8 @@ import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import set_check_input from ...launchCommand import LauncherType diff --git a/smartsim/settings/arguments/launch/mpi.py b/smartsim/settings/arguments/launch/mpi.py index 85fd38145..04ae55b57 100644 --- a/smartsim/settings/arguments/launch/mpi.py +++ b/smartsim/settings/arguments/launch/mpi.py @@ -28,8 +28,8 @@ import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import set_check_input from ...launchCommand import LauncherType diff --git a/smartsim/settings/arguments/launch/pals.py b/smartsim/settings/arguments/launch/pals.py index 3132f1b02..2727e47d5 100644 --- a/smartsim/settings/arguments/launch/pals.py +++ b/smartsim/settings/arguments/launch/pals.py @@ -28,8 +28,8 @@ import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import set_check_input from ...launchCommand import LauncherType diff --git a/smartsim/settings/arguments/launch/slurm.py b/smartsim/settings/arguments/launch/slurm.py index ac485b7c8..0e057e386 100644 --- a/smartsim/settings/arguments/launch/slurm.py +++ b/smartsim/settings/arguments/launch/slurm.py @@ -30,8 +30,8 @@ import re import typing as t +from smartsim._core.dispatch import ShellLauncher, dispatch, make_shell_format_fn from smartsim.log import get_logger -from smartsim.settings.dispatch import ShellLauncher, dispatch, make_shell_format_fn from ...common import set_check_input from ...launchCommand import LauncherType diff --git a/tests/temp_tests/test_settings/conftest.py b/tests/temp_tests/test_settings/conftest.py index 834fdf987..d5e66e94d 100644 --- a/tests/temp_tests/test_settings/conftest.py +++ b/tests/temp_tests/test_settings/conftest.py @@ -26,7 +26,7 @@ import pytest -from smartsim.settings import dispatch +from smartsim._core import dispatch from smartsim.settings.arguments import launchArguments as launch diff --git a/tests/temp_tests/test_settings/test_dispatch.py b/tests/temp_tests/test_settings/test_dispatch.py index cbb8ca3c4..db346ab98 100644 --- a/tests/temp_tests/test_settings/test_dispatch.py +++ b/tests/temp_tests/test_settings/test_dispatch.py @@ -32,8 +32,8 @@ import pytest +from smartsim._core import dispatch from smartsim.error import errors -from smartsim.settings import dispatch pytestmark = pytest.mark.group_a diff --git a/tests/test_experiment.py b/tests/test_experiment.py index fd71f9e99..8671bfedb 100644 --- a/tests/test_experiment.py +++ b/tests/test_experiment.py @@ -35,11 +35,12 @@ import pytest +from smartsim._core import dispatch from smartsim._core.control.launch_history import LaunchHistory from smartsim.entity import _mock, entity from smartsim.experiment import Experiment from smartsim.launchable import job -from smartsim.settings import dispatch, launchSettings +from smartsim.settings import launchSettings from smartsim.settings.arguments import launchArguments from smartsim.status import InvalidJobStatus, JobStatus diff --git a/tests/test_generator.py b/tests/test_generator.py index 13d163fc1..4ecda339b 100644 --- a/tests/test_generator.py +++ b/tests/test_generator.py @@ -10,11 +10,12 @@ import pytest from smartsim import Experiment +from smartsim._core import dispatch from smartsim._core.generation.generator import Generator from smartsim.entity import Application, Ensemble, SmartSimEntity, _mock from smartsim.entity.files import EntityFiles from smartsim.launchable import Job -from smartsim.settings import LaunchSettings, dispatch +from smartsim.settings import LaunchSettings # TODO Add JobGroup tests when JobGroup becomes a Launchable @@ -258,7 +259,7 @@ def test_generate_ensemble_directory(wlmutils, generator_instance): def test_generate_ensemble_directory_start(test_dir, wlmutils, monkeypatch): monkeypatch.setattr( - "smartsim.settings.dispatch._LauncherAdapter.start", + "smartsim._core.dispatch._LauncherAdapter.start", lambda launch, exe, job_execution_path, env: random_id(), ) ensemble = Ensemble("ensemble-name", "echo", replicas=2) @@ -278,7 +279,7 @@ def test_generate_ensemble_directory_start(test_dir, wlmutils, monkeypatch): def test_generate_ensemble_copy(test_dir, wlmutils, monkeypatch, get_gen_copy_dir): monkeypatch.setattr( - "smartsim.settings.dispatch._LauncherAdapter.start", + "smartsim._core.dispatch._LauncherAdapter.start", lambda launch, exe, job_execution_path, env: random_id(), ) ensemble = Ensemble( @@ -300,7 +301,7 @@ def test_generate_ensemble_symlink( test_dir, wlmutils, monkeypatch, get_gen_symlink_dir ): monkeypatch.setattr( - "smartsim.settings.dispatch._LauncherAdapter.start", + "smartsim._core.dispatch._LauncherAdapter.start", lambda launch, exe, job_execution_path, env: random_id(), ) ensemble = Ensemble( @@ -327,7 +328,7 @@ def test_generate_ensemble_configure( test_dir, wlmutils, monkeypatch, get_gen_configure_dir ): monkeypatch.setattr( - "smartsim.settings.dispatch._LauncherAdapter.start", + "smartsim._core.dispatch._LauncherAdapter.start", lambda launch, exe, job_execution_path, env: random_id(), ) params = {"PARAM0": [0, 1], "PARAM1": [2, 3]} diff --git a/tests/test_launch_history.py b/tests/test_launch_history.py index fb0274cc2..d076e41a3 100644 --- a/tests/test_launch_history.py +++ b/tests/test_launch_history.py @@ -30,7 +30,7 @@ import pytest from smartsim._core.control.launch_history import LaunchHistory -from smartsim.settings.dispatch import LauncherProtocol, create_job_id +from smartsim._core.dispatch import LauncherProtocol, create_job_id pytestmark = pytest.mark.group_a