运行 XGBoostJob
使用 Kueue 调度 XGBoostJob
此页面展示了在运行 Trainer XGBoostJob 时,如何利用 Kueue 的调度和资源管理能力。
本指南适用于对 Kueue 有基本了解的批处理用户。 欲了解更多信息,请参阅 Kueue 概述。
开始之前
请查看管理集群配额, 以了解初始集群设置的详细信息。
查阅 Trainer 安装指南。
请注意,Trainer 的最低要求版本是 v1.7.0。
你可以修改已安装版本的 Kueue 配置,以包含 XGBoostJobs 作为允许的工作负载。
Note
要 v0.8.1 版本之前使用 Trainer,你需要在安装后重启 Kueue。 你可以通过运行以下命令来实现:kubectl delete pods -l control-plane=controller-manager -n kueue-system
。XGBoostJob 定义
a. 队列选择
目标本地队列应在 XGBoostJob
配置的 metadata.labels
部分中指定。
metadata:
labels:
kueue.x-k8s.io/queue-name: user-queue
b. 可选择在 XGBoostJob 中设置 Suspend 字段
spec:
runPolicy:
suspend: true
默认情况下,Kueue 将通过 Webhook 将 suspend
设置为 true,
并在 XGBoostJob 被接受时取消挂起。
示例 XGBoostJob
apiVersion: kubeflow.org/v1
kind: XGBoostJob
metadata:
name: xgboost-dist-iris-test-train
namespace: default
labels:
kueue.x-k8s.io/queue-name: user-queue
spec:
xgbReplicaSpecs:
Master:
replicas: 1
restartPolicy: Never
template:
spec:
containers:
- name: xgboost
image: docker.io/kubeflow/xgboost-dist-iris:latest
resources:
requests:
cpu: 0.5
memory: 256Mi
ports:
- containerPort: 9991
name: xgboostjob-port
imagePullPolicy: Always
args:
- --job_type=Train
- --xgboost_parameter=objective:multi:softprob,num_class:3
- --n_estimators=10
- --learning_rate=0.1
- --model_path=/tmp/xgboost-model
- --model_storage_type=local
Worker:
replicas: 2
restartPolicy: ExitCode
template:
spec:
containers:
- name: xgboost
image: docker.io/kubeflow/xgboost-dist-iris:latest
resources:
requests:
cpu: 0.5
memory: 256Mi
ports:
- containerPort: 9991
name: xgboostjob-port
imagePullPolicy: Always
args:
- --job_type=Train
- --xgboost_parameter="objective:multi:softprob,num_class:3"
- --n_estimators=10
- --learning_rate=0.1
反馈
这个页面有帮助吗?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.