Skip to content

Commit

Permalink
Isort/Black
Browse files Browse the repository at this point in the history
  • Loading branch information
MattToast committed Jun 26, 2024
1 parent d1a86d2 commit 5572024
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion smartsim/settings/builders/launch/alps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import StringArgument, set_check_input
from ...launchCommand import LauncherType
Expand Down
19 changes: 10 additions & 9 deletions smartsim/settings/builders/launch/dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,16 @@ def finalize(
return DragonRunRequest(
exe=exe_,
exe_args=args,
path=os.getcwd(), # FIXME: Currently this is hard coded because
# the schema requires it, but in future,
# it is almost certainly necessary that
# this will need to be injected by the
# user or by us to have the command
# execute next to any generated files. A
# similar problem exists for the other
# settings.
# TODO: Find a way to inject this path
# FIXME: Currently this is hard coded because
# the schema requires it, but in future,
# it is almost certainly necessary that
# this will need to be injected by the
# user or by us to have the command
# execute next to any generated files. A
# similar problem exists for the other
# settings.
# TODO: Find a way to inject this path
path=os.getcwd(),
env=env,
current_env=dict(os.environ),
**self._launch_args,
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/builders/launch/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import StringArgument, set_check_input
from ...launchCommand import LauncherType
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/builders/launch/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import StringArgument, set_check_input
from ...launchCommand import LauncherType
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/builders/launch/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import set_check_input
from ...launchCommand import LauncherType
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/builders/launch/pals.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import StringArgument, set_check_input
from ...launchCommand import LauncherType
Expand Down
3 changes: 2 additions & 1 deletion smartsim/settings/builders/launch/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import typing as t

from smartsim.log import get_logger
from smartsim.settings.dispatch import default_dispatcher, ShellLauncher
from smartsim.settings.dispatch import ShellLauncher, default_dispatcher

from ...common import set_check_input
from ...launchCommand import LauncherType
Expand All @@ -42,6 +42,7 @@

logger = get_logger(__name__)


@default_dispatcher.dispatch(to_launcher=ShellLauncher)
class SlurmArgBuilder(LaunchArgBuilder[t.Sequence[str]]):
def launcher_str(self) -> str:
Expand Down
5 changes: 2 additions & 3 deletions smartsim/settings/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@
from __future__ import annotations

import subprocess as sp
import uuid
import typing as t

from smartsim.error import errors
import uuid

if t.TYPE_CHECKING:
from typing_extensions import Self

from smartsim.experiment import Experiment
from smartsim.settings.builders import LaunchArgBuilder

Expand Down
4 changes: 3 additions & 1 deletion smartsim/settings/launchSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def env_vars(self, value: t.Dict[str, str]) -> None:
"""Set the environment variables."""
self._env_vars = copy.deepcopy(value)

def _get_arg_builder(self, launch_args: StringArgument | None) -> LaunchArgBuilder[t.Any]:
def _get_arg_builder(
self, launch_args: StringArgument | None
) -> LaunchArgBuilder[t.Any]:
"""Map the Launcher to the LaunchArgBuilder"""
if self._launcher == LauncherType.Slurm:
return SlurmArgBuilder(launch_args)
Expand Down
5 changes: 3 additions & 2 deletions tests/temp_tests/test_settings/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import pytest
from unittest.mock import Mock

from smartsim.settings.builders import launchArgBuilder as launch
import pytest

from smartsim.settings import dispatch
from smartsim.settings.builders import launchArgBuilder as launch


@pytest.fixture
Expand Down
5 changes: 4 additions & 1 deletion tests/temp_tests/test_settings/test_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import contextlib

import pytest

from smartsim.settings import dispatch

import contextlib
pytestmark = pytest.mark.group_a


def test_declaritive_form_dispatch_declaration(launcher_like, settings_builder):
Expand Down

0 comments on commit 5572024

Please sign in to comment.