Skip to content

Commit

Permalink
Katib UI for v1alpha2 (kubeflow#486)
Browse files Browse the repository at this point in the history
* Init commit

* Half of backend edit

* Backend for v1alpha2 UI is done

* Fix gopkg.toml

* fix gopkg lock

* Almost submit HP job by params done

* Modify gitignore

* Add by parameters for HP and NAS done

* HP and NAS jobs functionality done

* Template is done

* Add new filters in job list
Create a new build with frontend

* Fix newlines

* Review changes

* Add tests for katib-ui

* Delete pkg

* Add pkg

* Fix backend
  • Loading branch information
andreyvelich authored and k8s-ci-robot committed May 17, 2019
1 parent bd39447 commit 4ec45bb
Show file tree
Hide file tree
Showing 159 changed files with 17,195 additions and 22 deletions.
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 @@ -92,6 +92,10 @@ required = [
name = "github.com/kubeflow/pytorch-operator"
version = "0.5.0-rc.1"

[[constraint]]
name = "github.com/awalterschulze/gographviz"
branch = "master"

[[prune.project]]
name = "github.com/kubeflow/katib"
unused-packages = false
Expand Down
14 changes: 14 additions & 0 deletions cmd/ui/v1alpha1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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 ./v1alpha1

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/v1alpha1/static /app/static
COPY cmd/ui/v1alpha1/template /app/template

ENTRYPOINT ["./katib-ui"]
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.
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.
7 changes: 4 additions & 3 deletions cmd/ui/Dockerfile → cmd/ui/v1alpha2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ 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 ./v1alpha2

FROM alpine:3.7
WORKDIR /app
# v1alpha2 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
COPY --from=build-env /go/src/github.com/kubeflow/katib/pkg/ui/v1alpha2/frontend/build/ /app/build

ENTRYPOINT ["./katib-ui"]
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))

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.SubmitParamsJob)
http.HandleFunc("/katib/submit_nas_job/", kuh.SubmitParamsJob)

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

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

0 comments on commit 4ec45bb

Please sign in to comment.