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

Katib UI for v1alpha2 #486

Merged
merged 23 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from 14 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
17 changes: 17 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ required = [
[[constraint]]
name = "github.com/kubeflow/pytorch-operator"
version = "0.5.0-rc.1"

[[constraint]]
name = "github.com/awalterschulze/gographviz"
branch = "master"
12 changes: 8 additions & 4 deletions cmd/ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ FROM golang:alpine AS build-env
# The GOPATH in the image is /go.
ADD . /go/src/github.com/kubeflow/katib
WORKDIR /go/src/github.com/kubeflow/katib/cmd/ui
RUN go build -o katib-ui
RUN go build -o katib-ui ./v1alpha1
RUN go build -o katib-ui.v1alpha2 ./v1alpha2

FROM alpine:3.7
WORKDIR /app
# v1alpha1 source code
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/ui/katib-ui /app/
COPY cmd/ui/static /app/static
COPY cmd/ui/template /app/template
ENTRYPOINT ["./katib-ui"]
COPY cmd/ui/v1alpha1/static /app/static
COPY cmd/ui/v1alpha1/template /app/template
# v1alpha2 source code
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/ui/katib-ui.v1alpha2 /app/
COPY --from=build-env /go/src/github.com/kubeflow/katib/pkg/ui/v1alpha2/frontend/build/ /app/build
5 changes: 3 additions & 2 deletions cmd/ui/main.go → cmd/ui/v1alpha1/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"github.com/kubeflow/katib/pkg/ui"
"github.com/pressly/chi"
"net/http"

"github.com/kubeflow/katib/pkg/ui/v1alpha1"
"github.com/pressly/chi"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions cmd/ui/v1alpha2/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

import (
"net/http"

ui "github.com/kubeflow/katib/pkg/ui/v1alpha2"
)

var (
port = "80"
)

func main() {
kuh := ui.NewKatibUIHandler()

frontend := http.FileServer(http.Dir("/app/build/"))
http.Handle("/katib/", http.StripPrefix("/katib/", frontend))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is only one deployment for UI, in a single container, both http server and logic to call Katib-manager to operate experiment/trial/metrics.. and converting the results are running, right?
I had thought there would be two deployments (frontend and backend).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be one deployment with frontend and backend.
All JS for frontend will be store in build folder here: https://github.com/andreyvelich/katib/tree/v1alpha2-new-ui/pkg/ui/v1alpha2/frontend/build/static.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the container works too heavy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be fine, no reason to divide frontend and backend sides.
All frontend builds in a 3 JS files by React.


http.HandleFunc("/katib/fetch_hp_jobs/", kuh.FetchHPJobs)
http.HandleFunc("/katib/fetch_nas_jobs/", kuh.FetchNASJobs)
http.HandleFunc("/katib/submit_yaml/", kuh.SubmitYamlJob)
http.HandleFunc("/katib/submit_hp_job/", kuh.SubmitHPJob)
http.HandleFunc("/katib/submit_nas_job/", kuh.SubmitNASJob)

//TODO: Add it in Katib client
http.HandleFunc("/katib/delete_job/", kuh.DeleteJob)

http.HandleFunc("/katib/fetch_hp_job_info/", kuh.FetchHPJobInfo)
http.HandleFunc("/katib/fetch_hp_job_trial_info/", kuh.FetchHPJobTrialInfo)
http.HandleFunc("/katib/fetch_nas_job_info/", kuh.FetchNASJobInfo)

http.HandleFunc("/katib/fetch_trial_templates/", kuh.FetchTrialTemplates)
http.HandleFunc("/katib/fetch_collector_templates/", kuh.FetchMetricsCollectorTemplates)
http.HandleFunc("/katib/update_template/", kuh.AddEditDeleteTemplate)

http.ListenAndServe(":"+port, nil)
}
4 changes: 2 additions & 2 deletions pkg/ui/ui.go → pkg/ui/v1alpha1/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

common "github.com/kubeflow/katib/pkg/common/v1alpha1"
studyjobv1alpha1 "github.com/kubeflow/katib/pkg/api/operators/apis/studyjob/v1alpha1"
"github.com/kubeflow/katib/pkg/api/v1alpha1"
api "github.com/kubeflow/katib/pkg/api/v1alpha1"
"github.com/kubeflow/katib/pkg/manager/v1alpha1/studyjobclient"

"github.com/pressly/chi"
Expand Down Expand Up @@ -375,7 +375,7 @@ func (k *KatibUIHandler) MetricsCollectorTemplate(w http.ResponseWriter, r *http
MetricsCollectorTemplate map[string]string
}
mtv := MetricsCollectorTemplateView{
IDList: &IDList{},
IDList: &IDList{},
MetricsCollectorTemplate: mt,
}
if err != nil {
Expand Down
Loading