Skip to content

Commit

Permalink
Modify XGBoostJob example for the new Controller (#1623)
Browse files Browse the repository at this point in the history
* Modify XGBoostJob example for the new Controller

* Modify port
  • Loading branch information
andreyvelich authored Aug 15, 2021
1 parent 4ef26ef commit ecb4686
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
15 changes: 5 additions & 10 deletions examples/v1beta1/xgboost-lightgbm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: kubeflow.org/v1beta1
kind: Experiment
metadata:
namespace: kubeflow
name: xgboost-lightgbm
name: xgboostjob-lightgbm
spec:
objective:
type: maximize
Expand Down Expand Up @@ -35,11 +35,7 @@ spec:
max: "60"
step: "1"
trialTemplate:
primaryPodLabels:
job-role: master
primaryContainerName: xgboostjob
successCondition: status.conditions.#(type=="Succeeded")#|#(status=="True")#
failureCondition: status.conditions.#(type=="Failed")#|#(status=="True")#
primaryContainerName: xgboost
trialParameters:
- name: learningRate
description: Learning rate for the training model
Expand All @@ -48,8 +44,7 @@ spec:
description: Number of leaves for one tree
reference: num-leaves
trialSpec:
# TODO (andreyvelich): Change to kubeflow.org/v1 once all-in-one operator is finished.
apiVersion: xgboostjob.kubeflow.org/v1
apiVersion: kubeflow.org/v1
kind: XGBoostJob
spec:
xgbReplicaSpecs:
Expand All @@ -59,7 +54,7 @@ spec:
template:
spec:
containers:
- name: xgboostjob
- name: xgboost
image: docker.io/kubeflowkatib/xgboost-lightgbm:1.0
ports:
- containerPort: 9991
Expand Down Expand Up @@ -93,7 +88,7 @@ spec:
template:
spec:
containers:
- name: xgboostjob
- name: xgboost
image: docker.io/kubeflowkatib/xgboost-lightgbm:1.0
ports:
- containerPort: 9991
Expand Down
3 changes: 1 addition & 2 deletions manifests/v1beta1/components/controller/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ spec:
- "--trial-resources=TFJob.v1.kubeflow.org"
- "--trial-resources=PyTorchJob.v1.kubeflow.org"
- "--trial-resources=MPIJob.v1.kubeflow.org"
# TODO (andreyvelich): Change to v1.kubeflow.org once all-in-one operator is finished.
- "--trial-resources=XGBoostJob.v1.xgboostjob.kubeflow.org"
- "--trial-resources=XGBoostJob.v1.kubeflow.org"
ports:
- containerPort: 8443
name: webhook
Expand Down
6 changes: 0 additions & 6 deletions manifests/v1beta1/components/controller/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ rules:
- tfjobs
- pytorchjobs
- mpijobs
verbs:
- "*"
# TODO (andreyvelich): Move to "apiGroup: kubeflow.org" once all-in-one operator is finished.
- apiGroups:
- xgboostjob.kubeflow.org
resources:
- xgboostjobs
verbs:
- "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (e *Experiment) setDefaultObjective() {
func (e *Experiment) setDefaultTrialTemplate() {
t := e.Spec.TrialTemplate

// Set default values for Job, TFJob and PyTorchJob if TrialSpec is not nil
// Set default values for Job and Kubeflow Training Job if TrialSpec is not nil
if t != nil && t.TrialSource.TrialSpec != nil {
jobKind := t.TrialSource.TrialSpec.GetKind()
if jobKind == consts.JobKindJob {
Expand All @@ -106,7 +106,7 @@ func (e *Experiment) setDefaultTrialTemplate() {
if t.FailureCondition == "" {
t.FailureCondition = DefaultJobFailureCondition
}
} else if jobKind == consts.JobKindTF || jobKind == consts.JobKindPyTorch {
} else if jobKind == consts.JobKindTF || jobKind == consts.JobKindPyTorch || jobKind == consts.JobKindXGBoost {
if t.SuccessCondition == "" {
t.SuccessCondition = DefaultKubeflowJobSuccessCondition
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller.v1beta1/consts/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ const (
JobKindTF = "TFJob"
// JobKindPyTorch is the kind of PyTorchJob.
JobKindPyTorch = "PyTorchJob"
// JobKindXGBoost is the kind of XGBoostJob.
JobKindXGBoost = "XGBoostJob"

// AnnotationIstioSidecarInjectName is the annotation of Istio Sidecar
AnnotationIstioSidecarInjectName = "sidecar.istio.io/inject"
Expand Down

0 comments on commit ecb4686

Please sign in to comment.