Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9e99ffe
initial push
amandarichardsonn May 16, 2024
a2a3d31
updating
amandarichardsonn May 16, 2024
9c53664
lsf and dragon updates
amandarichardsonn May 16, 2024
3a9981e
alps updates
amandarichardsonn May 16, 2024
0937220
updates to slurm and pals
amandarichardsonn May 16, 2024
3354e3d
updates to pbs and slurm
amandarichardsonn May 17, 2024
2145523
delete unused
amandarichardsonn May 17, 2024
b85d6be
run arguments prevented
amandarichardsonn May 20, 2024
ad26d11
set updated
amandarichardsonn May 20, 2024
69899de
set tests added
amandarichardsonn May 20, 2024
5f99def
solve some mypy errors
amandarichardsonn May 20, 2024
833bcdb
mypy error
amandarichardsonn May 20, 2024
6edf7b1
mypy updates
amandarichardsonn May 20, 2024
7e967cc
het group method added
amandarichardsonn May 20, 2024
5d18460
resources
amandarichardsonn May 20, 2024
554dc58
fixing up tests
amandarichardsonn May 20, 2024
799b020
remove unused import
amandarichardsonn May 20, 2024
053eac0
commands
amandarichardsonn May 23, 2024
d893d7c
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn May 23, 2024
1681848
command implementation
amandarichardsonn May 23, 2024
acf37e3
commandList added
amandarichardsonn May 23, 2024
2f48f5a
str dunder
amandarichardsonn May 23, 2024
119903e
remove unused imports
amandarichardsonn May 23, 2024
804786a
copyright
amandarichardsonn May 23, 2024
c6e74c0
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn May 27, 2024
faf2d15
move tests
amandarichardsonn May 28, 2024
fe97911
Matts comments
amandarichardsonn May 29, 2024
bdce4bd
launch commands
amandarichardsonn May 29, 2024
60cad54
chnages
amandarichardsonn Jun 5, 2024
26ca1ea
mock imports
amandarichardsonn Jun 5, 2024
a743491
chnage testing
amandarichardsonn Jun 5, 2024
9fdfca7
test
amandarichardsonn Jun 5, 2024
1b9e650
chnages
amandarichardsonn Jun 5, 2024
f79176f
fixes
amandarichardsonn Jun 6, 2024
d756c78
mypy errors
amandarichardsonn Jun 6, 2024
9d6d06d
str tests
amandarichardsonn Jun 6, 2024
af5b23b
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn Jun 11, 2024
603bd0a
pushing
amandarichardsonn Jun 11, 2024
bbc1332
make style chnages
amandarichardsonn Jun 11, 2024
1ea4489
c
amandarichardsonn Jun 11, 2024
b862095
init changes
amandarichardsonn Jun 11, 2024
0e9c287
isort will be the death of me
amandarichardsonn Jun 11, 2024
bde5594
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn Jun 12, 2024
2765805
commit
amandarichardsonn Jun 12, 2024
bf87114
chnages
amandarichardsonn Jun 12, 2024
72987b4
issue when building
amandarichardsonn Jun 12, 2024
ffd95d7
matt comment
amandarichardsonn Jun 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@
from smartsim.entity import Application
from smartsim.error import SSConfigError, SSInternalError
from smartsim.log import get_logger
from smartsim.settings import (
AprunSettings,
DragonRunSettings,
JsrunSettings,
MpiexecSettings,
MpirunSettings,
PalsMpiexecSettings,
RunSettings,
SrunSettings,
)
# Mock imports
class AprunSettings: pass
class DragonRunSettings: pass
class JsrunSettings: pass
class MpiexecSettings: pass
class MpirunSettings: pass
class PalsMpiexecSettings: pass
class RunSettings: pass
class SrunSettings: pass

logger = get_logger(__name__)

Expand Down
29 changes: 29 additions & 0 deletions smartsim/_core/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# BSD 2-Clause License
#
# Copyright (c) 2021-2024, Hewlett Packard Enterprise
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# 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.

from .command import Command
from .commandList import CommandList
from .launchCommands import LaunchCommands
78 changes: 78 additions & 0 deletions smartsim/_core/commands/command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# BSD 2-Clause License
#
# Copyright (c) 2021-2024, Hewlett Packard Enterprise
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# 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 typing as t
from collections.abc import MutableSequence

from ...settings.launchCommand import LauncherType


