slurm-cli 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. slurm_cli-1.0.0/LICENSE +22 -0
  2. slurm_cli-1.0.0/PKG-INFO +216 -0
  3. slurm_cli-1.0.0/README.md +175 -0
  4. slurm_cli-1.0.0/pyproject.toml +159 -0
  5. slurm_cli-1.0.0/src/slurm_cli/__init__.py +17 -0
  6. slurm_cli-1.0.0/src/slurm_cli/cli.py +5113 -0
  7. slurm_cli-1.0.0/src/slurm_cli/py.typed +0 -0
  8. slurm_cli-1.0.0/src/slurm_cli/utils/__init__.py +1 -0
  9. slurm_cli-1.0.0/src/slurm_cli/utils/accounts.py +544 -0
  10. slurm_cli-1.0.0/src/slurm_cli/utils/associations.py +871 -0
  11. slurm_cli-1.0.0/src/slurm_cli/utils/autocomplete_helpers.py +266 -0
  12. slurm_cli-1.0.0/src/slurm_cli/utils/base_resource.py +349 -0
  13. slurm_cli-1.0.0/src/slurm_cli/utils/config.py +88 -0
  14. slurm_cli-1.0.0/src/slurm_cli/utils/coordinators.py +426 -0
  15. slurm_cli-1.0.0/src/slurm_cli/utils/events.py +695 -0
  16. slurm_cli-1.0.0/src/slurm_cli/utils/job_filter.py +551 -0
  17. slurm_cli-1.0.0/src/slurm_cli/utils/jobs.py +854 -0
  18. slurm_cli-1.0.0/src/slurm_cli/utils/node_filter.py +778 -0
  19. slurm_cli-1.0.0/src/slurm_cli/utils/nodes.py +774 -0
  20. slurm_cli-1.0.0/src/slurm_cli/utils/partitions.py +837 -0
  21. slurm_cli-1.0.0/src/slurm_cli/utils/prefix_utils.py +1050 -0
  22. slurm_cli-1.0.0/src/slurm_cli/utils/profiles.py +1360 -0
  23. slurm_cli-1.0.0/src/slurm_cli/utils/qos.py +883 -0
  24. slurm_cli-1.0.0/src/slurm_cli/utils/reservations.py +665 -0
  25. slurm_cli-1.0.0/src/slurm_cli/utils/resources.py +341 -0
  26. slurm_cli-1.0.0/src/slurm_cli/utils/slurm_config.py +73 -0
  27. slurm_cli-1.0.0/src/slurm_cli/utils/users.py +649 -0
  28. slurm_cli-1.0.0/src/slurm_cli/utils/utils.py +21 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Sergey Zhumatiy <szhumatiy@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,216 @@
