Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
7978c25a
"host/vscode:/vscode.git/clone" did not exist on "bd27ed6c38f3e4fd2d32bc84630fbeab2fe80d76"
Unverified
Commit
7978c25a
authored
Dec 13, 2021
by
Lijiaoa
Committed by
GitHub
Dec 13, 2021
Browse files
[webui] Improve trial parameter for retiarii experiment (#4314)
parent
971e5055
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
149 additions
and
22 deletions
+149
-22
ts/webui/src/components/public-child/OpenRow.tsx
ts/webui/src/components/public-child/OpenRow.tsx
+33
-6
ts/webui/src/components/public-child/PanelMonacoEditor.tsx
ts/webui/src/components/public-child/PanelMonacoEditor.tsx
+83
-0
ts/webui/src/components/trial-detail/DefaultMetricPoint.tsx
ts/webui/src/components/trial-detail/DefaultMetricPoint.tsx
+6
-1
ts/webui/src/components/trial-detail/Intermediate.tsx
ts/webui/src/components/trial-detail/Intermediate.tsx
+6
-1
ts/webui/src/static/const.ts
ts/webui/src/static/const.ts
+3
-1
ts/webui/src/static/function.ts
ts/webui/src/static/function.ts
+8
-2
ts/webui/src/static/interface.ts
ts/webui/src/static/interface.ts
+1
-6
ts/webui/src/static/model/trial.ts
ts/webui/src/static/model/trial.ts
+4
-5
ts/webui/src/static/style/openRow.scss
ts/webui/src/static/style/openRow.scss
+5
-0
No files found.
ts/webui/src/components/public-child/OpenRow.tsx
View file @
7978c25a
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
*
as
copy
from
'
copy-to-clipboard
'
;
import
*
as
copy
from
'
copy-to-clipboard
'
;
import
{
Stack
,
PrimaryButton
,
Pivot
,
PivotItem
}
from
'
@fluentui/react
'
;
import
{
Stack
,
PrimaryButton
,
Pivot
,
PivotItem
,
DefaultButton
}
from
'
@fluentui/react
'
;
import
{
Trial
}
from
'
../../static/model/trial
'
;
import
{
Trial
}
from
'
../../static/model/trial
'
;
import
{
MANAGER_IP
}
from
'
../../static/const
'
;
import
{
MANAGER_IP
,
RETIARIIPARAMETERS
}
from
'
../../static/const
'
;
import
{
EXPERIMENT
,
TRIALS
}
from
'
../../static/datamodel
'
;
import
{
EXPERIMENT
,
TRIALS
}
from
'
../../static/datamodel
'
;
import
{
reformatRetiariiParameter
}
from
'
../../static/function
'
;
import
JSONTree
from
'
react-json-tree
'
;
import
JSONTree
from
'
react-json-tree
'
;
import
PaiTrialLog
from
'
../public-child/PaiTrialLog
'
;
import
PaiTrialLog
from
'
../public-child/PaiTrialLog
'
;
import
TrialLog
from
'
../public-child/TrialLog
'
;
import
TrialLog
from
'
../public-child/TrialLog
'
;
import
MessageInfo
from
'
../modals/MessageInfo
'
;
import
MessageInfo
from
'
../modals/MessageInfo
'
;
import
PanelMonacoEditor
from
'
../public-child/PanelMonacoEditor
'
;
import
'
../../static/style/overview/overview.scss
'
;
import
'
../../static/style/overview/overview.scss
'
;
import
'
../../static/style/copyParameter.scss
'
;
import
'
../../static/style/copyParameter.scss
'
;
import
'
../../static/style/openRow.scss
'
;
import
'
../../static/style/openRow.scss
'
;
...
@@ -20,6 +22,7 @@ interface OpenRowState {
...
@@ -20,6 +22,7 @@ interface OpenRowState {
typeInfo
:
string
;
typeInfo
:
string
;
info
:
string
;
info
:
string
;
isHidenInfo
:
boolean
;
isHidenInfo
:
boolean
;
showRetiaParamPanel
:
boolean
;
}
}
class
OpenRow
extends
React
.
Component
<
OpenRowProps
,
OpenRowState
>
{
class
OpenRow
extends
React
.
Component
<
OpenRowProps
,
OpenRowState
>
{
...
@@ -28,7 +31,8 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -28,7 +31,8 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
this
.
state
=
{
this
.
state
=
{
typeInfo
:
''
,
typeInfo
:
''
,
info
:
''
,
info
:
''
,
isHidenInfo
:
true
isHidenInfo
:
true
,
showRetiaParamPanel
:
false
};
};
}
}
...
@@ -36,6 +40,14 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -36,6 +40,14 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
this
.
setState
(()
=>
({
isHidenInfo
:
true
}));
this
.
setState
(()
=>
({
isHidenInfo
:
true
}));
};
};
hideRetiaParam
=
():
void
=>
{
this
.
setState
(()
=>
({
showRetiaParamPanel
:
false
}));
};
isshowRetiaParamPanel
=
():
void
=>
{
this
.
setState
(()
=>
({
showRetiaParamPanel
:
true
}));
};
/**
/**
* info: message content
* info: message content
* typeInfo: message type: success | error...
* typeInfo: message type: success | error...
...
@@ -48,7 +60,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -48,7 +60,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
copyParams
=
(
trial
:
Trial
):
void
=>
{
copyParams
=
(
trial
:
Trial
):
void
=>
{
// get copy parameters
// get copy parameters
const
params
=
JSON
.
stringify
(
trial
.
description
.
parameters
,
null
,
4
);
const
params
=
JSON
.
stringify
(
reformatRetiariiParameter
(
trial
.
description
.
parameters
as
any
)
,
null
,
4
);
if
(
copy
.
default
(
params
))
{
if
(
copy
.
default
(
params
))
{
this
.
getCopyStatus
(
'
Success copy parameters to clipboard in form of python dict !
'
,
'
success
'
);
this
.
getCopyStatus
(
'
Success copy parameters to clipboard in form of python dict !
'
,
'
success
'
);
}
else
{
}
else
{
...
@@ -66,10 +78,12 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -66,10 +78,12 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
};
};
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
isHidenInfo
,
typeInfo
,
info
}
=
this
.
state
;
const
{
isHidenInfo
,
typeInfo
,
info
,
showRetiaParamPanel
}
=
this
.
state
;
const
trialId
=
this
.
props
.
trialId
;
const
trialId
=
this
.
props
.
trialId
;
const
trial
=
TRIALS
.
getTrial
(
trialId
);
const
trial
=
TRIALS
.
getTrial
(
trialId
);
const
logPathRow
=
trial
.
info
.
logPath
||
"
This trial's log path is not available.
"
;
const
logPathRow
=
trial
.
info
.
logPath
||
"
This trial's log path is not available.
"
;
const
originParameters
=
trial
.
description
.
parameters
;
const
hasVisualHyperParams
=
RETIARIIPARAMETERS
in
originParameters
;
return
(
return
(
<
Stack
className
=
'openRow'
>
<
Stack
className
=
'openRow'
>
<
Stack
className
=
'openRowContent'
>
<
Stack
className
=
'openRowContent'
>
...
@@ -82,7 +96,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -82,7 +96,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
hideRoot
=
{
true
}
hideRoot
=
{
true
}
shouldExpandNode
=
{
():
boolean
=>
true
}
// default expandNode
shouldExpandNode
=
{
():
boolean
=>
true
}
// default expandNode
getItemString
=
{
():
null
=>
null
}
// remove the {} items
getItemString
=
{
():
null
=>
null
}
// remove the {} items
data
=
{
trial
.
description
.
p
arameters
}
data
=
{
reformatRetiariiParameter
(
originP
arameters
as
any
)
}
/>
/>
</
Stack
>
</
Stack
>
<
Stack
horizontal
className
=
'copy'
>
<
Stack
horizontal
className
=
'copy'
>
...
@@ -91,8 +105,21 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
...
@@ -91,8 +105,21 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
text
=
'Copy as json'
text
=
'Copy as json'
styles
=
{
{
root
:
{
width
:
128
,
marginRight
:
10
}
}
}
styles
=
{
{
root
:
{
width
:
128
,
marginRight
:
10
}
}
}
/>
/>
{
hasVisualHyperParams
&&
(
<
DefaultButton
onClick
=
{
this
.
isshowRetiaParamPanel
}
text
=
'Original parameters'
/>
)
}
{
/* copy success | failed message info */
}
{
/* copy success | failed message info */
}
{
!
isHidenInfo
&&
<
MessageInfo
typeInfo
=
{
typeInfo
}
info
=
{
info
}
/>
}
{
!
isHidenInfo
&&
<
MessageInfo
typeInfo
=
{
typeInfo
}
info
=
{
info
}
/>
}
{
showRetiaParamPanel
&&
(
<
PanelMonacoEditor
hideConfigPanel
=
{
this
.
hideRetiaParam
}
panelName
=
'Retiarii parameters'
panelContent
=
{
JSON
.
stringify
(
originParameters
,
null
,
2
)
}
/>
)
}
</
Stack
>
</
Stack
>
</
Stack
>
</
Stack
>
)
:
(
)
:
(
...
...
ts/webui/src/components/public-child/PanelMonacoEditor.tsx
0 → 100644
View file @
7978c25a
import
*
as
React
from
'
react
'
;
import
{
Stack
,
Panel
,
PrimaryButton
}
from
'
@fluentui/react
'
;
import
MonacoEditor
from
'
react-monaco-editor
'
;
import
{
caclMonacoEditorHeight
}
from
'
../../static/function
'
;
import
'
../../static/style/logDrawer.scss
'
;
interface
LogDrawerProps
{
hideConfigPanel
:
()
=>
void
;
panelName
:
string
;
panelContent
:
string
;
}
interface
LogDrawerState
{
panelInnerHeight
:
number
;
}
/**
* search space
* config
* retiarii parameter
* panel
*/
class
PanelMonacoEditor
extends
React
.
Component
<
LogDrawerProps
,
LogDrawerState
>
{
constructor
(
props
:
LogDrawerProps
)
{
super
(
props
);
this
.
state
=
{
panelInnerHeight
:
window
.
innerHeight
};
}
// use arrow function for change window size met error: this.setState is not a function
setLogDrawerHeight
=
():
void
=>
{
this
.
setState
(()
=>
({
panelInnerHeight
:
window
.
innerHeight
,
innerWidth
:
window
.
innerWidth
}));
};
async
componentDidMount
():
Promise
<
void
>
{
window
.
addEventListener
(
'
resize
'
,
this
.
setLogDrawerHeight
);
}
componentWillUnmount
():
void
{
window
.
removeEventListener
(
'
resize
'
,
this
.
setLogDrawerHeight
);
}
render
():
React
.
ReactNode
{
const
{
hideConfigPanel
,
panelName
,
panelContent
}
=
this
.
props
;
const
{
panelInnerHeight
}
=
this
.
state
;
const
monacoEditorHeight
=
caclMonacoEditorHeight
(
panelInnerHeight
);
return
(
<
Stack
>
<
Panel
isOpen
=
{
true
}
hasCloseButton
=
{
false
}
isFooterAtBottom
=
{
true
}
isLightDismiss
=
{
true
}
onLightDismissClick
=
{
hideConfigPanel
}
>
<
div
className
=
'panel'
>
<
div
>
<
div
className
=
'panelName'
>
{
panelName
}
</
div
>
<
MonacoEditor
height
=
{
monacoEditorHeight
}
language
=
'json'
theme
=
'vs-light'
value
=
{
panelContent
}
options
=
{
{
minimap
:
{
enabled
:
false
},
readOnly
:
true
,
automaticLayout
:
true
,
wordWrap
:
'
on
'
}
}
/>
</
div
>
<
PrimaryButton
text
=
'Close'
className
=
'configClose'
onClick
=
{
hideConfigPanel
}
/>
</
div
>
</
Panel
>
</
Stack
>
);
}
}
export
default
PanelMonacoEditor
;
ts/webui/src/components/trial-detail/DefaultMetricPoint.tsx
View file @
7978c25a
...
@@ -4,6 +4,7 @@ import ReactEcharts from 'echarts-for-react';
...
@@ -4,6 +4,7 @@ import ReactEcharts from 'echarts-for-react';
import
{
EXPERIMENT
,
TRIALS
}
from
'
../../static/datamodel
'
;
import
{
EXPERIMENT
,
TRIALS
}
from
'
../../static/datamodel
'
;
import
{
Trial
}
from
'
../../static/model/trial
'
;
import
{
Trial
}
from
'
../../static/model/trial
'
;
import
{
TooltipForAccuracy
,
EventMap
}
from
'
../../static/interface
'
;
import
{
TooltipForAccuracy
,
EventMap
}
from
'
../../static/interface
'
;
import
{
reformatRetiariiParameter
}
from
'
../../static/function
'
;
import
'
echarts/lib/chart/scatter
'
;
import
'
echarts/lib/chart/scatter
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/title
'
;
import
'
echarts/lib/component/title
'
;
...
@@ -82,7 +83,11 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -82,7 +83,11 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
<div>Trial No.:
${
data
.
data
[
0
]}
</div>
<div>Trial No.:
${
data
.
data
[
0
]}
</div>
<div>Trial ID:
${
data
.
data
[
2
]}
</div>
<div>Trial ID:
${
data
.
data
[
2
]}
</div>
<div>Default metric:
${
data
.
data
[
1
]}
</div>
<div>Default metric:
${
data
.
data
[
1
]}
</div>
<div>Parameters: <pre>
${
JSON
.
stringify
(
data
.
data
[
3
],
null
,
4
)}
</pre></div>
<div>Parameters: <pre>
${
JSON
.
stringify
(
reformatRetiariiParameter
(
data
.
data
[
3
]),
null
,
4
)}
</pre></div>
</div>
</div>
`
`
},
},
...
...
ts/webui/src/components/trial-detail/Intermediate.tsx
View file @
7978c25a
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
{
Stack
,
PrimaryButton
,
Toggle
,
IStackTokens
}
from
'
@fluentui/react
'
;
import
{
Stack
,
PrimaryButton
,
Toggle
,
IStackTokens
}
from
'
@fluentui/react
'
;
import
{
TooltipForIntermediate
,
TableObj
,
Intermedia
,
EventMap
}
from
'
../../static/interface
'
;
import
{
TooltipForIntermediate
,
TableObj
,
Intermedia
,
EventMap
}
from
'
../../static/interface
'
;
import
{
reformatRetiariiParameter
}
from
'
../../static/function
'
;
import
ReactEcharts
from
'
echarts-for-react
'
;
import
ReactEcharts
from
'
echarts-for-react
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/title
'
;
import
'
echarts/lib/component/title
'
;
...
@@ -100,7 +101,11 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
...
@@ -100,7 +101,11 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
<div>Trial No.:
${
trialNum
}
</div>
<div>Trial No.:
${
trialNum
}
</div>
<div>Trial ID:
${
trialId
}
</div>
<div>Trial ID:
${
trialId
}
</div>
<div>Intermediate:
${
data
.
data
}
</div>
<div>Intermediate:
${
data
.
data
}
</div>
<div>Parameters: <pre>
${
JSON
.
stringify
(
parameters
,
null
,
4
)}
</pre>
<div>Parameters: <pre>
${
JSON
.
stringify
(
reformatRetiariiParameter
(
parameters
),
null
,
4
)}
</pre>
</div>
</div>
</div>
</div>
`
;
`
;
...
...
ts/webui/src/static/const.ts
View file @
7978c25a
...
@@ -64,6 +64,7 @@ const SUPPORTED_SEARCH_SPACE_TYPE = [
...
@@ -64,6 +64,7 @@ const SUPPORTED_SEARCH_SPACE_TYPE = [
const
TOOLTIP_BACKGROUND_COLOR
=
'
#484848
'
;
const
TOOLTIP_BACKGROUND_COLOR
=
'
#484848
'
;
const
MAX_TRIAL_NUMBERS
=
'
Max trial No.
'
;
const
MAX_TRIAL_NUMBERS
=
'
Max trial No.
'
;
const
RETIARIIPARAMETERS
=
'
mutation_summary
'
;
export
{
export
{
MANAGER_IP
,
MANAGER_IP
,
...
@@ -81,5 +82,6 @@ export {
...
@@ -81,5 +82,6 @@ export {
CONCURRENCYTOOLTIP
,
CONCURRENCYTOOLTIP
,
SUPPORTED_SEARCH_SPACE_TYPE
,
SUPPORTED_SEARCH_SPACE_TYPE
,
TOOLTIP_BACKGROUND_COLOR
,
TOOLTIP_BACKGROUND_COLOR
,
MAX_TRIAL_NUMBERS
MAX_TRIAL_NUMBERS
,
RETIARIIPARAMETERS
};
};
ts/webui/src/static/function.ts
View file @
7978c25a
import
*
as
JSON5
from
'
json5
'
;
import
*
as
JSON5
from
'
json5
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
IContextualMenuProps
}
from
'
@fluentui/react
'
;
import
{
IContextualMenuProps
}
from
'
@fluentui/react
'
;
import
{
MANAGER_IP
}
from
'
./const
'
;
import
{
MANAGER_IP
,
RETIARIIPARAMETERS
}
from
'
./const
'
;
import
{
EXPERIMENT
}
from
'
./datamodel
'
;
import
{
EXPERIMENT
}
from
'
./datamodel
'
;
import
{
MetricDataRecord
,
FinalType
,
TableObj
,
Tensorboard
}
from
'
./interface
'
;
import
{
MetricDataRecord
,
FinalType
,
TableObj
,
Tensorboard
}
from
'
./interface
'
;
...
@@ -375,6 +375,11 @@ const parametersType = (): Map<string, string> => {
...
@@ -375,6 +375,11 @@ const parametersType = (): Map<string, string> => {
return
parametersTypeMap
;
return
parametersTypeMap
;
};
};
// retiarii experiment parameters is in field `mutation_summary`
const
reformatRetiariiParameter
=
(
parameters
:
any
):
{}
=>
{
return
RETIARIIPARAMETERS
in
parameters
?
parameters
[
RETIARIIPARAMETERS
]
:
parameters
;
};
export
{
export
{
getPrefix
,
getPrefix
,
convertTime
,
convertTime
,
...
@@ -401,5 +406,6 @@ export {
...
@@ -401,5 +406,6 @@ export {
copyAndSort
,
copyAndSort
,
disableTensorboard
,
disableTensorboard
,
getTensorboardMenu
,
getTensorboardMenu
,
parametersType
parametersType
,
reformatRetiariiParameter
};
};
ts/webui/src/static/interface.ts
View file @
7978c25a
...
@@ -228,10 +228,6 @@ interface SearchItems {
...
@@ -228,10 +228,6 @@ interface SearchItems {
isChoice
:
boolean
;
// for parameters: type = choice and status also as choice type
isChoice
:
boolean
;
// for parameters: type = choice and status also as choice type
}
}
interface
RetiariiParameter
{
mutation_summary
:
object
;
// retiarii experiment's parameter
}
export
{
export
{
TableObj
,
TableObj
,
TableRecord
,
TableRecord
,
...
@@ -257,6 +253,5 @@ export {
...
@@ -257,6 +253,5 @@ export {
SortInfo
,
SortInfo
,
AllExperimentList
,
AllExperimentList
,
Tensorboard
,
Tensorboard
,
SearchItems
,
SearchItems
RetiariiParameter
};
};
ts/webui/src/static/model/trial.ts
View file @
7978c25a
...
@@ -7,8 +7,7 @@ import {
...
@@ -7,8 +7,7 @@ import {
Parameters
,
Parameters
,
FinalType
,
FinalType
,
MultipleAxes
,
MultipleAxes
,
SingleAxis
,
SingleAxis
RetiariiParameter
}
from
'
../interface
'
;
}
from
'
../interface
'
;
import
{
import
{
getFinal
,
getFinal
,
...
@@ -17,7 +16,8 @@ import {
...
@@ -17,7 +16,8 @@ import {
parseMetrics
,
parseMetrics
,
isArrayType
,
isArrayType
,
isNaNorInfinity
,
isNaNorInfinity
,
formatComplexTypeValue
formatComplexTypeValue
,
reformatRetiariiParameter
}
from
'
../function
'
;
}
from
'
../function
'
;
/**
/**
...
@@ -32,8 +32,7 @@ function inferTrialParameters(
...
@@ -32,8 +32,7 @@ function inferTrialParameters(
space
:
MultipleAxes
,
space
:
MultipleAxes
,
prefix
:
string
=
''
prefix
:
string
=
''
):
[
Map
<
SingleAxis
,
any
>
,
Map
<
string
,
any
>
]
{
):
[
Map
<
SingleAxis
,
any
>
,
Map
<
string
,
any
>
]
{
const
latestedParamObj
=
const
latestedParamObj
:
object
=
reformatRetiariiParameter
(
paramObj
);
'
mutation_summary
'
in
paramObj
?
(
paramObj
as
RetiariiParameter
).
mutation_summary
:
paramObj
;
const
parameters
=
new
Map
<
SingleAxis
,
any
>
();
const
parameters
=
new
Map
<
SingleAxis
,
any
>
();
const
unexpectedEntries
=
new
Map
<
string
,
any
>
();
const
unexpectedEntries
=
new
Map
<
string
,
any
>
();
for
(
const
[
k
,
v
]
of
Object
.
entries
(
latestedParamObj
))
{
for
(
const
[
k
,
v
]
of
Object
.
entries
(
latestedParamObj
))
{
...
...
ts/webui/src/static/style/openRow.scss
View file @
7978c25a
...
@@ -54,6 +54,11 @@ $bgColor: #f2f2f2;
...
@@ -54,6 +54,11 @@ $bgColor: #f2f2f2;
outline
:
none
;
outline
:
none
;
}
}
}
}
.ms-MessageBar
{
width
:
70%
;
margin-left
:
15px
;
}
}
}
#visualizationText
{
#visualizationText
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment