Skip to content

Commit de12d19

Browse files
committed
Add resume policy to UI
1 parent 4450611 commit de12d19

File tree

4 files changed

+106
-14
lines changed

4 files changed

+106
-14
lines changed

pkg/ui/v1beta1/frontend/src/components/HP/Create/Params/CommonSpec.jsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import Tooltip from '@material-ui/core/Tooltip';
77
import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
88
import Typography from '@material-ui/core/Typography';
99
import TextField from '@material-ui/core/TextField';
10+
import FormControl from '@material-ui/core/FormControl';
11+
import Select from '@material-ui/core/Select';
12+
import InputLabel from '@material-ui/core/InputLabel';
13+
import MenuItem from '@material-ui/core/MenuItem';
1014

1115
import { changeSpec } from '../../../../actions/hpCreateActions';
1216

@@ -27,6 +31,9 @@ const useStyles = makeStyles({
2731
padding: 2,
2832
marginBottom: 10,
2933
},
34+
selectBox: {
35+
width: 150,
36+
},
3037
});
3138

3239
const CommonParametersSpec = props => {
@@ -39,7 +46,39 @@ const CommonParametersSpec = props => {
3946
return (
4047
<div>
4148
{props.commonParametersSpec.map((param, i) => {
42-
return (
49+
return param.name === 'ResumePolicy' ? (
50+
<div key={i} className={classes.parameter}>
51+
<Grid container alignItems={'center'}>
52+
<Grid item xs={12} sm={3}>
53+
<Typography>
54+
<Tooltip title={param.description}>
55+
<HelpOutlineIcon className={classes.help} color={'primary'} />
56+
</Tooltip>
57+
{param.name}
58+
</Typography>
59+
</Grid>
60+
<Grid item xs={12} sm={8}>
61+
<FormControl variant="outlined" className={classes.formControl}>
62+
<InputLabel>Resume Policy</InputLabel>
63+
<Select
64+
value={param.value}
65+
onChange={onSpecChange(param.name)}
66+
className={classes.selectBox}
67+
label="Resume Policy"
68+
>
69+
{props.allResumePolicyTypes.map((type, i) => {
70+
return (
71+
<MenuItem value={type} key={i}>
72+
{type}
73+
</MenuItem>
74+
);
75+
})}
76+
</Select>
77+
</FormControl>
78+
</Grid>
79+
</Grid>
80+
</div>
81+
) : (
4382
<div key={i} className={classes.parameter}>
4483
<Grid container alignItems={'center'}>
4584
<Grid item xs={12} sm={3}>
@@ -68,6 +107,7 @@ const CommonParametersSpec = props => {
68107
const mapStateToProps = state => {
69108
return {
70109
commonParametersSpec: state[HP_CREATE_MODULE].commonParametersSpec,
110+
allResumePolicyTypes: state[HP_CREATE_MODULE].allResumePolicyTypes,
71111
};
72112
};
73113

pkg/ui/v1beta1/frontend/src/components/NAS/Create/Params/CommonSpec.jsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import Tooltip from '@material-ui/core/Tooltip';
77
import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
88
import Typography from '@material-ui/core/Typography';
99
import TextField from '@material-ui/core/TextField';
10+
import FormControl from '@material-ui/core/FormControl';
11+
import Select from '@material-ui/core/Select';
12+
import InputLabel from '@material-ui/core/InputLabel';
13+
import MenuItem from '@material-ui/core/MenuItem';
1014

1115
import { changeSpec } from '../../../../actions/nasCreateActions';
1216

@@ -27,6 +31,9 @@ const useStyles = makeStyles({
2731
padding: 2,
2832
marginBottom: 10,
2933
},
34+
selectBox: {
35+
width: 150,
36+
},
3037
});
3138

3239
const CommonParametersSpec = props => {
@@ -39,7 +46,39 @@ const CommonParametersSpec = props => {
3946
return (
4047
<div>
4148
{props.commonParametersSpec.map((param, i) => {
42-
return (
49+
return param.name === 'ResumePolicy' ? (
50+
<div key={i} className={classes.parameter}>
51+
<Grid container alignItems={'center'}>
52+
<Grid item xs={12} sm={3}>
53+
<Typography>
54+
<Tooltip title={param.description}>
55+
<HelpOutlineIcon className={classes.help} color={'primary'} />
56+
</Tooltip>
57+
{param.name}
58+
</Typography>
59+
</Grid>
60+
<Grid item xs={12} sm={8}>
61+
<FormControl variant="outlined" className={classes.formControl}>
62+
<InputLabel>Resume Policy</InputLabel>
63+
<Select
64+
value={param.value}
65+
onChange={onSpecChange(param.name)}
66+
className={classes.selectBox}
67+
label="Resume Policy"
68+
>
69+
{props.allResumePolicyTypes.map((type, i) => {
70+
return (
71+
<MenuItem value={type} key={i}>
72+
{type}
73+
</MenuItem>
74+
);
75+
})}
76+
</Select>
77+
</FormControl>
78+
</Grid>
79+
</Grid>
80+
</div>
81+
) : (
4382
<div key={i} className={classes.parameter}>
4483
<Grid container alignItems={'center'}>
4584
<Grid item xs={12} sm={3}>
@@ -68,6 +107,7 @@ const CommonParametersSpec = props => {
68107
const mapStateToProps = state => {
69108
return {
70109
commonParametersSpec: state[NAS_CREATE_MODULE].commonParametersSpec,
110+
allResumePolicyTypes: state[NAS_CREATE_MODULE].allResumePolicyTypes,
71111
};
72112
};
73113

pkg/ui/v1beta1/frontend/src/reducers/hpCreate.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,37 @@ const initialState = {
77
{
88
name: 'Name',
99
value: 'random-experiment',
10-
description: 'A name of an experiment',
10+
description: 'A name of an Experiment',
1111
},
1212
{
1313
name: 'Namespace',
1414
value: 'kubeflow',
15-
description: 'Namespace to deploy an experiment',
15+
description: 'Namespace to deploy an Experiment',
1616
},
1717
],
1818
commonParametersSpec: [
1919
{
2020
name: 'ParallelTrialCount',
2121
value: '3',
22-
description: 'How many trials can be processed in parallel',
22+
description: 'How many Trials can be processed in parallel',
2323
},
2424
{
2525
name: 'MaxTrialCount',
2626
value: '12',
27-
description: 'Max completed trials to mark experiment as succeeded',
27+
description: 'Max completed Trials to mark Experiment as succeeded',
2828
},
2929
{
3030
name: 'MaxFailedTrialCount',
3131
value: '3',
32-
description: 'Max failed trials to mark experiment as failed',
32+
description: 'Max failed trials to mark Experiment as failed',
33+
},
34+
{
35+
name: 'ResumePolicy',
36+
value: 'LongRunning',
37+
description: 'Resume policy describes how the Experiment should be restarted',
3338
},
3439
],
40+
allResumePolicyTypes: ['Never', 'LongRunning', 'FromVolume'],
3541
allObjectiveTypes: ['minimize', 'maximize'],
3642
objective: [
3743
{
@@ -56,7 +62,7 @@ const initialState = {
5662
},
5763
],
5864
algorithmName: 'random',
59-
allAlgorithms: ['grid', 'random', 'hyperband', 'bayesianoptimization', 'tpe'],
65+
allAlgorithms: ['grid', 'random', 'hyperband', 'bayesianoptimization', 'tpe', 'cmaes'],
6066
algorithmSettings: [],
6167
parameters: [
6268
{

pkg/ui/v1beta1/frontend/src/reducers/nasCreate.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,37 @@ const initialState = {
66
{
77
name: 'Name',
88
value: 'enas-example',
9-
description: 'A name of an experiment',
9+
description: 'A name of an Experiment',
1010
},
1111
{
1212
name: 'Namespace',
1313
value: 'kubeflow',
14-
description: 'Namespace to deploy an experiment',
14+
description: 'Namespace to deploy an Experiment',
1515
},
1616
],
1717
commonParametersSpec: [
1818
{
1919
name: 'ParallelTrialCount',
2020
value: '3',
21-
description: 'How many trials can be processed in parallel',
21+
description: 'How many Trials can be processed in parallel',
2222
},
2323
{
2424
name: 'MaxTrialCount',
2525
value: '12',
26-
description: 'Max completed trials to mark experiment as succeeded',
26+
description: 'Max completed Trials to mark Experiment as succeeded',
2727
},
2828
{
2929
name: 'MaxFailedTrialCount',
3030
value: '3',
31-
description: 'Max failed trials to mark experiment as failed',
31+
description: 'Max failed Trials to mark Experiment as failed',
32+
},
33+
{
34+
name: 'ResumePolicy',
35+
value: 'LongRunning',
36+
description: 'Resume policy describes how the Experiment should be restarted',
3237
},
3338
],
39+
allResumePolicyTypes: ['Never', 'LongRunning', 'FromVolume'],
3440
allObjectiveTypes: ['minimize', 'maximize'],
3541
objective: [
3642
{
@@ -51,7 +57,7 @@ const initialState = {
5157
],
5258
additionalMetricNames: [],
5359
algorithmName: 'enas',
54-
allAlgorithms: ['enas'],
60+
allAlgorithms: ['enas', 'darts'],
5561
algorithmSettings: [
5662
{
5763
name: 'controller_hidden_size',

0 commit comments

Comments
 (0)