This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathrun_toolbox.py
executable file
·73 lines (61 loc) · 2.02 KB
/
run_toolbox.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
import sys
try:
import fire
except ModuleNotFoundError:
print("The toolbox requires the Python `fire` package, see requirements.txt for a full list of requirements")
sys.exit(1)
from toolbox.cluster import Cluster
from toolbox.entitlement import Entitlement
from toolbox.gpu_operator import GPUOperator
from toolbox.nfd import NFD
from toolbox.nfd_operator import NFDOperator
from toolbox.repo import Repo
from toolbox.benchmarking import Benchmarking
from toolbox.utils import Utils
from toolbox.nto import NTO
from toolbox.rhods import RHODS
class Toolbox:
"""
The PSAP Operators Toolbox
The toolbox is a set of tools, originally written for
CI automation, but that appeared to be useful for a broader scope. It
automates different operations on OpenShift clusters and operators
revolving around PSAP activities: entitlement, scale-up of GPU nodes,
deployment of the NFD, SRO and NVIDIA GPU Operators, but also their
configuration and troubleshooting.
"""
def __init__(self):
self.cluster = Cluster
self.entitlement = Entitlement
self.gpu_operator = GPUOperator
self.nfd_operator = NFDOperator
self.nfd = NFD
self.repo = Repo
self.benchmarking = Benchmarking
self.utils = Utils
self.nto = NTO
self.rhods = RHODS
def main(no_exit=False):
# Print help rather than opening a pager
fire.core.Display = lambda lines, out: print(*lines, file=out)
# Launch CLI, get a runnable
runnable = None
try:
runnable = fire.Fire(Toolbox())
except fire.core.FireExit:
if not no_exit:
raise
# Run the actual workload
try:
if hasattr(runnable, "_run"):
runnable._run()
else:
# CLI didn't resolve completely - either by lack of arguments
# or use of `--help`. This is okay.
pass
except SystemExit as e:
if not no_exit:
sys.exit(e.code)
if __name__ == "__main__":
main()