1
+ Metadata-Version: 2.4
2
+ Name: slurm-cli
3
+ Version: 1.0.0
4
+ Summary: A CLI tool for Slurm cluster management with autocomplete functionality
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: slurm,cli,cluster,management
8
+ Author: Sergey Zhumatiy
9
+ Author-email: szhumatiy@gmail.com
10
+ Maintainer: Sergey Zhumatiy
11
+ Maintainer-email: szhumatiy@gmail.com
12
+ Requires-Python: >=3.9,<4.0
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Operating System :: Unix
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: 3.14
27
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
+ Classifier: Topic :: System :: Clustering
29
+ Classifier: Topic :: System :: Systems Administration
30
+ Requires-Dist: click (>=8.1.0,<9.0.0)
31
+ Requires-Dist: click-aliases (>=1.0.1,<2.0.0)
32
+ Requires-Dist: fast-autocomplete (>=0.9.0,<0.10.0)
33
+ Requires-Dist: rapidfuzz (>=3.13.0,<4.0.0)
34
+ Requires-Dist: rich (>=13.0.0,<14.0.0)
35
+ Requires-Dist: setuptools (>=40.0,<72)
36
+ Project-URL: Documentation, https://slurm-cli.readthedocs.io/
37
+ Project-URL: Homepage, https://github.com/zhum/slurm-cli
38
+ Project-URL: Repository, https://github.com/zhum/slurm-cli.git
39
+ Description-Content-Type: text/markdown
40
+
41
+ # Slurm CLI
42
+
43
+ A CLI tool for Slurm cluster management with autocomplete functionality.
44
+
45
+ ## Features
46
+
47
+ - Interactive command-line interface for Slurm cluster management via slurm commands wrapping
48
+ - Autocomplete support for commands and parameters
49
+ - Support for managing partitions, nodes, jobs, users, QoS, accounts, and reservations
50
+ - Rich console output with colored and formatted text
51
+ - Fast fuzzy matching for autocomplete suggestions
52
+
53
+ ## Installation
54
+
55
+ ### From PyPI
56
+
57
+ The easiest way to install slurm-cli is using pip:
58
+
59
+ ```bash
60
+ pip install slurm-cli
61
+ ```
62
+
63
+ ### From Source
64
+
65
+ To install from source:
66
+
67
+ ```bash
68
+ # Clone the repository
69
+ git clone https://github.com/zhum/slurm-cli.git
70
+ cd slurm-cli
71
+
72
+ # Install dependencies using Poetry
73
+ poetry install
74
+
75
+ # Activate the virtual environment
76
+ poetry shell
77
+ ```
78
+
79
+ ### Development Setup
80
+
81
+ For development, you'll also want to install the development dependencies:
82
+
83
+ ```bash
84
+ poetry install --with dev
85
+ poetry run pre-commit install
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ Run the CLI tool:
91
+
92
+ ```bash
93
+ slurm-cli
94
+ ```
95
+
96
+ Or with Poetry:
97
+
98
+ ```bash
99
+ poetry run slurm-cli
100
+ ```
101
+
102
+ ### Autocomplete Setup
103
+
104
+ To enable bash autocompletion for this command:
105
+
106
+ 1. Install the completion script:
107
+
108
+ ```bash
109
+ eval "$(_CLICK_COMPLETE=bash_source slurm-cli)"
110
+ ```
111
+
112
+ 1. Add the above line to your `~/.bashrc` or `~/.bash_profile` to make it permanent.
113
+
114
+ 1. Restart your shell or run: `source ~/.bashrc`
115
+
116
+ Alternatively, you can generate a completion script file:
117
+
118
+ ```bash
119
+ _CLICK_COMPLETE=bash_source slurm-cli > \
120
+ ~/.local/share/bash-completion/completions/slurm-cli
121
+ ```
122
+
123
+ ## Development
124
+
125
+ ### Autocomplete
126
+
127
+ See [AUTOCOMPLETE.md](AUTOCOMPLETE.md) for implementation and development details.
128
+
129
+ ### Running Tests
130
+
131
+ ```bash
132
+ poetry run pytest
133
+ # or with coverage
134
+ poetry run pytest --cov=slurm_cli
135
+ ```
136
+
137
+ ### Code Formatting
138
+
139
+ ```bash
140
+ poetry run black src tests
141
+ poetry run isort src tests
142
+ ```
143
+
144
+ ### Type Checking
145
+
146
+ ```bash
147
+ poetry run mypy src/
148
+ ```
149
+
150
+ ### All Checks
151
+
152
+ ```bash
153
+ make check
154
+ # or
155
+ poetry run tox
156
+ ```
157
+
158
+ ### Building Documentation
159
+
160
+ ```bash
161
+ make docs
162
+ # or
163
+ poetry run mkdocs build
164
+
165
+ # Serve locally
166
+ make docs-serve
167
+ # or
168
+ poetry run mkdocs serve
169
+ # Then open http://localhost:8000
170
+ ```
171
+
172
+ ## Project Structure
173
+
174
+ ```text
175
+ slurm-cli/
176
+ ├── src/
177
+ │ └── slurm_cli/ # Main package
178
+ │ ├── __init__.py
179
+ │ ├── cli.py # CLI entry point
180
+ │ └── utils/ # Utility functions
181
+ ├── tests/ # Test files
182
+ ├── docs/ # Documentation
183
+ ├── pyproject.toml # Poetry configuration
184
+ ├── Makefile # Development commands
185
+ ├── tox.ini # Multi-environment testing
186
+ ├── .pre-commit-config.yaml # Pre-commit hooks
187
+ └── README.md # This file
188
+ ```
189
+
190
+ ## Requirements
191
+
192
+ - Python 3.9 or higher
193
+ - Slurm cluster environment
194
+ - Required Python packages (automatically installed):
195
+ - click>=8.1.0
196
+ - rich>=13.0.0
197
+ - fast-autocomplete[levenshtein]>=0.9.0
198
+ - rapidfuzz>=3.13.0
199
+
200
+ ## License
201
+
202
+ MIT License - see the [LICENSE](LICENSE) file for details.
203
+
204
+ ## Contributing
205
+
206
+ 1. Fork the repository
207
+ 2. Create a feature branch
208
+ 3. Make your changes
209
+ 4. Add tests for new functionality
210
+ 5. Run the test suite
211
+ 6. Submit a pull request
212
+
213
+ ## Changelog
214
+
215
+ See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
216
+
@@ -0,0 +1,175 @@
1
+ # Slurm CLI
2
+
3
+ A CLI tool for Slurm cluster management with autocomplete functionality.
4
+
5
+ ## Features
6
+
7
+ - Interactive command-line interface for Slurm cluster management via slurm commands wrapping
8
+ - Autocomplete support for commands and parameters
9
+ - Support for managing partitions, nodes, jobs, users, QoS, accounts, and reservations
10
+ - Rich console output with colored and formatted text
11
+ - Fast fuzzy matching for autocomplete suggestions
12
+
13
+ ## Installation
14
+
15
+ ### From PyPI
16
+
17
+ The easiest way to install slurm-cli is using pip:
18
+
19
+ ```bash
20
+ pip install slurm-cli
21
+ ```
22
+
23
+ ### From Source
24
+
25
+ To install from source:
26
+
27
+ ```bash
28
+ # Clone the repository
29
+ git clone https://github.com/zhum/slurm-cli.git
30
+ cd slurm-cli
31
+
32
+ # Install dependencies using Poetry
33
+ poetry install
34
+
35
+ # Activate the virtual environment
36
+ poetry shell
37
+ ```
38
+
39
+ ### Development Setup
40
+
41
+ For development, you'll also want to install the development dependencies:
42
+
43
+ ```bash
44
+ poetry install --with dev
45
+ poetry run pre-commit install
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Run the CLI tool:
51
+
52
+ ```bash
53
+ slurm-cli
54
+ ```
55
+
56
+ Or with Poetry:
57
+
58
+ ```bash
59
+ poetry run slurm-cli
60
+ ```
61
+
62
+ ### Autocomplete Setup
63
+
64
+ To enable bash autocompletion for this command:
65
+
66
+ 1. Install the completion script:
67
+
68
+ ```bash
69
+ eval "$(_CLICK_COMPLETE=bash_source slurm-cli)"
70
+ ```
71
+
72
+ 1. Add the above line to your `~/.bashrc` or `~/.bash_profile` to make it permanent.
73
+
74
+ 1. Restart your shell or run: `source ~/.bashrc`
75
+
76
+ Alternatively, you can generate a completion script file:
77
+
78
+ ```bash
79
+ _CLICK_COMPLETE=bash_source slurm-cli > \
80
+ ~/.local/share/bash-completion/completions/slurm-cli
81
+ ```
82
+
83
+ ## Development
84
+
85
+ ### Autocomplete
86
+
87
+ See [AUTOCOMPLETE.md](AUTOCOMPLETE.md) for implementation and development details.
88
+
89
+ ### Running Tests
90
+
91
+ ```bash
92
+ poetry run pytest
93
+ # or with coverage
94
+ poetry run pytest --cov=slurm_cli
95
+ ```
96
+
97
+ ### Code Formatting
98
+
99
+ ```bash
100
+ poetry run black src tests
101
+ poetry run isort src tests
102
+ ```
103
+
104
+ ### Type Checking
105
+
106
+ ```bash
107
+ poetry run mypy src/
108
+ ```
109
+
110
+ ### All Checks
111
+
112
+ ```bash
113
+ make check
114
+ # or
115
+ poetry run tox
116
+ ```
117
+
118
+ ### Building Documentation
119
+
120
+ ```bash
121
+ make docs
122
+ # or
123
+ poetry run mkdocs build
124
+
125
+ # Serve locally
126
+ make docs-serve
127
+ # or
128
+ poetry run mkdocs serve
129
+ # Then open http://localhost:8000
130
+ ```
131
+
132
+ ## Project Structure
133
+
134
+ ```text
135
+ slurm-cli/
136
+ ├── src/
137
+ │ └── slurm_cli/ # Main package
138
+ │ ├── __init__.py
139
+ │ ├── cli.py # CLI entry point
140
+ │ └── utils/ # Utility functions
141
+ ├── tests/ # Test files
142
+ ├── docs/ # Documentation
143
+ ├── pyproject.toml # Poetry configuration
144
+ ├── Makefile # Development commands
145
+ ├── tox.ini # Multi-environment testing
146
+ ├── .pre-commit-config.yaml # Pre-commit hooks
147
+ └── README.md # This file
148
+ ```
149
+
150
+ ## Requirements
151
+
152
+ - Python 3.9 or higher
153
+ - Slurm cluster environment
154
+ - Required Python packages (automatically installed):
155
+ - click>=8.1.0
156
+ - rich>=13.0.0
157
+ - fast-autocomplete[levenshtein]>=0.9.0
158
+ - rapidfuzz>=3.13.0
159
+
160
+ ## License
161
+
162
+ MIT License - see the [LICENSE](LICENSE) file for details.
163
+
164
+ ## Contributing
165
+
166
+ 1. Fork the repository
167
+ 2. Create a feature branch
168
+ 3. Make your changes
169
+ 4. Add tests for new functionality
170
+ 5. Run the test suite
171
+ 6. Submit a pull request
172
+
173
+ ## Changelog
174
+
175
+ See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
@@ -0,0 +1,159 @@
1
+ [tool.poetry]
2
+ name = "slurm-cli"
3
+ version = "1.0.0"
4
+ description = "A CLI tool for Slurm cluster management with autocomplete functionality"
5
+ authors = ["Sergey Zhumatiy <szhumatiy@gmail.com>"]
6
+ maintainers = ["Sergey Zhumatiy <szhumatiy@gmail.com>"]
7
+ readme = "README.md"
8
+ license = "MIT"
9
+ homepage = "https://github.com/zhum/slurm-cli"
10
+ repository = "https://github.com/zhum/slurm-cli.git"
11
+ documentation = "https://slurm-cli.readthedocs.io/"
12
+ keywords = ["slurm", "cli", "cluster", "management"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: System Administrators",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: POSIX :: Linux",
18
+ "Operating System :: Unix",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: System :: Clustering",
25
+ "Topic :: System :: Systems Administration",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Environment :: Console",
28
+ ]
29
+ packages = [{include = "slurm_cli", from = "src"}]
30
+
31
+ [tool.poetry.dependencies]
32
+ python = "^3.9"
33
+ click = "^8.1.0"
34
+ click-aliases = "^1.0.1"
35
+ rich = "^13.0.0"
36
+ rapidfuzz = "^3.13.0"
37
+ setuptools = ">=40.0,<72"
38
+ fast-autocomplete = "^0.9.0"
39
+
40
+ [tool.poetry.group.dev.dependencies]
41
+ pytest = "^7.0.0"
42
+ pytest-cov = "^4.0.0"
43
+ pytest-mock = "^3.0.0"
44
+ black = "^23.0.0"
45
+ flake8 = "^7.3.0"
46
+ mypy = "^1.0.0"
47
+ pre-commit = "^3.0.0"
48
+ tox = "^4.0.0"
49
+ isort = "^5.12.0"
50
+
51
+ [tool.poetry.group.docs.dependencies]
52
+ mkdocs = "^1.5.0"
53
+ mkdocs-bootswatch = "^1.1"
54
+ mkdocstrings = {extras = ["python"], version = "^0.29.0"}
55
+ mkdocs-autorefs = "^1.2.0"
56
+ griffe = ">=0.49,<2.0"
57
+ pymdown-extensions = "^10.0"
58
+
59
+ [tool.poetry.scripts]
60
+ slurm-cli = "slurm_cli.cli:main"
61
+
62
+ [build-system]
63
+ requires = ["poetry-core"]
64
+ build-backend = "poetry.core.masonry.api"
65
+
66
+ [tool.black]
67
+ line-length = 88
68
+ target-version = ['py39']
69
+ include = '\.pyi?$'
70
+ extend-exclude = '''
71
+ /(
72
+ # directories
73
+ \.eggs
74
+ | \.git
75
+ | \.hg
76
+ | \.mypy_cache
77
+ | \.tox
78
+ | \.venv
79
+ | build
80
+ | dist
81
+ )/
82
+ '''
83
+
84
+ [tool.isort]
85
+ profile = "black"
86
+ multi_line_output = 3
87
+ line_length = 88
88
+ known_first_party = ["slurm_cli"]
89
+
90
+ [tool.mypy]
91
+ python_version = "3.9"
92
+ warn_return_any = true
93
+ warn_unused_configs = true
94
+ disallow_untyped_defs = true
95
+ disallow_incomplete_defs = true
96
+ check_untyped_defs = true
97
+ disallow_untyped_decorators = true
98
+ no_implicit_optional = true
99
+ warn_redundant_casts = true
100
+ warn_unused_ignores = true
101
+ warn_no_return = true
102
+ warn_unreachable = true
103
+ strict_equality = true
104
+
105
+ [[tool.mypy.overrides]]
106
+ module = [
107
+ "fast_autocomplete.*",
108
+ "rapidfuzz.*",
109
+ ]
110
+ ignore_missing_imports = true
111
+
112
+ [tool.pytest.ini_options]
113
+ testpaths = ["tests"]
114
+ python_files = ["test_*.py"]
115
+ python_classes = ["Test*"]
116
+ python_functions = ["test_*"]
117
+ addopts = [
118
+ "--strict-markers",
119
+ "--strict-config",
120
+ ]
121
+ markers = [
122
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
123
+ "integration: marks tests as integration tests",
124
+ ]
125
+
126
+ [tool.coverage.run]
127
+ source = ["src/slurm_cli"]
128
+ omit = [
129
+ "*/tests/*",
130
+ "*/test_*",
131
+ "*/__pycache__/*",
132
+ ]
133
+
134
+ [tool.coverage.report]
135
+ exclude_lines = [
136
+ "pragma: no cover",
137
+ "def __repr__",
138
+ "if self.debug:",
139
+ "if settings.DEBUG",
140
+ "raise AssertionError",
141
+ "raise NotImplementedError",
142
+ "if 0:",
143
+ "if __name__ == .__main__.:",
144
+ "class .*\\bProtocol\\):",
145
+ "@(abc\\.)?abstractmethod",
146
+ ]
147
+
148
+ [tool.flake8]
149
+ max-line-length = 88
150
+ extend-ignore = ["E203", "W503", "E501"]
151
+ exclude = [
152
+ ".git",
153
+ "__pycache__",
154
+ "build",
155
+ "dist",
156
+ ".venv",
157
+ ".eggs",
158
+ "*.egg",
159
+ ]
@@ -0,0 +1,17 @@
1
+ """
2
+ Slurm CLI - A CLI tool for Slurm cluster management
3
+ with autocomplete functionality.
4
+ """
5
+
6
+ from importlib.metadata import PackageNotFoundError, version
7
+
8
+ try:
9
+ __version__ = version("slurm-cli")
10
+ except PackageNotFoundError:
11
+ # Package is not installed (running from source without install)
12
+ __version__ = "0.0.0-dev"
13
+
14
+ __author__ = "Sergey Zhumatiy"
15
+ __email__ = "szhumatiy@gmail.com"
16
+
17
+ __all__ = ["__version__", "__author__", "__email__"]