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
214a8e18
Unverified
Commit
214a8e18
authored
Aug 07, 2020
by
Lijiaoa
Committed by
GitHub
Aug 07, 2020
Browse files
delete multiphase in webui (#2760)
parent
109d9a32
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
89 deletions
+8
-89
src/webui/src/components/Modals/Killjob.tsx
src/webui/src/components/Modals/Killjob.tsx
+1
-1
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+3
-7
src/webui/src/static/interface.ts
src/webui/src/static/interface.ts
+0
-6
src/webui/src/static/model/trial.ts
src/webui/src/static/model/trial.ts
+0
-2
src/webui/src/static/model/trialmanager.ts
src/webui/src/static/model/trialmanager.ts
+4
-73
No files found.
src/webui/src/components/Modals/Killjob.tsx
View file @
214a8e18
...
...
@@ -77,7 +77,7 @@ class KillJob extends React.Component<KillJobProps, KillJobState> {
onKill
=
():
void
=>
{
this
.
setState
({
isCalloutVisible
:
false
},
()
=>
{
const
{
trial
}
=
this
.
props
;
killJob
(
trial
.
key
,
trial
.
jobI
d
,
trial
.
status
);
killJob
(
trial
.
key
,
trial
.
i
d
,
trial
.
status
);
});
}
...
...
src/webui/src/components/trial-detail/TableList.tsx
View file @
214a8e18
...
...
@@ -269,7 +269,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
showIntermediateModal
=
async
(
record
:
TrialJobInfo
,
event
:
React
.
SyntheticEvent
<
EventTarget
>
):
Promise
<
void
>
=>
{
event
.
preventDefault
();
event
.
stopPropagation
();
const
res
=
await
axios
.
get
(
`
${
MANAGER_IP
}
/metric-data/
${
record
.
jobI
d
}
`
);
const
res
=
await
axios
.
get
(
`
${
MANAGER_IP
}
/metric-data/
${
record
.
i
d
}
`
);
if
(
res
.
status
===
200
)
{
const
intermediateArr
:
number
[]
=
[];
// support intermediate result is dict because the last intermediate result is
...
...
@@ -277,14 +277,10 @@ class TableList extends React.Component<TableListProps, TableListState> {
// get intermediate result dict keys array
const
{
intermediateKey
}
=
this
.
state
;
const
otherkeys
:
string
[]
=
[];
// One trial job may contains multiple parameter id
// only show current trial's metric data
const
metricDatas
=
res
.
data
.
filter
(
item
=>
{
return
item
.
parameterId
==
record
.
parameterId
;
});
const
metricDatas
=
res
.
data
;
if
(
metricDatas
.
length
!==
0
)
{
// just add type=number keys
const
intermediateMetrics
=
parseMetrics
(
res
.
d
ata
[
0
].
data
);
const
intermediateMetrics
=
parseMetrics
(
metricD
ata
s
[
0
].
data
);
for
(
const
key
in
intermediateMetrics
)
{
if
(
typeof
intermediateMetrics
[
key
]
===
'
number
'
)
{
otherkeys
.
push
(
key
);
...
...
src/webui/src/static/interface.ts
View file @
214a8e18
...
...
@@ -43,8 +43,6 @@ interface TableRecord {
startTime
:
number
;
endTime
?:
number
;
id
:
string
;
jobId
:
string
;
parameterId
:
string
;
duration
:
number
;
status
:
string
;
intermediateCount
:
number
;
...
...
@@ -126,8 +124,6 @@ interface Intermedia {
interface
MetricDataRecord
{
timestamp
:
number
;
trialJobId
:
string
;
trialId
:
string
;
parameterId
:
string
;
type
:
string
;
sequence
:
number
;
data
:
string
;
...
...
@@ -135,8 +131,6 @@ interface MetricDataRecord {
interface
TrialJobInfo
{
id
:
string
;
jobId
:
string
;
parameterId
:
string
;
sequenceId
:
number
;
status
:
string
;
startTime
?:
number
;
...
...
src/webui/src/static/model/trial.ts
View file @
214a8e18
...
...
@@ -115,8 +115,6 @@ class Trial implements TableObj {
key
:
this
.
info
.
id
,
sequenceId
:
this
.
info
.
sequenceId
,
id
:
this
.
info
.
id
,
jobId
:
this
.
info
.
jobId
,
parameterId
:
this
.
info
.
parameterId
,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
startTime
:
this
.
info
.
startTime
!
,
endTime
:
this
.
info
.
endTime
,
...
...
src/webui/src/static/model/trialmanager.ts
View file @
214a8e18
...
...
@@ -7,29 +7,13 @@ import { requestAxios } from '../function';
function
groupMetricsByTrial
(
metrics
:
MetricDataRecord
[]):
Map
<
string
,
MetricDataRecord
[]
>
{
const
ret
=
new
Map
<
string
,
MetricDataRecord
[]
>
();
for
(
const
metric
of
metrics
)
{
const
trialId
=
`
${
metric
.
trialJobId
}
-
${
metric
.
parameterId
}
`
;
metric
.
trialId
=
trialId
;
if
(
ret
.
has
(
trialId
))
{
if
(
ret
.
has
(
metric
.
trialJobId
))
{
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ret
.
get
(
trialId
)
!
.
push
(
metric
);
ret
.
get
(
metric
.
trial
Job
Id
)
!
.
push
(
metric
);
}
else
{
ret
.
set
(
trialId
,
[
metric
]);
ret
.
set
(
metric
.
trial
Job
Id
,
[
metric
]);
}
}
// to compatiable with multi-trial in same job, fix offset of sequence
ret
.
forEach
((
trialMetrics
)
=>
{
let
minSequenceNumber
=
Number
.
POSITIVE_INFINITY
;
trialMetrics
.
map
((
item
)
=>
{
if
(
item
.
sequence
<
minSequenceNumber
&&
item
.
type
!==
"
FINAL
"
)
{
minSequenceNumber
=
item
.
sequence
;
}
});
trialMetrics
.
map
((
item
)
=>
{
if
(
item
.
type
!==
"
FINAL
"
)
{
item
.
sequence
-=
minSequenceNumber
;
}
});
});
return
ret
;
}
...
...
@@ -145,57 +129,6 @@ class TrialManager {
return
new
MetricSpace
([...
this
.
trials
.
values
()]);
}
public
static
expandJobsToTrials
(
jobs
:
TrialJobInfo
[]):
TrialJobInfo
[]
{
const
trials
:
TrialJobInfo
[]
=
[];
for
(
const
jobInfo
of
jobs
as
TrialJobInfo
[])
{
if
(
jobInfo
.
hyperParameters
)
{
let
trial
:
TrialJobInfo
|
undefined
;
let
lastTrial
:
TrialJobInfo
|
undefined
;
for
(
let
i
=
0
;
i
<
jobInfo
.
hyperParameters
.
length
;
i
++
)
{
const
hyperParameters
=
jobInfo
.
hyperParameters
[
i
]
const
hpObject
=
JSON
.
parse
(
hyperParameters
);
const
parameterId
=
hpObject
[
"
parameter_id
"
];
trial
=
{
id
:
`
${
jobInfo
.
id
}
-
${
parameterId
}
`
,
jobId
:
jobInfo
.
id
,
parameterId
:
parameterId
,
sequenceId
:
parameterId
,
status
:
"
SUCCEEDED
"
,
startTime
:
jobInfo
.
startTime
,
endTime
:
jobInfo
.
startTime
,
hyperParameters
:
[
hyperParameters
],
logPath
:
jobInfo
.
logPath
,
stderrPath
:
jobInfo
.
stderrPath
,
};
if
(
jobInfo
.
finalMetricData
)
{
for
(
const
metricData
of
jobInfo
.
finalMetricData
)
{
if
(
metricData
.
parameterId
==
parameterId
)
{
trial
.
finalMetricData
=
[
metricData
];
trial
.
endTime
=
metricData
.
timestamp
;
break
;
}
}
}
if
(
lastTrial
)
{
trial
.
startTime
=
lastTrial
.
endTime
;
}
else
{
trial
.
startTime
=
jobInfo
.
startTime
;
}
lastTrial
=
trial
;
trials
.
push
(
trial
);
}
if
(
lastTrial
!==
undefined
)
{
lastTrial
.
status
=
jobInfo
.
status
;
lastTrial
.
endTime
=
jobInfo
.
endTime
;
}
}
else
{
trials
.
push
(
jobInfo
);
}
}
return
trials
;
}
// if this.jobListError = true, show trial error message [/trial-jobs]
public
jobListError
():
boolean
{
return
this
.
isJobListError
;
...
...
@@ -239,9 +172,7 @@ class TrialManager {
let
updated
=
false
;
requestAxios
(
`
${
MANAGER_IP
}
/trial-jobs`
)
.
then
(
data
=>
{
const
newTrials
=
TrialManager
.
expandJobsToTrials
(
data
as
any
);
this
.
trialJobList
=
newTrials
;
for
(
const
trialInfo
of
newTrials
as
TrialJobInfo
[])
{
for
(
const
trialInfo
of
data
as
TrialJobInfo
[])
{
if
(
this
.
trials
.
has
(
trialInfo
.
id
))
{
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
updated
=
this
.
trials
.
get
(
trialInfo
.
id
)
!
.
updateTrialJobInfo
(
trialInfo
)
||
updated
;
...
...
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