Skip to content

Commit

Permalink
Move smartsim.settings.dispatch module under smartsim._core (#659)
Browse files Browse the repository at this point in the history
Moved smartsim.settings.dispatch module under smartsim._core. 

 [ committed by @juliaputko ]
 [ reviewed by  @MattToast , @mellis13 ]
  • Loading branch information
juliaputko authored Aug 14, 2024
1 parent 52cd8ec commit ddde9c5
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion smartsim/_core/control/launch_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion smartsim/_core/launcher/dragon/dragonLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions smartsim/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/alps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/pals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/temp_tests/test_settings/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import pytest

from smartsim.settings import dispatch
from smartsim._core import dispatch
from smartsim.settings.arguments import launchArguments as launch


Expand Down
2 changes: 1 addition & 1 deletion tests/temp_tests/test_settings/test_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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]}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_launch_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ddde9c5

Please sign in to comment.