class Command(MutableSequence[str]):
"""Basic container for command information"""

def __init__(self, launcher: LauncherType, command: t.List[str]) -> None:
"""Command constructor"""
self._launcher = launcher
self._command = command

@property
def launcher(self) -> LauncherType:
"""Get the launcher type.
Return a reference to the LauncherType.
"""
return self._launcher

@property
def command(self) -> t.List[str]:
"""Get the command list.
Return a reference to the command list.
"""
return self._command

def __getitem__(self, idx: int) -> str:
"""Get the command at the specified index."""
return self._command[idx]

def __setitem__(self, idx: int, value: str) -> None:
"""Set the command at the specified index."""
self._command[idx] = value

def __delitem__(self, idx: int) -> None:
"""Delete the command at the specified index."""
del self._command[idx]

def __len__(self) -> int:
"""Get the length of the command list."""
return len(self._command)

def insert(self, idx: int, value: str) -> None:
"""Insert a command at the specified index."""
self._command.insert(idx, value)

def __str__(self) -> str: # pragma: no cover
string = f"\nLauncher: {self.launcher.value}\n"
string += f"Command: {' '.join(str(cmd) for cmd in self.command)}"
return string
74 changes: 74 additions & 0 deletions smartsim/_core/commands/commandList.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# BSD 2-Clause License
#
# Copyright (c) 2021-2024, Hewlett Packard Enterprise
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# 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 typing as t
from collections.abc import MutableSequence

from .command import Command


class CommandList(MutableSequence[Command]):
"""Container for a Sequence of Command objects"""

def __init__(self, commands: t.Union[Command, t.List[Command]]):
"""CommandList constructor"""
if isinstance(commands, Command):
commands = [commands]
self._commands: t.List[Command] = list(commands)

@property
def commands(self) -> t.List[Command]:
"""Get the Command list.
Return a reference to the Command list.
"""
return self._commands

def __getitem__(self, idx: int) -> Command:
"""Get the Command at the specified index."""
return self._commands[idx]

def __setitem__(self, idx: int, value: Command) -> None:
"""Set the Command at the specified index."""
self._commands[idx] = value

def __delitem__(self, idx: int) -> None:
"""Delete the Command at the specified index."""
del self._commands[idx]

def __len__(self) -> int:
"""Get the length of the Command list."""
return len(self._commands)

def insert(self, idx: int, value: Command) -> None:
"""Insert a Command at the specified index."""
self._commands.insert(idx, value)

def __str__(self) -> str: # pragma: no cover
string = "\n\nCommand List:\n\n"
for counter, cmd in enumerate(self.commands):
string += f"CommandList index {counter} value:"
string += f"{cmd}\n\n"
return string
51 changes: 51 additions & 0 deletions smartsim/_core/commands/launchCommands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from .commandList import CommandList


class LaunchCommands:
"""Container for aggregating prelaunch commands (e.g. file
system operations), launch commands, and postlaunch commands
"""

def __init__(
self,
prelaunch_commands: CommandList,
launch_commands: CommandList,
postlaunch_commands: CommandList,
) -> None:
"""LaunchCommand constructor"""
self._prelaunch_commands = prelaunch_commands
self._launch_commands = launch_commands
self._postlaunch_commands = postlaunch_commands

@property
def prelaunch_command(self) -> CommandList:
"""Get the prelaunch command list.
Return a reference to the command list.
"""
return self._prelaunch_commands

@property
def launch_command(self) -> CommandList:
"""Get the launch command list.
Return a reference to the command list.
"""
return self._launch_commands

@property
def postlaunch_command(self) -> CommandList:
"""Get the postlaunch command list.
Return a reference to the command list.
"""
return self._postlaunch_commands

def __str__(self) -> str: # pragma: no cover
string = "\n\nPrelaunch Command List:\n"
for pre_cmd in self.prelaunch_command:
string += f"{pre_cmd}\n"
string += "\n\nLaunch Command List:\n"
for launch_cmd in self.launch_command:
string += f"{launch_cmd}\n"
string += "\n\nPostlaunch Command List:\n"
for post_cmd in self.postlaunch_command:
string += f"{post_cmd}\n"
return string
3 changes: 1 addition & 2 deletions smartsim/_core/launcher/step/localStep.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import typing as t

from ....entity import Application, FSNode
from ....settings import Singularity
from ....settings.base import RunSettings
from ....settings import RunSettings, Singularity
from .step import Step, proxyable_launch_cmd


