xpk 0.1.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.
- xpk-0.1.0/LICENSE +202 -0
- xpk-0.1.0/PKG-INFO +334 -0
- xpk-0.1.0/README.md +320 -0
- xpk-0.1.0/pyproject.toml +43 -0
- xpk-0.1.0/setup.cfg +4 -0
- xpk-0.1.0/xpk.egg-info/PKG-INFO +334 -0
- xpk-0.1.0/xpk.egg-info/SOURCES.txt +9 -0
- xpk-0.1.0/xpk.egg-info/dependency_links.txt +1 -0
- xpk-0.1.0/xpk.egg-info/entry_points.txt +2 -0
- xpk-0.1.0/xpk.egg-info/top_level.txt +1 -0
- xpk-0.1.0/xpk.py +2184 -0
xpk-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
xpk-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xpk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: xpk helps Cloud developers to orchestrate training jobs on accelerators on GKE.
|
|
5
|
+
Author-email: Cloud TPU Team <cloud-tpu-eng@google.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/google/cloud-tpu-monitoring-debugging
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/google/xpk/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
<!--
|
|
16
|
+
Copyright 2023 Google LLC
|
|
17
|
+
|
|
18
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
you may not use this file except in compliance with the License.
|
|
20
|
+
You may obtain a copy of the License at
|
|
21
|
+
|
|
22
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
+
|
|
24
|
+
Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
+
See the License for the specific language governing permissions and
|
|
28
|
+
limitations under the License.
|
|
29
|
+
-->
|
|
30
|
+
|
|
31
|
+
# Overview
|
|
32
|
+
|
|
33
|
+
xpk (Accelerated Processing Kit, pronounced x-p-k,) is a software tool to help
|
|
34
|
+
Cloud developers to orchestrate training jobs on accelerators such as TPUs and
|
|
35
|
+
GPUs on GKE. xpk handles the "multihost pods" of TPUs and GPUs (HGX H100) as
|
|
36
|
+
first class citizens.
|
|
37
|
+
|
|
38
|
+
xpk decouples provisioning capacity from running jobs. There are two structures:
|
|
39
|
+
clusters (provisioned VMs) and workloads (training jobs). Clusters represent the
|
|
40
|
+
physical resources you have available. Workloads represent training jobs -- at
|
|
41
|
+
any time some of these will be completed, others will be running and some will
|
|
42
|
+
be queued, waiting for cluster resources to become available.
|
|
43
|
+
|
|
44
|
+
The ideal workflow starts by provisioning the clusters for all of the ML
|
|
45
|
+
hardware you have reserved. Then, without re-provisioning, submit jobs as
|
|
46
|
+
needed. By eliminating the need for re-provisioning between jobs, using Docker
|
|
47
|
+
containers with pre-installed dependencies and cross-ahead of time compilation,
|
|
48
|
+
these queued jobs run with minimal start times. Further, because workloads
|
|
49
|
+
return the hardware back to the shared pool when they complete, developers can
|
|
50
|
+
achieve better use of finite hardware resources. And automated tests can run
|
|
51
|
+
overnight while resources tend to be underutilized.
|
|
52
|
+
|
|
53
|
+
# Installation
|
|
54
|
+
To install xpk, run the following command:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
pip install xpk
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
# XPK for Large Scale (>1k VMs)
|
|
61
|
+
|
|
62
|
+
Follow user instructions in [xpk-large-scale-guide.sh](xpk-large-scale-guide.sh)
|
|
63
|
+
to use xpk for a GKE cluster greater than 1000 VMs. Run these steps to set up a
|
|
64
|
+
GKE cluster with large scale training and high throughput support with XPK, and
|
|
65
|
+
run jobs with XPK. We recommend you manually copy commands per step and verify
|
|
66
|
+
the outputs of each step.
|
|
67
|
+
|
|
68
|
+
# Example usages:
|
|
69
|
+
|
|
70
|
+
To get started, be sure to set your GCP Project and Zone as usual via `gcloud
|
|
71
|
+
config set`.
|
|
72
|
+
|
|
73
|
+
Below are reference commands. A typical journey starts with a `Cluster Create`
|
|
74
|
+
followed by many `Workload Create`s. To understand the state of the system you
|
|
75
|
+
might want to use `Cluster List` or `Workload List` commands. Finally, you can
|
|
76
|
+
cleanup with a `Cluster Delete`.
|
|
77
|
+
|
|
78
|
+
## Cluster Create
|
|
79
|
+
* Cluster Create (provision on-demand capacity):
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
python3 xpk.py cluster create \
|
|
83
|
+
--cluster xpk-test --tpu-type=v5litepod-16 \
|
|
84
|
+
--num-slices=4
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
* Cluster Create (provision reserved capacity):
|
|
89
|
+
|
|
90
|
+
```shell
|
|
91
|
+
python3 xpk.py cluster create \
|
|
92
|
+
--cluster xpk-test --tpu-type=v5litepod-256 \
|
|
93
|
+
--num-slices=2 \
|
|
94
|
+
--custom-tpu-nodepool-arguments="--reservation-affinity=specific --reservation=RESERVATION_ID"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
* Cluster Create can be called again with the same `--cluster name` to modify
|
|
98
|
+
the number of slices or retry failed steps.
|
|
99
|
+
|
|
100
|
+
For example, if a user creates a cluster with 4 slices:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
python3 xpk.py cluster create \
|
|
104
|
+
--cluster xpk-test --tpu-type=v5litepod-16 \
|
|
105
|
+
--num-slices=4
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
and recreates the cluster with 8 slices. The command will rerun to create 4
|
|
109
|
+
new slices:
|
|
110
|
+
|
|
111
|
+
```shell
|
|
112
|
+
python3 xpk.py cluster create \
|
|
113
|
+
--cluster xpk-test --tpu-type=v5litepod-16 \
|
|
114
|
+
--num-slices=8
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
and recreates the cluster with 6 slices. The command will rerun to delete 2
|
|
118
|
+
slices. The command will warn the user when deleting slices.
|
|
119
|
+
Use `--force` to skip prompts.
|
|
120
|
+
|
|
121
|
+
```shell
|
|
122
|
+
python3 xpk.py cluster create \
|
|
123
|
+
--cluster xpk-test --tpu-type=v5litepod-16 \
|
|
124
|
+
--num-slices=6
|
|
125
|
+
|
|
126
|
+
# Skip delete prompts using --force.
|
|
127
|
+
|
|
128
|
+
python3 xpk.py cluster create --force \
|
|
129
|
+
--cluster xpk-test --tpu-type=v5litepod-16 \
|
|
130
|
+
--num-slices=6
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
## Cluster Delete
|
|
134
|
+
* Cluster Delete (deprovision capacity):
|
|
135
|
+
|
|
136
|
+
```shell
|
|
137
|
+
python3 xpk.py cluster delete \
|
|
138
|
+
--cluster xpk-test
|
|
139
|
+
```
|
|
140
|
+
## Cluster List
|
|
141
|
+
* Cluster List (see provisioned capacity):
|
|
142
|
+
|
|
143
|
+
```shell
|
|
144
|
+
python3 xpk.py cluster list
|
|
145
|
+
```
|
|
146
|
+
## Cluster Describe
|
|
147
|
+
* Cluster Describe (see capacity):
|
|
148
|
+
|
|
149
|
+
```shell
|
|
150
|
+
python3 xpk.py cluster describe \
|
|
151
|
+
--cluster xpk-test
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Cluster Cacheimage
|
|
155
|
+
* Cluster Cacheimage (enables faster start times):
|
|
156
|
+
|
|
157
|
+
```shell
|
|
158
|
+
python3 xpk.py cluster cacheimage \
|
|
159
|
+
--cluster xpk-test --docker-image gcr.io/your_docker_image
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Workload Create
|
|
163
|
+
* Workload Create (submit training job):
|
|
164
|
+
|
|
165
|
+
```shell
|
|
166
|
+
python3 xpk.py workload create \
|
|
167
|
+
--workload xpk-test-workload --command "echo goodbye" --cluster \
|
|
168
|
+
xpk-test --tpu-type=v5litepod-16
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Workload Priority and Preemption
|
|
172
|
+
* Set the priority level of your workload with `--priority=LEVEL`
|
|
173
|
+
|
|
174
|
+
We have five priorities defined: [`very-low`, `low`, `medium`, `high`, `very-high`].
|
|
175
|
+
The default priority is `medium`.
|
|
176
|
+
|
|
177
|
+
Priority determines:
|
|
178
|
+
|
|
179
|
+
1. Order of queued jobs.
|
|
180
|
+
|
|
181
|
+
Queued jobs are ordered by
|
|
182
|
+
`very-low` < `low` < `medium` < `high` < `very-high`
|
|
183
|
+
|
|
184
|
+
2. Preemption of lower priority workloads.
|
|
185
|
+
|
|
186
|
+
A higher priority job will `evict` lower priority jobs.
|
|
187
|
+
Evicted jobs are brought back to the queue and will re-hydrate appropriately.
|
|
188
|
+
|
|
189
|
+
#### General Example:
|
|
190
|
+
```shell
|
|
191
|
+
python3 xpk.py workload create \
|
|
192
|
+
--workload xpk-test-medium-workload --command "echo goodbye" --cluster \
|
|
193
|
+
xpk-test --tpu-type=v5litepod-16 --priority=medium
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Workload Delete
|
|
197
|
+
* Workload Delete (delete training job):
|
|
198
|
+
|
|
199
|
+
```shell
|
|
200
|
+
python3 xpk.py workload delete \
|
|
201
|
+
--workload xpk-test-workload --cluster xpk-test
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Workload List
|
|
205
|
+
* Workload List (see training jobs):
|
|
206
|
+
|
|
207
|
+
```shell
|
|
208
|
+
python3 xpk.py workload list \
|
|
209
|
+
--cluster xpk-test
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
* Example Workload List Output:
|
|
213
|
+
|
|
214
|
+
The below example shows four jobs of different statuses:
|
|
215
|
+
|
|
216
|
+
* `user-first-job-failed`: **filter-status** is `FINISHED` and `FAILED`.
|
|
217
|
+
* `user-second-job-success`: **filter-status** is `FINISHED` and `SUCCESSFUL`.
|
|
218
|
+
* `user-third-job-running`: **filter-status** is `RUNNING`.
|
|
219
|
+
* `user-forth-job-in-queue`: **filter-status** is `QUEUED`.
|
|
220
|
+
* `user-fifth-job-in-queue-preempted`: **filter-status** is `QUEUED`.
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Jobset Name Created Time Priority TPU VMs Needed TPU VMs Running/Ran TPU VMs Done Status Status Message Status Time
|
|
224
|
+
user-first-job-failed 2023-1-1T1:00:00Z medium 4 4 <none> Finished JobSet failed 2023-1-1T1:05:00Z
|
|
225
|
+
user-second-job-success 2023-1-1T1:10:00Z medium 4 4 4 Finished JobSet finished successfully 2023-1-1T1:14:00Z
|
|
226
|
+
user-third-job-running 2023-1-1T1:15:00Z medium 4 4 <none> Admitted Admitted by ClusterQueue cluster-queue 2023-1-1T1:16:00Z
|
|
227
|
+
user-forth-job-in-queue 2023-1-1T1:16:05Z medium 4 <none> <none> Admitted couldn't assign flavors to pod set slice-job: insufficient unused quota for google.com/tpu in flavor 2xv4-8, 4 more need 2023-1-1T1:16:10Z
|
|
228
|
+
user-fifth-job-preempted 2023-1-1T1:10:05Z low 4 <none> <none> Evicted Preempted to accommodate a higher priority Workload 2023-1-1T1:10:00Z
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
* Workload List supports filtering. Observe a portion of jobs that match user criteria.
|
|
232
|
+
|
|
233
|
+
* Filter by Status: `filter-by-status`
|
|
234
|
+
|
|
235
|
+
Filter the workload list by the status of respective jobs.
|
|
236
|
+
Status can be: `EVERYTHING`,`FINISHED`, `RUNNING`, `QUEUED`, `FAILED`, `SUCCESSFUL`
|
|
237
|
+
|
|
238
|
+
* Filter by Job: `filter-by-job`
|
|
239
|
+
|
|
240
|
+
Filter the workload list by the name of a job.
|
|
241
|
+
|
|
242
|
+
```shell
|
|
243
|
+
python3 xpk.py workload list \
|
|
244
|
+
--cluster xpk-test --filter-by-job=$USER
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
# How to add docker images to a xpk workload
|
|
248
|
+
|
|
249
|
+
The default behavior is `xpk workload create` will layer the local directory (`--script-dir`) into
|
|
250
|
+
the base docker image (`--base-docker-image`) and run the workload command.
|
|
251
|
+
If you don't want this layering behavior, you can directly use `--docker-image`. Do not mix arguments from the two flows in the same command.
|
|
252
|
+
|
|
253
|
+
## Recommended / Default Docker Flow: `--base-docker-image` and `--script-dir`
|
|
254
|
+
This flow pulls the `--script-dir` into the `--base-docker-image` and runs the new docker image.
|
|
255
|
+
|
|
256
|
+
* The below arguments are optional by default. xpk will pull the local
|
|
257
|
+
directory with a generic base docker image.
|
|
258
|
+
|
|
259
|
+
- `--base-docker-image` sets the base image that xpk will start with.
|
|
260
|
+
|
|
261
|
+
- `--script-dir` sets which directory to pull into the image. This defaults to the current working directory.
|
|
262
|
+
|
|
263
|
+
See `python3 xpk.py workload create --help` for more info.
|
|
264
|
+
|
|
265
|
+
* Example with defaults which pulls the local directory into the base image:
|
|
266
|
+
```shell
|
|
267
|
+
echo -e '#!/bin/bash \n echo "Hello world from a test script!"' > test.sh
|
|
268
|
+
python3 xpk.py workload create --cluster xpk-test \
|
|
269
|
+
--workload xpk-test-workload-base-image --command "bash test.sh" \
|
|
270
|
+
--tpu-type=v5litepod-16 --num-slices=1
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
* Recommended Flow For Normal Sized Jobs (fewer than 10k accelerators):
|
|
274
|
+
```shell
|
|
275
|
+
python3 xpk.py workload create --cluster xpk-test \
|
|
276
|
+
--workload xpk-test-workload-base-image --command "bash custom_script.sh" \
|
|
277
|
+
--base-docker-image=gcr.io/your_dependencies_docker_image \
|
|
278
|
+
--tpu-type=v5litepod-16 --num-slices=1
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Optional Direct Docker Image Configuration: `--docker-image`
|
|
282
|
+
If a user wants to directly set the docker image used and not layer in the
|
|
283
|
+
current working directory, set `--docker-image` to the image to be use in the
|
|
284
|
+
workload.
|
|
285
|
+
|
|
286
|
+
* Running with `--docker-image`:
|
|
287
|
+
```shell
|
|
288
|
+
python3 xpk.py workload create --cluster xpk-test \
|
|
289
|
+
--workload xpk-test-workload-base-image --command "bash test.sh" \
|
|
290
|
+
--tpu-type=v5litepod-16 --num-slices=1 --docker-image=gcr.io/your_docker_image
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
* Recommended Flow For Large Sized Jobs (more than 10k accelerators):
|
|
294
|
+
```shell
|
|
295
|
+
python3 xpk.py cluster cacheimage \
|
|
296
|
+
--cluster xpk-test --docker-image gcr.io/your_docker_image
|
|
297
|
+
# Run workload create with the same image.
|
|
298
|
+
python3 xpk.py workload create --cluster xpk-test \
|
|
299
|
+
--workload xpk-test-workload-base-image --command "bash test.sh" \
|
|
300
|
+
--tpu-type=v5litepod-16 --num-slices=1 --docker-image=gcr.io/your_docker_image
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
# More advanced facts:
|
|
304
|
+
|
|
305
|
+
* Workload create accepts a --docker-name and --docker-image.
|
|
306
|
+
By using custom images you can achieve very fast boots and hence very fast
|
|
307
|
+
feedback.
|
|
308
|
+
|
|
309
|
+
* Workload create accepts a --env-file flag to allow specifying the container's
|
|
310
|
+
environment from a file. Usage is the same as Docker's
|
|
311
|
+
[--env-file flag](https://docs.docker.com/engine/reference/commandline/run/#env)
|
|
312
|
+
|
|
313
|
+
* Workload create accepts a --debug-dump-gcs flag which is a path to GCS bucket.
|
|
314
|
+
Passing this flag sets the XLA_FLAGS='--xla_dump_to=/tmp/xla_dump/' and uploads
|
|
315
|
+
hlo dumps to the specified GCS bucket for each worker.
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
# Troubleshooting
|
|
319
|
+
|
|
320
|
+
## `Invalid machine type` for CPUs.
|
|
321
|
+
XPK will create a regional GKE cluster. If you see issues like
|
|
322
|
+
|
|
323
|
+
```shell
|
|
324
|
+
Invalid machine type e2-standard-32 in zone $ZONE_NAME
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Please select a CPU type that exists in all zones in the region.
|
|
328
|
+
|
|
329
|
+
```shell
|
|
330
|
+
# Find CPU Types supported in zones.
|
|
331
|
+
gcloud compute machine-types list --zones=$ZONE_LIST
|
|
332
|
+
# Adjust default cpu machine type.
|
|
333
|
+
python3 xpk.py cluster create --cluster-cpu-machine-type=CPU_TYPE ...
|
|
334
|
+
```
|