xpk 0.5.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.
Files changed (60) hide show
  1. xpk/__init__.py +15 -0
  2. xpk/commands/__init__.py +15 -0
  3. xpk/commands/batch.py +109 -0
  4. xpk/commands/cluster.py +784 -0
  5. xpk/commands/cluster_gcluster.py +185 -0
  6. xpk/commands/info.py +245 -0
  7. xpk/commands/inspector.py +363 -0
  8. xpk/commands/job.py +197 -0
  9. xpk/commands/kind.py +253 -0
  10. xpk/commands/shell.py +120 -0
  11. xpk/commands/version.py +39 -0
  12. xpk/commands/workload.py +692 -0
  13. xpk/core/__init__.py +15 -0
  14. xpk/core/blueprint/__init__.py +15 -0
  15. xpk/core/blueprint/blueprint_definitions.py +61 -0
  16. xpk/core/blueprint/blueprint_generator.py +652 -0
  17. xpk/core/cluster_private.py +197 -0
  18. xpk/core/commands.py +352 -0
  19. xpk/core/core.py +2824 -0
  20. xpk/core/docker_manager.py +308 -0
  21. xpk/core/gcluster_manager.py +158 -0
  22. xpk/core/kjob.py +205 -0
  23. xpk/core/kueue.py +352 -0
  24. xpk/core/nap.py +349 -0
  25. xpk/core/pathways.py +298 -0
  26. xpk/core/ray.py +222 -0
  27. xpk/core/system_characteristics.py +1395 -0
  28. xpk/core/workload.py +133 -0
  29. xpk/core/workload_decorators/__init__.py +15 -0
  30. xpk/core/workload_decorators/rdma_decorator.py +109 -0
  31. xpk/core/workload_decorators/tcpxo_decorator.py +157 -0
  32. xpk/main.py +73 -0
  33. xpk/parser/__init__.py +15 -0
  34. xpk/parser/batch.py +184 -0
  35. xpk/parser/cluster.py +621 -0
  36. xpk/parser/common.py +71 -0
  37. xpk/parser/core.py +109 -0
  38. xpk/parser/info.py +63 -0
  39. xpk/parser/inspector.py +65 -0
  40. xpk/parser/job.py +126 -0
  41. xpk/parser/kind.py +94 -0
  42. xpk/parser/shell.py +50 -0
  43. xpk/parser/validators.py +39 -0
  44. xpk/parser/version.py +23 -0
  45. xpk/parser/workload.py +684 -0
  46. xpk/utils/__init__.py +15 -0
  47. xpk/utils/console.py +55 -0
  48. xpk/utils/file.py +82 -0
  49. xpk/utils/network.py +168 -0
  50. xpk/utils/objects.py +85 -0
  51. xpk/utils/yaml.py +30 -0
  52. {xpk-0.5.0.dist-info → xpk-0.6.0.dist-info}/METADATA +301 -28
  53. xpk-0.6.0.dist-info/RECORD +57 -0
  54. {xpk-0.5.0.dist-info → xpk-0.6.0.dist-info}/WHEEL +1 -1
  55. xpk-0.6.0.dist-info/entry_points.txt +2 -0
  56. xpk-0.5.0.dist-info/RECORD +0 -7
  57. xpk-0.5.0.dist-info/entry_points.txt +0 -2
  58. xpk.py +0 -7282
  59. {xpk-0.5.0.dist-info → xpk-0.6.0.dist-info}/LICENSE +0 -0
  60. {xpk-0.5.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
+ """
@@ -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)