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
8c2f717d
Unverified
Commit
8c2f717d
authored
Apr 25, 2022
by
Lijiaoa
Committed by
GitHub
Apr 25, 2022
Browse files
Refactor kill job (#4772)
parent
f24c8380
Changes
34
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
76 additions
and
146 deletions
+76
-146
ts/webui/src/components/nav/slideNav/SlideNavBtns.tsx
ts/webui/src/components/nav/slideNav/SlideNavBtns.tsx
+1
-0
ts/webui/src/components/nav/slideNav/TrialConfigPanel.tsx
ts/webui/src/components/nav/slideNav/TrialConfigPanel.tsx
+7
-7
ts/webui/src/index.tsx
ts/webui/src/index.tsx
+1
-1
ts/webui/src/static/function.ts
ts/webui/src/static/function.ts
+54
-35
ts/webui/src/static/style/common/common.scss
ts/webui/src/static/style/common/common.scss
+10
-1
ts/webui/src/static/style/copyParameter.scss
ts/webui/src/static/style/copyParameter.scss
+0
-25
ts/webui/src/static/style/experiment/overview/basic.scss
ts/webui/src/static/style/experiment/overview/basic.scss
+0
-5
ts/webui/src/static/style/experiment/overview/overviewTitle.scss
...i/src/static/style/experiment/overview/overviewTitle.scss
+0
-1
ts/webui/src/static/style/experiment/trialdetail/compare.scss
...ebui/src/static/style/experiment/trialdetail/compare.scss
+0
-2
ts/webui/src/static/style/experiment/trialdetail/customized.scss
...i/src/static/style/experiment/trialdetail/customized.scss
+0
-58
ts/webui/src/static/style/experiment/trialdetail/trialsDetail.scss
...src/static/style/experiment/trialdetail/trialsDetail.scss
+1
-2
ts/webui/src/static/style/experimentManagement/experiment.scss
...bui/src/static/style/experimentManagement/experiment.scss
+1
-5
ts/webui/src/static/style/logPath.scss
ts/webui/src/static/style/logPath.scss
+0
-4
ts/webui/src/static/style/nav/nav.scss
ts/webui/src/static/style/nav/nav.scss
+1
-0
No files found.
ts/webui/src/components/nav/slideNav/SlideNavBtns.tsx
View file @
8c2f717d
...
@@ -10,6 +10,7 @@ import '@style/nav/slideNavBtns.scss';
...
@@ -10,6 +10,7 @@ import '@style/nav/slideNavBtns.scss';
* this file is the container of [config, search space, dispatcher/nnimanager log]
* this file is the container of [config, search space, dispatcher/nnimanager log]
* these three button is in the right of page
* these three button is in the right of page
*/
*/
export
const
SlideNavBtns
=
():
any
=>
{
export
const
SlideNavBtns
=
():
any
=>
{
const
[
isShowConfigPanel
,
setShowConfigPanle
]
=
useState
(
false
);
const
[
isShowConfigPanel
,
setShowConfigPanle
]
=
useState
(
false
);
const
[
isShowLogPanel
,
setShowLogPanel
]
=
useState
(
false
);
const
[
isShowLogPanel
,
setShowLogPanel
]
=
useState
(
false
);
...
...
ts/webui/src/components/nav/slideNav/TrialConfigPanel.tsx
View file @
8c2f717d
...
@@ -8,12 +8,12 @@ import { convertDuration, caclMonacoEditorHeight } from '@static/function';
...
@@ -8,12 +8,12 @@ import { convertDuration, caclMonacoEditorHeight } from '@static/function';
import
{
prettyStringify
}
from
'
@static/jsonutil
'
;
import
{
prettyStringify
}
from
'
@static/jsonutil
'
;
import
'
@static/style/logPanel.scss
'
;
import
'
@static/style/logPanel.scss
'
;
interface
Log
Drawer
Props
{
interface
Log
Panel
Props
{
hideConfigPanel
:
()
=>
void
;
hideConfigPanel
:
()
=>
void
;
panelName
:
string
;
panelName
:
string
;
}
}
interface
Log
Drawer
State
{
interface
Log
Panel
State
{
panelInnerHeight
:
number
;
panelInnerHeight
:
number
;
innerWidth
:
number
;
innerWidth
:
number
;
}
}
...
@@ -24,8 +24,8 @@ interface LogDrawerState {
...
@@ -24,8 +24,8 @@ interface LogDrawerState {
* model
* model
*/
*/
class
TrialConfigPanel
extends
React
.
Component
<
Log
Drawer
Props
,
Log
Drawer
State
>
{
class
TrialConfigPanel
extends
React
.
Component
<
Log
Panel
Props
,
Log
Panel
State
>
{
constructor
(
props
:
Log
Drawer
Props
)
{
constructor
(
props
:
Log
Panel
Props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
...
@@ -35,16 +35,16 @@ class TrialConfigPanel extends React.Component<LogDrawerProps, LogDrawerState> {
...
@@ -35,16 +35,16 @@ class TrialConfigPanel extends React.Component<LogDrawerProps, LogDrawerState> {
}
}
// use arrow function for change window size met error: this.setState is not a function
// use arrow function for change window size met error: this.setState is not a function
setLog
Drawer
Height
=
():
void
=>
{
setLog
Panel
Height
=
():
void
=>
{
this
.
setState
(()
=>
({
panelInnerHeight
:
window
.
innerHeight
,
innerWidth
:
window
.
innerWidth
}));
this
.
setState
(()
=>
({
panelInnerHeight
:
window
.
innerHeight
,
innerWidth
:
window
.
innerWidth
}));
};
};
async
componentDidMount
():
Promise
<
void
>
{
async
componentDidMount
():
Promise
<
void
>
{
window
.
addEventListener
(
'
resize
'
,
this
.
setLog
Drawer
Height
);
window
.
addEventListener
(
'
resize
'
,
this
.
setLog
Panel
Height
);
}
}
componentWillUnmount
():
void
{
componentWillUnmount
():
void
{
window
.
removeEventListener
(
'
resize
'
,
this
.
setLog
Drawer
Height
);
window
.
removeEventListener
(
'
resize
'
,
this
.
setLog
Panel
Height
);
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
...
...
ts/webui/src/index.tsx
View file @
8c2f717d
...
@@ -17,7 +17,7 @@ ReactDOM.render(
...
@@ -17,7 +17,7 @@ ReactDOM.render(
<
Suspense
<
Suspense
fallback
=
{
fallback
=
{
<
div
className
=
'loading'
>
<
div
className
=
'loading'
>
<
img
src
=
{
(
path
||
''
)
+
'
/loading.gif
'
}
/>
<
img
title
=
'loading-graph'
src
=
{
(
path
||
''
)
+
'
/loading.gif
'
}
/>
</
div
>
</
div
>
}
}
>
>
...
...
ts/webui/src/static/function.ts
View file @
8c2f717d
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
,
RETIARIIPARAMETERS
}
from
'
./const
'
;
import
{
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
'
;
...
@@ -71,7 +71,8 @@ const convertDuration = (seconds: number): string => {
...
@@ -71,7 +71,8 @@ const convertDuration = (seconds: number): string => {
}
}
seconds
-=
m
*
60
;
seconds
-=
m
*
60
;
if
(
seconds
>
0
)
{
// don't show `0s`
if
(
Math
.
floor
(
seconds
)
>
0
)
{
str
+=
`
${
Math
.
floor
(
seconds
)}
s`
;
str
+=
`
${
Math
.
floor
(
seconds
)}
s`
;
}
}
return
str
?
str
:
'
0s
'
;
return
str
?
str
:
'
0s
'
;
...
@@ -187,37 +188,6 @@ const intermediateGraphOption = (intermediateArr: number[], id: string): any =>
...
@@ -187,37 +188,6 @@ const intermediateGraphOption = (intermediateArr: number[], id: string): any =>
};
};
};
};
// kill job
const
killJob
=
(
key
:
number
,
id
:
string
,
status
:
string
,
updateList
?:
Function
):
void
=>
{
axios
(
`
${
MANAGER_IP
}
/trial-jobs/
${
id
}
`
,
{
method
:
'
DELETE
'
,
headers
:
{
'
Content-Type
'
:
'
application/json;charset=utf-8
'
}
})
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
// TODO: use Message.txt to tooltip
alert
(
'
Cancel the job successfully
'
);
// render the table
if
(
updateList
)
{
updateList
();
// FIXME
}
}
else
{
alert
(
'
fail to cancel the job
'
);
}
})
.
catch
(
error
=>
{
if
(
error
.
response
.
status
===
500
)
{
if
(
error
.
response
.
data
.
error
)
{
alert
(
error
.
response
.
data
.
error
);
}
else
{
alert
(
'
500 error, fail to cancel the job
'
);
}
}
});
};
const
filterByStatus
=
(
item
:
TableObj
):
boolean
=>
{
const
filterByStatus
=
(
item
:
TableObj
):
boolean
=>
{
return
item
.
status
===
'
SUCCEEDED
'
;
return
item
.
status
===
'
SUCCEEDED
'
;
};
};
...
@@ -380,6 +350,54 @@ const reformatRetiariiParameter = (parameters: any): {} => {
...
@@ -380,6 +350,54 @@ const reformatRetiariiParameter = (parameters: any): {} => {
return
RETIARIIPARAMETERS
in
parameters
?
parameters
[
RETIARIIPARAMETERS
]
:
parameters
;
return
RETIARIIPARAMETERS
in
parameters
?
parameters
[
RETIARIIPARAMETERS
]
:
parameters
;
};
};
function
_inferColumnTitle
(
columnKey
:
string
):
string
{
if
(
columnKey
===
'
sequenceId
'
)
{
return
'
Trial No.
'
;
}
else
if
(
columnKey
===
'
id
'
)
{
return
'
ID
'
;
}
else
if
(
columnKey
===
'
intermediateCount
'
)
{
return
'
Intermediate results (#)
'
;
}
else
if
(
columnKey
===
'
message
'
)
{
return
'
Message
'
;
}
else
if
(
columnKey
.
startsWith
(
'
space/
'
))
{
return
columnKey
.
split
(
'
/
'
,
2
)[
1
]
+
'
(space)
'
;
}
else
if
(
columnKey
===
'
latestAccuracy
'
)
{
return
'
Default metric
'
;
// to align with the original design
}
else
if
(
columnKey
.
startsWith
(
'
metric/
'
))
{
return
columnKey
.
split
(
'
/
'
,
2
)[
1
]
+
'
(metric)
'
;
}
else
if
(
columnKey
.
startsWith
(
'
_
'
))
{
return
columnKey
;
}
else
{
// camel case to verbose form
const
withSpace
=
columnKey
.
replace
(
/
[
A-Z
]
/g
,
letter
=>
`
${
letter
.
toLowerCase
()}
`
);
return
withSpace
.
charAt
(
0
).
toUpperCase
()
+
withSpace
.
slice
(
1
);
}
}
const
getIntermediateAllKeys
=
(
intermediateDialogTrial
:
any
):
string
[]
=>
{
let
intermediateAllKeysList
:
string
[]
=
[];
if
(
intermediateDialogTrial
!
.
intermediateMetrics
!==
undefined
&&
intermediateDialogTrial
!
.
intermediateMetrics
[
0
])
{
const
parsedMetric
=
parseMetrics
(
intermediateDialogTrial
!
.
intermediateMetrics
[
0
].
data
);
if
(
parsedMetric
!==
undefined
&&
typeof
parsedMetric
===
'
object
'
)
{
const
allIntermediateKeys
:
string
[]
=
[];
// just add type=number keys
for
(
const
key
in
parsedMetric
)
{
if
(
typeof
parsedMetric
[
key
]
===
'
number
'
)
{
allIntermediateKeys
.
push
(
key
);
}
}
intermediateAllKeysList
=
allIntermediateKeys
;
}
}
if
(
intermediateAllKeysList
.
includes
(
'
default
'
)
&&
intermediateAllKeysList
[
0
]
!==
'
default
'
)
{
intermediateAllKeysList
=
intermediateAllKeysList
.
filter
(
item
=>
item
!==
'
default
'
);
intermediateAllKeysList
.
unshift
(
'
default
'
);
}
return
intermediateAllKeysList
;
};
export
{
export
{
getPrefix
,
getPrefix
,
convertTime
,
convertTime
,
...
@@ -389,7 +407,6 @@ export {
...
@@ -389,7 +407,6 @@ export {
getFinal
,
getFinal
,
downFile
,
downFile
,
intermediateGraphOption
,
intermediateGraphOption
,
killJob
,
filterByStatus
,
filterByStatus
,
filterDuration
,
filterDuration
,
formatAccuracy
,
formatAccuracy
,
...
@@ -407,5 +424,7 @@ export {
...
@@ -407,5 +424,7 @@ export {
disableTensorboard
,
disableTensorboard
,
getTensorboardMenu
,
getTensorboardMenu
,
parametersType
,
parametersType
,
reformatRetiariiParameter
reformatRetiariiParameter
,
getIntermediateAllKeys
,
_inferColumnTitle
};
};
ts/webui/src/static/style/common/common.scss
View file @
8c2f717d
...
@@ -8,7 +8,6 @@ $themeBlue: #0071bc;
...
@@ -8,7 +8,6 @@ $themeBlue: #0071bc;
.link
{
.link
{
outline
:
none
;
outline
:
none
;
color
:
#333
!
important
;
text-decoration
:
none
;
text-decoration
:
none
;
&
:hover
{
&
:hover
{
...
@@ -77,3 +76,13 @@ $themeBlue: #0071bc;
...
@@ -77,3 +76,13 @@ $themeBlue: #0071bc;
.input-padding
{
.input-padding
{
padding-left
:
10px
;
padding-left
:
10px
;
}
}
.fontColor333
{
color
:
#333
;
}
.font
{
.color333
{
color
:
#333
;
}
}
ts/webui/src/static/style/copyParameter.scss
deleted
100644 → 0
View file @
f24c8380
$color
:
#f2f2f2
;
.formatStr
{
border
:
1px
solid
#8f8f8f
;
color
:
#333
;
padding
:
5px
10px
;
background-color
:
#fff
;
}
.format
{
.ant-modal-header
{
background-color
:
$color
;
border-bottom
:
none
;
}
.ant-modal-footer
{
background-color
:
$color
;
border-top
:
none
;
}
.ant-modal-body
{
background-color
:
$color
;
padding
:
10px
24px
!
important
;
}
}
ts/webui/src/static/style/experiment/overview/basic.scss
View file @
8c2f717d
...
@@ -15,11 +15,6 @@
...
@@ -15,11 +15,6 @@
top
:
-4px
;
top
:
-4px
;
}
}
/* error body font-color */
.color
{
color
:
#333
!
important
;
}
.inputBox
{
.inputBox
{
height
:
32px
;
height
:
32px
;
margin-top
:
5px
;
margin-top
:
5px
;
...
...
ts/webui/src/static/style/experiment/overview/overviewTitle.scss
View file @
8c2f717d
...
@@ -4,7 +4,6 @@ $iconPaddingVal: 10px;
...
@@ -4,7 +4,6 @@ $iconPaddingVal: 10px;
span
{
span
{
font-size
:
18px
;
font-size
:
18px
;
font-weight
:
600
;
font-weight
:
600
;
color
:
#333
;
}
}
i
{
i
{
...
...
ts/webui/src/static/style/experiment/trialdetail/compare.scss
View file @
8c2f717d
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
margin-bottom
:
20px
;
margin-bottom
:
20px
;
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
overflow
:
auto
hidden
;
overflow
:
auto
hidden
;
color
:
#333
;
tr
{
tr
{
line-height
:
30px
;
line-height
:
30px
;
...
@@ -52,7 +51,6 @@
...
@@ -52,7 +51,6 @@
position
:
relative
;
position
:
relative
;
.compare-yAxis
{
.compare-yAxis
{
color
:
#333
;
position
:
absolute
;
position
:
absolute
;
top
:
87%
;
top
:
87%
;
left
:
45%
;
left
:
45%
;
...
...
ts/webui/src/static/style/experiment/trialdetail/customized.scss
View file @
8c2f717d
/* resubmit confirm modal style */
/* resubmit confirm modal style */
.resubmit
{
.title
{
font-size
:
16px
;
color
:
#000
;
.color-warn
,
.color-error
{
color
:
red
;
}
i
{
margin-right
:
10px
;
}
}
.hint
{
padding
:
15px
0
;
color
:
#333
;
margin-left
:
30px
;
}
.color-succ
{
color
:
green
;
}
}
.hyper-box
{
.hyper-box
{
padding
:
16px
18px
16px
16px
;
padding
:
16px
18px
16px
16px
;
}
}
...
@@ -48,38 +22,6 @@
...
@@ -48,38 +22,6 @@
}
}
}
}
.tag-input
{
margin-top
:
25px
;
}
/* submit & cancel buttons style */
.modal-button
{
text-align
:
right
;
height
:
28px
;
/* cancel button style */
.cancelSty
{
width
:
80px
;
background-color
:
#dadada
;
border
:
none
;
color
:
#333
;
}
.cancelSty
:hover
,
.cancelSty
:active
,
.cancelSty
:focus
{
background-color
:
#dadada
;
}
.distance
{
margin-right
:
8px
;
}
}
.center
{
text-align
:
center
;
}
.icon-color
{
.icon-color
{
i
{
i
{
color
:
green
;
color
:
green
;
...
...
ts/webui/src/static/style/experiment/trialdetail/trialsDetail.scss
View file @
8c2f717d
...
@@ -81,6 +81,7 @@
...
@@ -81,6 +81,7 @@
}
}
.tooldetailAccuracy
{
.tooldetailAccuracy
{
-webkit-user-select
:
text
;
user-select
:
text
;
user-select
:
text
;
min-width
:
245px
;
min-width
:
245px
;
max-width
:
350px
;
max-width
:
350px
;
...
@@ -110,7 +111,6 @@
...
@@ -110,7 +111,6 @@
position
:
absolute
;
position
:
absolute
;
left
:
48%
;
left
:
48%
;
top
:
30%
;
top
:
30%
;
color
:
#333
;
}
}
}
}
...
@@ -127,7 +127,6 @@
...
@@ -127,7 +127,6 @@
position
:
relative
;
position
:
relative
;
.xAxis
{
.xAxis
{
color
:
#333
;
position
:
absolute
;
position
:
absolute
;
left
:
50%
;
left
:
50%
;
top
:
88%
;
top
:
88%
;
...
...
ts/webui/src/static/style/experimentManagement/experiment.scss
View file @
8c2f717d
...
@@ -70,11 +70,7 @@ $pageMargin: 24px;
...
@@ -70,11 +70,7 @@ $pageMargin: 24px;
}
}
.idColor
{
.idColor
{
color
:
#615f5d
!
important
;
color
:
#615f5d
;
}
.toAnotherExp
{
color
:
#0071bc
!
important
;
}
}
.ms-DetailsRow
:focus
{
.ms-DetailsRow
:focus
{
...
...
ts/webui/src/static/style/logPath.scss
View file @
8c2f717d
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
margin-right
:
5px
;
margin-right
:
5px
;
}
}
.logContent
{
color
:
#333
;
}
.error
{
.error
{
color
:
#cb4b16
;
color
:
#cb4b16
;
}
}
...
...
ts/webui/src/static/style/nav/nav.scss
View file @
8c2f717d
...
@@ -11,6 +11,7 @@ $barHeight: 56px;
...
@@ -11,6 +11,7 @@ $barHeight: 56px;
.ms-Button--commandBar
{
.ms-Button--commandBar
{
background-color
:
#0071bc
;
background-color
:
#0071bc
;
-webkit-user-select
:
none
;
user-select
:
none
;
user-select
:
none
;
&
:hover
,
&
:hover
,
...
...
Prev
1
2
Next
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