Expand Down
3 changes: 1 addition & 2 deletions smartsim/_core/launcher/step/lsfStep.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from ....entity import Application, FSNode
from ....error import AllocationError
from ....log import get_logger
from ....settings import BsubBatchSettings, JsrunSettings
from ....settings.base import RunSettings
from ....settings import BsubBatchSettings, JsrunSettings, RunSettings
from .step import Step

logger = get_logger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions smartsim/_core/launcher/step/mpiStep.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
from ....entity import Application, FSNode
from ....error import AllocationError, SmartSimError
from ....log import get_logger
from ....settings import MpiexecSettings, MpirunSettings, OrterunSettings
from ....settings.base import RunSettings
from ....settings import MpiexecSettings, MpirunSettings, OrterunSettings, RunSettings
from .step import Step, proxyable_launch_cmd

logger = get_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion smartsim/_core/launcher/step/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from ....entity import Application, Ensemble, FSNode
from ....log import get_logger
from ....settings.base import RunSettings, SettingsBase
from ....settings import RunSettings, SettingsBase
from ...utils.helpers import encode_cmd, get_base_36_repr
from ..colocated import write_colocated_launch_script

Expand Down
2 changes: 1 addition & 1 deletion smartsim/_core/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def check_dev_log_level() -> bool:
return lvl == "developer"


def fmt_dict(value: t.Dict[str, t.Any]) -> str:
def fmt_dict(value: t.Mapping[str, t.Any]) -> str:
fmt_str = ""
for k, v in value.items():
fmt_str += "\t" + str(k) + " = " + str(v)
Expand Down
6 changes: 4 additions & 2 deletions smartsim/database/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@
from ..servertype import CLUSTERED, STANDALONE
from ..settings import (
AprunSettings,
BatchSettings,
BsubBatchSettings,
JsrunSettings,
MpiexecSettings,
MpirunSettings,
OrterunSettings,
PalsMpiexecSettings,
QsubBatchSettings,
RunSettings,
SbatchSettings,
SrunSettings,
create_batch_settings,
create_run_settings,
)
from ..settings.base import BatchSettings, RunSettings
from ..settings.settings import create_batch_settings, create_run_settings
from ..wlm import detect_launcher

logger = get_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion smartsim/entity/dbnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from .._core.utils.helpers import expand_exe_path
from ..error import SSDBFilesNotParseable
from ..log import get_logger
from ..settings.base import RunSettings
from ..settings import RunSettings
from .entity import SmartSimEntity

logger = get_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion smartsim/entity/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
UserStrategyError,
)
from ..log import get_logger
from ..settings.base import BatchSettings, RunSettings
from ..settings import BatchSettings, RunSettings
from .dbobject import FSModel, FSScript
from .entity import SmartSimEntity
from .entityList import EntityList
Expand Down
4 changes: 0 additions & 4 deletions smartsim/entity/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

import typing as t

if t.TYPE_CHECKING:
# pylint: disable-next=unused-import
import smartsim.settings.base


class TelemetryConfiguration:
"""A base class for configuraing telemetry production behavior on
Expand Down
5 changes: 3 additions & 2 deletions smartsim/entity/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from .._core.utils.helpers import cat_arg_and_value, expand_exe_path
from ..error import EntityExistsError, SSUnsupportedError
from ..log import get_logger
from ..settings.base import BatchSettings, RunSettings
from ..settings import BatchSettings, RunSettings
from .dbobject import FSModel, FSScript
from .entity import SmartSimEntity
from .files import EntityFiles
Expand Down Expand Up @@ -75,7 +75,8 @@ def __init__(
application as a batch job
"""
super().__init__(name, str(path), run_settings)
self.exe = [exe] if run_settings.container else [expand_exe_path(exe)]
self.exe = [expand_exe_path(exe)]
# self.exe = [exe] if run_settings.container else [expand_exe_path(exe)]
self.exe_args = exe_args or []
self.params = params
self.params_as_args = params_as_args
Expand Down
2 changes: 1 addition & 1 deletion smartsim/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
)
from .error import SmartSimError
from .log import ctx_exp_path, get_logger, method_contextualizer
from .settings import Container, base, settings
from .settings import BatchSettings, Container, RunSettings
from .wlm import detect_launcher

logger = get_logger(__name__)
Expand Down
Loading