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

feat: Support step when using grid in UI #821

Merged
merged 4 commits into from
Sep 26, 2019
Merged
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
7 changes: 3 additions & 4 deletions cmd/ui/v1alpha3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package main
import (
"flag"
"fmt"
"log"
"net/http"

"k8s.io/klog"

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

Expand All @@ -23,7 +22,7 @@ func main() {
flag.Parse()
kuh := ui.NewKatibUIHandler()

klog.Infof("Serving the frontend dir %s", *buildDir)
log.Printf("Serving the frontend dir %s", *buildDir)
frontend := http.FileServer(http.Dir(*buildDir))
http.Handle("/katib/", http.StripPrefix("/katib/", frontend))

Expand All @@ -43,7 +42,7 @@ func main() {
http.HandleFunc("/katib/fetch_trial_templates/", kuh.FetchTrialTemplates)
http.HandleFunc("/katib/update_template/", kuh.AddEditDeleteTemplate)

klog.Infof("Serving at %s:%s", *host, *port)
log.Printf("Serving at %s:%s", *host, *port)
if err := http.ListenAndServe(fmt.Sprintf("%s:%s", *host, *port), nil); err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/ui/v1alpha3/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
"node"
],
"watchPlugins": [
"/home/akado2009/go/src/github.com/kubeflow/katib/pkg/ui/frontend/node_modules/jest-watch-typeahead/filename.js",
"/home/akado2009/go/src/github.com/kubeflow/katib/pkg/ui/frontend/node_modules/jest-watch-typeahead/testname.js"
"./node_modules/jest-watch-typeahead/filename.js",
"./node_modules/jest-watch-typeahead/testname.js"
]
},
"babel": {
Expand Down
5 changes: 3 additions & 2 deletions pkg/ui/v1alpha3/frontend/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ checkBrowsers(paths.appPath, isInteractive)
if (isInteractive) {
clearConsole();
}
console.log(chalk.cyan('Starting the development server...\n'));
console.log(chalk.cyan(`Starting the development server on ${HOST}:${port}...\n`));
openBrowser(urls.localUrlForBrowser);
});

['SIGINT', 'SIGTERM'].forEach(function(sig) {
['SIGINT', 'SIGTERM', 'SIGQUIT'].forEach(function(sig) {
process.on(sig, function() {
console.log("Terminating");
devServer.close();
process.exit();
});
Expand Down
57 changes: 30 additions & 27 deletions pkg/ui/v1alpha3/frontend/src/components/HP/Create/HPParameters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const SectionInTypography = (name, classes) => {
<Typography variant="h6">
{name}
</Typography>
<hr />
<hr />
</Grid>
</Grid>
</div>
Expand All @@ -86,7 +86,7 @@ const addAlgorithmSettings = (spec, destination) => {

const addParameter = (source, destination) => {
source.map((param, i) => {
let tempParam = {}
let tempParam = {}
tempParam.name = param.name
tempParam.parameterType = param.parameterType
tempParam.feasibleSpace = {}
Expand All @@ -95,6 +95,9 @@ const addParameter = (source, destination) => {
} else {
tempParam.feasibleSpace.min = param.min
tempParam.feasibleSpace.max = param.max
if (param.step != "") {
tempParam.feasibleSpace.step = param.step
}
}
destination.push(tempParam)
})
Expand All @@ -111,15 +114,15 @@ const HPParameters = (props) => {
data.spec.objective = {}
deCapitalizeFirstLetterAndAppend(props.objective, data.spec.objective)
data.spec.objective.additionalMetricNames = props.additionalMetricNames.map((metrics, i) => metrics.value)

data.spec.algorithm = {}
data.spec.algorithm.algorithmName = props.algorithmName
data.spec.algorithm.algorithmSettings = []
data.spec.algorithm.algorithmSettings = []
addAlgorithmSettings(props.algorithmSettings, data.spec.algorithm.algorithmSettings)

data.spec.parameters = []
addParameter(props.parameters, data.spec.parameters)

//TODO: Add support not only for default ConfigMap for Trial-Templates
data.spec.trialTemplate = {
goTemplate: {
Expand All @@ -137,29 +140,29 @@ const HPParameters = (props) => {
const { classes } = props;

return (
<div className={classes.root}>
{/* Common Metadata */}
{SectionInTypography("Metadata", classes)}
<br />
<CommonParametersMeta />
{SectionInTypography("Common Parameters", classes)}
<CommonParametersSpec />
{SectionInTypography("Objective", classes)}
<Objective />
{SectionInTypography("Algorithm", classes)}
<Algorithm/>

{SectionInTypography("Parameters", classes)}
<Parameters />
{SectionInTypography("Trial Spec", classes)}
<TrialSpecParam />
<div className={classes.submit}>
<Button variant="contained" color={"primary"} className={classes.button} onClick={submitJob}>
Deploy
<div className={classes.root}>
{/* Common Metadata */}
{SectionInTypography("Metadata", classes)}
<br />
<CommonParametersMeta />
{SectionInTypography("Common Parameters", classes)}
<CommonParametersSpec />
{SectionInTypography("Objective", classes)}
<Objective />
{SectionInTypography("Algorithm", classes)}
<Algorithm />

{SectionInTypography("Parameters", classes)}
<Parameters />
{SectionInTypography("Trial Spec", classes)}
<TrialSpecParam />

<div className={classes.submit}>
<Button variant="contained" color={"primary"} className={classes.button} onClick={submitJob}>
Deploy
</Button>
</div>
</div>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const Parameters = (props) => {
}))

}
{param.feasibleSpace === "feasibleSpace" &&
{param.feasibleSpace === "feasibleSpace" &&
<div>
<TextField
label={"Min"}
Expand All @@ -173,7 +173,15 @@ const Parameters = (props) => {
value={param.max}
onChange={onGeneralEdit(i, "max")}
/>
</div>
{props.algorithmName === "grid" && param.parameterType === "double" &&
<TextField
label={"Step"}
className={classes.textField}
value={param.step}
onChange={onGeneralEdit(i, "step")}
/>
}
</div>
}
</Grid>
<Grid item xs={1}>
Expand Down Expand Up @@ -208,6 +216,7 @@ const mapStateToProps = state => {
return {
parameters: state[module].parameters,
allParameterTypes: state[module].allParameterTypes,
algorithmName: state[module].algorithmName
}
}

Expand Down