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

ss #1

Merged
merged 5 commits into from
Feb 24, 2019
Merged

ss #1

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
19 changes: 11 additions & 8 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ func (s *server) CreateStudy(ctx context.Context, in *api_pb.CreateStudyRequest)
if in == nil || in.StudyConfig == nil {
return &api_pb.CreateStudyReply{}, errors.New("StudyConfig is missing.")
}

studyID, err := dbIf.CreateStudy(in.StudyConfig)
if err != nil {
return &api_pb.CreateStudyReply{}, err
}
s.SaveStudy(ctx, &api_pb.SaveStudyRequest{
StudyName: in.StudyConfig.Name,
Owner: in.StudyConfig.Owner,
Description: "StudyID: " + studyID,
})

return &api_pb.CreateStudyReply{StudyId: studyID}, nil
}

Expand All @@ -56,7 +53,12 @@ func (s *server) DeleteStudy(ctx context.Context, in *api_pb.DeleteStudyRequest)
}

func (s *server) GetStudy(ctx context.Context, in *api_pb.GetStudyRequest) (*api_pb.GetStudyReply, error) {
sc, err := dbIf.GetStudyConfig(in.StudyId)

sc, err := dbIf.GetStudy(in.StudyId)

if err != nil {
return &api_pb.GetStudyReply{}, err
}
return &api_pb.GetStudyReply{StudyConfig: sc}, err
}

Expand All @@ -67,7 +69,7 @@ func (s *server) GetStudyList(ctx context.Context, in *api_pb.GetStudyListReques
}
result := make([]*api_pb.StudyOverview, len(sl))
for i, id := range sl {
sc, err := dbIf.GetStudyConfig(id)
sc, err := dbIf.GetStudy(id)
if err != nil {
return &api_pb.GetStudyListReply{}, err
}
Expand Down Expand Up @@ -149,7 +151,7 @@ func (s *server) GetMetrics(ctx context.Context, in *api_pb.GetMetricsRequest) (
if in.StudyId == "" {
return &api_pb.GetMetricsReply{}, errors.New("StudyId should be set")
}
sc, err := dbIf.GetStudyConfig(in.StudyId)
sc, err := dbIf.GetStudy(in.StudyId)
if err != nil {
return &api_pb.GetMetricsReply{}, err
}
Expand Down Expand Up @@ -214,6 +216,7 @@ func (s *server) UpdateWorkerState(ctx context.Context, in *api_pb.UpdateWorkerS
func (s *server) GetWorkerFullInfo(ctx context.Context, in *api_pb.GetWorkerFullInfoRequest) (*api_pb.GetWorkerFullInfoReply, error) {
return dbIf.GetWorkerFullInfo(in.StudyId, in.TrialId, in.WorkerId, in.OnlyLatestLog)
}

func (s *server) SetSuggestionParameters(ctx context.Context, in *api_pb.SetSuggestionParametersRequest) (*api_pb.SetSuggestionParametersReply, error) {
var err error
var id string
Expand Down
2 changes: 1 addition & 1 deletion cmd/manager/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestGetStudies(t *testing.T) {
}
mockDB.EXPECT().GetStudyList().Return(sid, nil)
for i := range sid {
mockDB.EXPECT().GetStudyConfig(sid[i]).Return(sc[i], nil)
mockDB.EXPECT().GetStudy(sid[i]).Return(sc[i], nil)
}

req := &api.GetStudyListRequest{}
Expand Down
3 changes: 2 additions & 1 deletion cmd/suggestion/nasrl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM python:3
FROM python:3.6

ADD . /usr/src/app/github.com/kubeflow/katib
WORKDIR /usr/src/app/github.com/kubeflow/katib/cmd/suggestion/nasrl
RUN pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
RUN pip install --no-cache-dir -r requirements.txt
ENV PYTHONPATH /usr/src/app/github.com/kubeflow/katib:/usr/src/app/github.com/kubeflow/katib/pkg/api/python

Expand Down
6 changes: 0 additions & 6 deletions cmd/suggestion/nasrl/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
grpcio
duecredit
cloudpickle==0.5.6
numpy>=1.13.3
scikit-learn>=0.19.0
scipy>=0.19.1
forestci
protobuf
googleapis-common-protos
7 changes: 7 additions & 0 deletions manifests/studyjobcontroller/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rules:
resources:
- configmaps
- serviceaccounts
- services
verbs:
- "*"
- apiGroups:
Expand All @@ -32,6 +33,12 @@ rules:
verbs:
- create
- get
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
verbs:
- '*'
- apiGroups:
- kubeflow.org
resources:
Expand Down
12 changes: 12 additions & 0 deletions manifests/studyjobcontroller/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: studyjob-controller
namespace: kubeflow
spec:
ports:
- port: 443
protocol: TCP
targetPort: 443
selector:
app: studyjob-controller
4 changes: 4 additions & 0 deletions manifests/studyjobcontroller/studyjobcontroller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
- name: studyjob-controller
image: katib/studyjob-controller
imagePullPolicy: Always
ports:
- containerPort: 443
name: validating
protocol: TCP
env:
- name: VIZIER_CORE_NAMESPACE
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: vizier-suggestion-nasrl
image: docker.io/deepermind/katib-nasrl-suggestion
image: katib/suggestion-nasrl
ports:
- name: api
containerPort: 6789
7 changes: 1 addition & 6 deletions pkg/controller/studyjob/katib_api_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ import (
"google.golang.org/grpc"
)

func initializeStudy(instance *katibv1alpha1.StudyJob, ns string) error {
if validErr := validateStudy(instance, ns); validErr != nil {
instance.Status.Condition = katibv1alpha1.ConditionFailed
return validErr
}

func initializeStudy(instance *katibv1alpha1.StudyJob) error {
if instance.Spec.SuggestionSpec.SuggestionAlgorithm == "" {
instance.Spec.SuggestionSpec.SuggestionAlgorithm = "random"
}
Expand Down
Loading