Skip to content

Commit

Permalink
add simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizhiqing committed Nov 10, 2022
1 parent c9e5986 commit 5ddc736
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/paddlejob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (r *PaddleJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

// scheduling with volcano
if r.Scheduling == schedulerNameVolcano && !withVolcano(&pdj) {
if r.Scheduling == schedulerNameVolcano && withVolcano(&pdj) {
pg := &volcano.PodGroup{}
err := r.Get(ctx, client.ObjectKeyFromObject(&pdj), pg)
if pdj.Status.Phase == pdv1.Failed || pdj.Status.Phase == pdv1.Completed {
Expand Down Expand Up @@ -217,7 +217,7 @@ func (r *PaddleJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
pod.Spec.InitContainers = append(pod.Spec.InitContainers, coInit)
}

if r.Scheduling == schedulerNameVolcano && !withVolcano(&pdj) {
if r.Scheduling == schedulerNameVolcano && withVolcano(&pdj) {
pod.Spec.SchedulerName = schedulerNameVolcano
pod.ObjectMeta.Annotations[schedulingPodGroupAnnotation] = pdj.Name
pod.ObjectMeta.Annotations[volcanoBatch.TaskSpecKey] = resType
Expand Down
19 changes: 19 additions & 0 deletions deploy/examples/simple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: batch.paddlepaddle.org/v1
kind: PaddleJob
metadata:
name: simple
spec:
cleanPodPolicy: Never
worker:
replicas: 2
template:
spec:
containers:
- name: simple
image: registry.baidubce.com/paddlepaddle/paddle:2.4.0rc0-cpu
command:
- python
args:
- "-m"
- "paddle.distributed.launch"
- "run_check"

0 comments on commit 5ddc736

Please sign in to comment.