xpk 0.4.0__py3-none-any.whl → 0.6.0__py3-none-any.whl
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.
- xpk/__init__.py +15 -0
- xpk/commands/__init__.py +15 -0
- xpk/commands/batch.py +109 -0
- xpk/commands/cluster.py +784 -0
- xpk/commands/cluster_gcluster.py +185 -0
- xpk/commands/info.py +245 -0
- xpk/commands/inspector.py +363 -0
- xpk/commands/job.py +197 -0
- xpk/commands/kind.py +253 -0
- xpk/commands/shell.py +120 -0
- xpk/commands/version.py +39 -0
- xpk/commands/workload.py +692 -0
- xpk/core/__init__.py +15 -0
- xpk/core/blueprint/__init__.py +15 -0
- xpk/core/blueprint/blueprint_definitions.py +61 -0
- xpk/core/blueprint/blueprint_generator.py +652 -0
- xpk/core/cluster_private.py +197 -0
- xpk/core/commands.py +352 -0
- xpk/core/core.py +2824 -0
- xpk/core/docker_manager.py +308 -0
- xpk/core/gcluster_manager.py +158 -0
- xpk/core/kjob.py +205 -0
- xpk/core/kueue.py +352 -0
- xpk/core/nap.py +349 -0
- xpk/core/pathways.py +298 -0
- xpk/core/ray.py +222 -0
- xpk/core/system_characteristics.py +1395 -0
- xpk/core/workload.py +133 -0
- xpk/core/workload_decorators/__init__.py +15 -0
- xpk/core/workload_decorators/rdma_decorator.py +109 -0
- xpk/core/workload_decorators/tcpxo_decorator.py +157 -0
- xpk/main.py +73 -0
- xpk/parser/__init__.py +15 -0
- xpk/parser/batch.py +184 -0
- xpk/parser/cluster.py +621 -0
- xpk/parser/common.py +71 -0
- xpk/parser/core.py +109 -0
- xpk/parser/info.py +63 -0
- xpk/parser/inspector.py +65 -0
- xpk/parser/job.py +126 -0
- xpk/parser/kind.py +94 -0
- xpk/parser/shell.py +50 -0
- xpk/parser/validators.py +39 -0
- xpk/parser/version.py +23 -0
- xpk/parser/workload.py +684 -0
- xpk/utils/__init__.py +15 -0
- xpk/utils/console.py +55 -0
- xpk/utils/file.py +82 -0
- xpk/utils/network.py +168 -0
- xpk/utils/objects.py +85 -0
- xpk/utils/yaml.py +30 -0
- {xpk-0.4.0.dist-info → xpk-0.6.0.dist-info}/METADATA +307 -38
- xpk-0.6.0.dist-info/RECORD +57 -0
- {xpk-0.4.0.dist-info → xpk-0.6.0.dist-info}/WHEEL +1 -1
- xpk-0.6.0.dist-info/entry_points.txt +2 -0
- xpk-0.4.0.dist-info/RECORD +0 -7
- xpk-0.4.0.dist-info/entry_points.txt +0 -2
- xpk.py +0 -7218
- {xpk-0.4.0.dist-info → xpk-0.6.0.dist-info}/LICENSE +0 -0
- {xpk-0.4.0.dist-info → xpk-0.6.0.dist-info}/top_level.txt +0 -0
xpk/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2023 Google LLC
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
xpk/commands/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2024 Google LLC
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
xpk/commands/batch.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2024 Google LLC
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from argparse import Namespace
|
|
18
|
+
|
|
19
|
+
from ..core.kueue import LOCAL_QUEUE_NAME
|
|
20
|
+
from ..utils.console import xpk_exit, xpk_print
|
|
21
|
+
from .cluster import set_cluster_command
|
|
22
|
+
from ..core.core import add_zone_and_project
|
|
23
|
+
from ..core.kjob import AppProfileDefaults
|
|
24
|
+
from ..core.commands import run_command_for_value
|
|
25
|
+
from .kind import set_local_cluster_command
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def batch(args: Namespace) -> None:
|
|
29
|
+
"""Run batch task.
|
|
30
|
+
This function runs passed script in non-blocking manner.
|
|
31
|
+
Args:
|
|
32
|
+
args: user provided arguments for running the command.
|
|
33
|
+
Returns:
|
|
34
|
+
None
|
|
35
|
+
"""
|
|
36
|
+
if not args.kind_cluster:
|
|
37
|
+
add_zone_and_project(args)
|
|
38
|
+
set_cluster_command_code = set_cluster_command(args)
|
|
39
|
+
else:
|
|
40
|
+
set_cluster_command_code = set_local_cluster_command(args)
|
|
41
|
+
|
|
42
|
+
if set_cluster_command_code != 0:
|
|
43
|
+
xpk_exit(set_cluster_command_code)
|
|
44
|
+
|
|
45
|
+
submit_job(args)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def submit_job(args: Namespace) -> None:
|
|
49
|
+
cmd = (
|
|
50
|
+
'kubectl kjob create slurm'
|
|
51
|
+
f' --profile {AppProfileDefaults.NAME.value}'
|
|
52
|
+
f' --localqueue {LOCAL_QUEUE_NAME}'
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
if args.ignore_unknown_flags:
|
|
56
|
+
cmd += ' --ignore-unknown-flags'
|
|
57
|
+
|
|
58
|
+
cmd += f' -- {args.script} --partition {LOCAL_QUEUE_NAME}'
|
|
59
|
+
|
|
60
|
+
if args.array is not None:
|
|
61
|
+
cmd += f' --array {args.array}'
|
|
62
|
+
|
|
63
|
+
if args.cpus_per_task is not None:
|
|
64
|
+
cmd += f' --cpus-per-task {args.cpus_per_task}'
|
|
65
|
+
|
|
66
|
+
if args.gpus_per_task is not None:
|
|
67
|
+
cmd += f' --gpus-per-task {args.gpus_per_task}'
|
|
68
|
+
|
|
69
|
+
if args.mem is not None:
|
|
70
|
+
cmd += f' --mem {args.mem}'
|
|
71
|
+
|
|
72
|
+
if args.mem_per_task is not None:
|
|
73
|
+
cmd += f' --mem-per-task {args.mem_per_task}'
|
|
74
|
+
|
|
75
|
+
if args.mem_per_cpu is not None:
|
|
76
|
+
cmd += f' --mem-per-cpu {args.mem_per_cpu}'
|
|
77
|
+
|
|
78
|
+
if args.mem_per_gpu is not None:
|
|
79
|
+
cmd += f' --mem-per-gpu {args.mem_per_gpu}'
|
|
80
|
+
|
|
81
|
+
if args.nodes is not None:
|
|
82
|
+
cmd += f' --nodes {args.nodes}'
|
|
83
|
+
|
|
84
|
+
if args.ntasks is not None:
|
|
85
|
+
cmd += f' --ntasks {args.ntasks}'
|
|
86
|
+
|
|
87
|
+
if args.output is not None:
|
|
88
|
+
cmd += f' --output {args.output}'
|
|
89
|
+
|
|
90
|
+
if args.error is not None:
|
|
91
|
+
cmd += f' --error {args.error}'
|
|
92
|
+
|
|
93
|
+
if args.input is not None:
|
|
94
|
+
cmd += f' --input {args.input}'
|
|
95
|
+
|
|
96
|
+
if args.job_name is not None:
|
|
97
|
+
cmd += f' --job-name {args.job_name}'
|
|
98
|
+
|
|
99
|
+
if args.chdir is not None:
|
|
100
|
+
cmd += f' --chdir {args.chdir}'
|
|
101
|
+
|
|
102
|
+
if args.time is not None:
|
|
103
|
+
cmd += f' --time {args.time}'
|
|
104
|
+
|
|
105
|
+
return_code, _ = run_command_for_value(cmd, 'submit job', args)
|
|
106
|
+
|
|
107
|
+
if return_code != 0:
|
|
108
|
+
xpk_print(f'Running batch job returned ERROR {return_code}')
|
|
109
|
+
xpk_exit(return_code)
|