-
Notifications
You must be signed in to change notification settings - Fork 38
BatchSettings, LaunchSettings, Command, CommandList and LaunchCommand Refactor #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
amandarichardsonn
merged 47 commits into
CrayLabs:smartsim-refactor
from
amandarichardsonn:settings-refactor
Jun 13, 2024
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
9e99ffe
initial push
amandarichardsonn a2a3d31
updating
amandarichardsonn 9c53664
lsf and dragon updates
amandarichardsonn 3a9981e
alps updates
amandarichardsonn 0937220
updates to slurm and pals
amandarichardsonn 3354e3d
updates to pbs and slurm
amandarichardsonn 2145523
delete unused
amandarichardsonn b85d6be
run arguments prevented
amandarichardsonn ad26d11
set updated
amandarichardsonn 69899de
set tests added
amandarichardsonn 5f99def
solve some mypy errors
amandarichardsonn 833bcdb
mypy error
amandarichardsonn 6edf7b1
mypy updates
amandarichardsonn 7e967cc
het group method added
amandarichardsonn 5d18460
resources
amandarichardsonn 554dc58
fixing up tests
amandarichardsonn 799b020
remove unused import
amandarichardsonn 053eac0
commands
amandarichardsonn d893d7c
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn 1681848
command implementation
amandarichardsonn acf37e3
commandList added
amandarichardsonn 2f48f5a
str dunder
amandarichardsonn 119903e
remove unused imports
amandarichardsonn 804786a
copyright
amandarichardsonn c6e74c0
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn faf2d15
move tests
amandarichardsonn fe97911
Matts comments
amandarichardsonn bdce4bd
launch commands
amandarichardsonn 60cad54
chnages
amandarichardsonn 26ca1ea
mock imports
amandarichardsonn a743491
chnage testing
amandarichardsonn 9fdfca7
test
amandarichardsonn 1b9e650
chnages
amandarichardsonn f79176f
fixes
amandarichardsonn d756c78
mypy errors
amandarichardsonn 9d6d06d
str tests
amandarichardsonn af5b23b
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn 603bd0a
pushing
amandarichardsonn bbc1332
make style chnages
amandarichardsonn 1ea4489
c
amandarichardsonn b862095
init changes
amandarichardsonn 0e9c287
isort will be the death of me
amandarichardsonn bde5594
Merge branch 'smartsim-refactor' of https://www.github.com/CrayLabs/S…
amandarichardsonn 2765805
commit
amandarichardsonn bf87114
chnages
amandarichardsonn 72987b4
issue when building
amandarichardsonn ffd95d7
matt comment
amandarichardsonn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.