Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
Fix bug checking if training is running. (#182)
Browse files Browse the repository at this point in the history
* It is NeedsTraining not NeedsSync that needs to check whether there is
  a training job running.

Related to #178
  • Loading branch information
jlewi authored Oct 4, 2020
1 parent 3fc43f4 commit 9940f13
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Label_Microservice/auto-update/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resources:
- deployment.yaml
- service-account.yaml
images:
- digest: sha256:2b7e759153baacf59514c98e50cb01eec0fc7aa2d7e2b271ac0a3c5cc516a74d
- digest: sha256:9a93e576825c65b1062424869ce93d47d90fed9117891dd95e31eeb57e878a90
name: gcr.io/issue-label-bot-dev/labelbot-diff
newName: gcr.io/issue-label-bot-dev/labelbot-diff:3697618-dirty
newName: gcr.io/issue-label-bot-dev/labelbot-diff:63789ef
24 changes: 12 additions & 12 deletions Label_Microservice/go/cmd/automl/pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ func (s *Server) NeedsSync(w http.ResponseWriter, r *http.Request) {
}

getErr := func() error {
isTraining, err := automl.IsTraining(s.Project, s.Location)

if err != nil {
appendError(response, fmt.Sprintf("Error checking if model is being trained; %v", err))
return err
}

if isTraining {
log.Infof("There is model currently being trained; no sync needed.")
return nil
}

latest, err := automl.GetLatestDeployed(s.Project, s.Location, s.Name)

if err != nil {
Expand Down Expand Up @@ -132,6 +120,18 @@ func (s *Server) NeedsTrain(w http.ResponseWriter, r *http.Request) {
}

getErr := func() error {
isTraining, err := automl.IsTraining(s.Project, s.Location)

if err != nil {
appendError(response, fmt.Sprintf("Error checking if model is being trained; %v", err))
return err
}

if isTraining {
log.Infof("There is model currently being trained; no sync needed.")
return nil
}

latest, err := automl.GetLatestTrained(s.Project, s.Location, s.Name)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion Label_Microservice/labelbot-diff.image.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"builds":[{"imageName":"gcr.io/issue-label-bot-dev/labelbot-diff","tag":"gcr.io/issue-label-bot-dev/labelbot-diff:3697618-dirty@sha256:2b7e759153baacf59514c98e50cb01eec0fc7aa2d7e2b271ac0a3c5cc516a74d"}]}
{"builds":[{"imageName":"gcr.io/issue-label-bot-dev/labelbot-diff","tag":"gcr.io/issue-label-bot-dev/labelbot-diff:63789ef@sha256:9a93e576825c65b1062424869ce93d47d90fed9117891dd95e31eeb57e878a90"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
- --kptFile=/src/code-intelligence.git/Label_Microservice/deployment/Kptfile
- --port=8080
- --retrainInterval=24h
image: gcr.io/issue-label-bot-dev/labelbot-diff:3697618-dirty@sha256:2b7e759153baacf59514c98e50cb01eec0fc7aa2d7e2b271ac0a3c5cc516a74d
image: gcr.io/issue-label-bot-dev/labelbot-diff:63789ef@sha256:9a93e576825c65b1062424869ce93d47d90fed9117891dd95e31eeb57e878a90
name: diff
ports:
- containerPort: 8080
Expand Down

0 comments on commit 9940f13

Please sign in to comment.