Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reqest count #214

Merged
merged 4 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/random-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ spec:
apiVersion: batch/v1
kind: Job
metadata:
name: {{.WorkerId}}
name: {{.WorkerID}}
namespace: katib
spec:
template:
spec:
containers:
- name: {{.WorkerId}}
- name: {{.WorkerID}}
image: katib/mxnet-mnist-example
command:
- "python"
Expand Down
8 changes: 4 additions & 4 deletions examples/workerConfigMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: {{.WorkerId}}
name: {{.WorkerID}}
namespace: katib
spec:
template:
spec:
containers:
- name: {{.WorkerId}}
- name: {{.WorkerID}}
image: katib/mxnet-mnist-example
command:
- "python"
Expand All @@ -30,13 +30,13 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: {{.WorkerId}}
name: {{.WorkerID}}
namespace: katib
spec:
template:
spec:
containers:
- name: {{.WorkerId}}
- name: {{.WorkerID}}
image: katib/mxnet-mnist-example:gpu
command:
- "python"
Expand Down
10 changes: 5 additions & 5 deletions manifests/studyjobcontroller/metricsControllerConfigMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{.WorkerId}}
name: {{.WorkerID}}
namespace: katib
spec:
schedule: "*/1 * * * *"
Expand All @@ -20,16 +20,16 @@ data:
spec:
serviceAccountName: metrics-collector
containers:
- name: {{.WorkerId}}
- name: {{.WorkerID}}
image: katib/metrics-collector
args:
- "./metricscollector"
- "-s"
- "{{.StudyId}}"
- "{{.StudyID}}"
- "-t"
- "{{.TrialId}}"
- "{{.TrialID}}"
- "-w"
- "{{.WorkerId}}"
- "{{.WorkerID}}"
- "-n"
- "{{.NameSpace}}"
restartPolicy: Never
4 changes: 2 additions & 2 deletions manifests/studyjobcontroller/workerConfigMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: {{.WorkerId}}
name: {{.WorkerID}}
namespace: katib
spec:
template:
spec:
containers:
- name: {{.WorkerId}}
- name: {{.WorkerID}}
image: alpine
restartPolicy: Never
17 changes: 8 additions & 9 deletions pkg/controller/studyjobcontroller/studyjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,12 @@ func (r *ReconcileStudyJobController) checkStatus(instance *katibv1alpha1.StudyJ
log.Printf("Check Goal failed %v", err)
}
}
if instance.Status.SuggestionCount > 0 && instance.Status.SuggestionCount > instance.Spec.RequestCount {
log.Printf("Study %s reached the request count. It is completed", instance.Status.StudyID)
instance.Status.Condition = katibv1alpha1.ConditionCompleted
update = true
nextSuggestionSchedule = false
}
if nextSuggestionSchedule {
if instance.Spec.RequestCount > 0 && instance.Status.SuggestionCount > instance.Spec.RequestCount {
log.Printf("Study %s reached the request count. It is completed", instance.Status.StudyID)
instance.Status.Condition = katibv1alpha1.ConditionCompleted
return true, nil
}
return r.getAndRunSuggestion(instance, c, ns)
} else {
return update, nil
Expand Down Expand Up @@ -874,9 +873,9 @@ func (r *ReconcileStudyJobController) getMetricsCollectorManifest(studyID string
var mtp *template.Template = nil
var err error
tmpValues := map[string]string{
"StudyId": studyID,
"TrialId": trialID,
"WorkerId": workerID,
"StudyID": studyID,
"TrialID": trialID,
"WorkerID": workerID,
"NameSpace": namespace,
}
if mcs != nil {
Expand Down