Skip to content

Commit

Permalink
Merge pull request IBM#11 from sboagibm/try_to_get_lcm_logging_working
Browse files Browse the repository at this point in the history
try dumb stuff to get logging working
  • Loading branch information
fplk authored May 21, 2018
2 parents 90af5c3 + ef5092b commit 8144e7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ test-submit-minikube-run-test: ## Submit test training job
echo "Dumping Statefulsets" ; \
kubectl get statefulsets | grep learner- | awk '{print $$1}' | xargs -I '{}' kubectl get statefulsets '{}' -o yaml; \
echo "LCM:"; \
kubectl get pods | grep lcm- | awk '{print $$1}' | xargs -I '{}' kubectl logs '{}'; \
kubectl logs --selector=service=ffdl-lcm ; \
echo "Trainer:"; \
kubectl get pods | grep trainer- | awk '{print $$1}' | xargs -I '{}' kubectl logs '{}'; \
echo "Jobmonitor:"; \
Expand Down
6 changes: 6 additions & 0 deletions lcm/service/lcm/service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
k8srest "k8s.io/client-go/rest"
"fmt"
)

// Confuse `go vet' to not check this `Errorf' call. :(
Expand Down Expand Up @@ -160,6 +161,8 @@ func newService() (*lcmService, error) {
//Deploys a training job in DLaaS. Retained for compatibility with other DLaaS microservices
func (s *lcmService) DeployTrainingJob(ctx context.Context, req *service.JobDeploymentRequest) (*service.JobDeploymentResponse, error) {
//extend the logger with required fields and this logr will be passed around
fmt.Printf("*** IN DeployTrainingJob !!!\n")
logrus.SetLevel(logrus.DebugLevel)
logrus.StandardLogger().Debugf("Entry DeployTrainingJob function")
logr := logger.LocLogger(InitLogger(req.TrainingId, req.UserId).WithFields(logrus.Fields{
"name": req.Name,
Expand All @@ -169,6 +172,7 @@ func (s *lcmService) DeployTrainingJob(ctx context.Context, req *service.JobDepl
"memory": req.Resources.Memory,
}))

fmt.Printf("*** Entry DeployTrainingJob !!!\n")
logr.Debug("Entry DeployTrainingJob")

totalTrainingCounter.With("framework", req.Framework).Add(1)
Expand All @@ -178,9 +182,11 @@ func (s *lcmService) DeployTrainingJob(ctx context.Context, req *service.JobDepl
logr.WithError(err).Errorf("(deployDistributedTrainingJob) Before deploying job, error while calling Trainer service client update for trainingID %s , but still carrying on ", req.TrainingId)
}

fmt.Printf("*** Calling s.deployDistributedTrainingJob !!!\n")
logr.Debug("Calling s.deployDistributedTrainingJob")
go s.deployDistributedTrainingJob(ctx, req, logr)
logr.Debug("Back from s.deployDistributedTrainingJob")
fmt.Printf("*** Back from s.deployDistributedTrainingJob !!!\n")
return &service.JobDeploymentResponse{Name: req.Name}, nil
}

Expand Down

0 comments on commit 8144e7a

Please sign in to comment.