Commit 8d63b108 authored by Lijiao's avatar Lijiao Committed by fishyds
Browse files

Show intermediate result (#384)

parent 7035f3e7
...@@ -8,7 +8,9 @@ class SlideBar extends React.Component<{}, {}> { ...@@ -8,7 +8,9 @@ class SlideBar extends React.Component<{}, {}> {
return ( return (
<ul className="nav"> <ul className="nav">
<li className="logo"> <li className="logo">
<Link to={'/oview'}>
<img src={require('../static/img/logo.png')} style={{ width: 156 }} alt="NNI logo" /> <img src={require('../static/img/logo.png')} style={{ width: 156 }} alt="NNI logo" />
</Link>
</li> </li>
<li className="tab"> <li className="tab">
<Link to={'/oview'} activeClassName="high"> <Link to={'/oview'} activeClassName="high">
......
...@@ -3,7 +3,7 @@ import axios from 'axios'; ...@@ -3,7 +3,7 @@ import axios from 'axios';
import { MANAGER_IP } from '../static/const'; import { MANAGER_IP } from '../static/const';
import { Row, Col, Button, Tabs, Input } from 'antd'; import { Row, Col, Button, Tabs, Input } from 'antd';
const Search = Input.Search; const Search = Input.Search;
import { TableObj, Parameters, DetailAccurPoint, TooltipForAccuracy, } from '../static/interface'; import { TableObj, Parameters, DetailAccurPoint, TooltipForAccuracy } from '../static/interface';
import Accuracy from './overview/Accuracy'; import Accuracy from './overview/Accuracy';
import Duration from './trial-detail/Duration'; import Duration from './trial-detail/Duration';
import Title1 from './overview/Title1'; import Title1 from './overview/Title1';
...@@ -16,6 +16,7 @@ interface TrialDetailState { ...@@ -16,6 +16,7 @@ interface TrialDetailState {
accSource: object; accSource: object;
accNodata: string; accNodata: string;
tableListSource: Array<TableObj>; tableListSource: Array<TableObj>;
tableBaseSource: Array<TableObj>;
} }
class TrialsDetail extends React.Component<{}, TrialDetailState> { class TrialsDetail extends React.Component<{}, TrialDetailState> {
...@@ -30,7 +31,8 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -30,7 +31,8 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
this.state = { this.state = {
accSource: {}, accSource: {},
accNodata: '', accNodata: '',
tableListSource: [] tableListSource: [],
tableBaseSource: []
}; };
} }
// trial accuracy graph // trial accuracy graph
...@@ -129,17 +131,21 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -129,17 +131,21 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
drawTableList = () => { drawTableList = () => {
axios(`${MANAGER_IP}/trial-jobs`, { axios
method: 'GET' .all([
}) axios.get(`${MANAGER_IP}/trial-jobs`),
.then(res => { axios.get(`${MANAGER_IP}/metric-data`)
if (res.status === 200) { ])
.then(axios.spread((res, res1) => {
if (res.status === 200 && res1.status === 200) {
const trialJobs = res.data; const trialJobs = res.data;
const metricSource = res1.data;
const trialTable: Array<TableObj> = []; const trialTable: Array<TableObj> = [];
Object.keys(trialJobs).map(item => { Object.keys(trialJobs).map(item => {
// only succeeded trials have finalMetricData // only succeeded trials have finalMetricData
let desc: Parameters = { let desc: Parameters = {
parameters: {} parameters: {},
intermediate: []
}; };
let acc; let acc;
let tableAcc = 0; let tableAcc = 0;
...@@ -171,6 +177,14 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -171,6 +177,14 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
desc.isLink = true; desc.isLink = true;
} }
} }
let mediate: Array<string> = [];
Object.keys(metricSource).map(key => {
const items = metricSource[key];
if (items.trialJobId === id) {
mediate.push(items.data);
}
});
desc.intermediate = mediate;
if (trialJobs[item].finalMetricData !== undefined) { if (trialJobs[item].finalMetricData !== undefined) {
acc = JSON.parse(trialJobs[item].finalMetricData.data); acc = JSON.parse(trialJobs[item].finalMetricData.data);
if (typeof (acc) === 'object') { if (typeof (acc) === 'object') {
...@@ -193,11 +207,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -193,11 +207,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
}); });
if (this._isMounted) { if (this._isMounted) {
this.setState(() => ({ this.setState(() => ({
tableListSource: trialTable tableListSource: trialTable,
tableBaseSource: trialTable
})); }));
} }
} }
}); }));
} }
callback = (key: string) => { callback = (key: string) => {
...@@ -228,10 +243,10 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -228,10 +243,10 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
searchTrialNo = (value: string) => { searchTrialNo = (value: string) => {
window.clearInterval(this.interTableList); window.clearInterval(this.interTableList);
const { tableListSource } = this.state; const { tableBaseSource } = this.state;
const searchResultList: Array<TableObj> = []; const searchResultList: Array<TableObj> = [];
Object.keys(tableListSource).map(key => { Object.keys(tableBaseSource).map(key => {
const item = tableListSource[key]; const item = tableBaseSource[key];
if (item.sequenceId.toString() === value) { if (item.sequenceId.toString() === value) {
searchResultList.push(item); searchResultList.push(item);
} }
......
...@@ -29,12 +29,16 @@ class Progressed extends React.Component<ProgressProps, {}> { ...@@ -29,12 +29,16 @@ class Progressed extends React.Component<ProgressProps, {}> {
trialNumber, bestAccuracy, trialNumber, bestAccuracy,
status, errors status, errors
} = this.props; } = this.props;
// remaining time
const bar2 = trialNumber.totalCurrentTrial - trialNumber.waitTrial - trialNumber.unknowTrial; const bar2 = trialNumber.totalCurrentTrial - trialNumber.waitTrial - trialNumber.unknowTrial;
const bar2Percent = (bar2 / trialProfile.MaxTrialNum) * 100; const bar2Percent = (bar2 / trialProfile.MaxTrialNum) * 100;
const percent = (trialProfile.execDuration / trialProfile.maxDuration) * 100; const percent = (trialProfile.execDuration / trialProfile.maxDuration) * 100;
const runDuration = convertTime(trialProfile.execDuration); const runDuration = convertTime(trialProfile.execDuration);
const remaining = convertTime(trialProfile.maxDuration - trialProfile.execDuration); let remaining;
if (status === 'DONE') {
remaining = '0';
} else {
remaining = convertTime(trialProfile.maxDuration - trialProfile.execDuration);
}
let errorContent; let errorContent;
if (errors !== '') { if (errors !== '') {
errorContent = ( errorContent = (
...@@ -81,7 +85,7 @@ class Progressed extends React.Component<ProgressProps, {}> { ...@@ -81,7 +85,7 @@ class Progressed extends React.Component<ProgressProps, {}> {
maxString={`MaxTrialNumber: ${trialProfile.MaxTrialNum}`} maxString={`MaxTrialNumber: ${trialProfile.MaxTrialNum}`}
/> />
<Row className="basic colorOfbasic mess"> <Row className="basic colorOfbasic mess">
<p>Best Accuracy</p> <p>Best Default Metric</p>
<div>{bestAccuracy}</div> <div>{bestAccuracy}</div>
</Row> </Row>
<Row className="mess"> <Row className="mess">
...@@ -99,7 +103,7 @@ class Progressed extends React.Component<ProgressProps, {}> { ...@@ -99,7 +103,7 @@ class Progressed extends React.Component<ProgressProps, {}> {
</Col> </Col>
<Col span={7}> <Col span={7}>
<Row className="basic colorOfbasic"> <Row className="basic colorOfbasic">
<p>Duration</p> <p>MaxDuration</p>
<div>{convertTime(trialProfile.maxDuration)}</div> <div>{convertTime(trialProfile.maxDuration)}</div>
</Row> </Row>
</Col> </Col>
......
...@@ -44,14 +44,6 @@ class Duration extends React.Component<{}, DurationState> { ...@@ -44,14 +44,6 @@ class Duration extends React.Component<{}, DurationState> {
type: 'shadow' type: 'shadow'
} }
}, },
// title: {
// left: 'center',
// text: 'Trial Duration',
// textStyle: {
// fontSize: 18,
// color: '#333'
// }
// },
grid: { grid: {
bottom: '3%', bottom: '3%',
containLabel: true, containLabel: true,
...@@ -108,7 +100,7 @@ class Duration extends React.Component<{}, DurationState> { ...@@ -108,7 +100,7 @@ class Duration extends React.Component<{}, DurationState> {
} else { } else {
duration = (new Date().getTime() - start) / 1000; duration = (new Date().getTime() - start) / 1000;
} }
trialId.push(trialJobs[item].id); trialId.push(trialJobs[item].sequenceId);
trialTime.push(duration); trialTime.push(duration);
} }
}); });
......
...@@ -3,7 +3,7 @@ import axios from 'axios'; ...@@ -3,7 +3,7 @@ import axios from 'axios';
import { MANAGER_IP } from '../../static/const'; import { MANAGER_IP } from '../../static/const';
import ReactEcharts from 'echarts-for-react'; import ReactEcharts from 'echarts-for-react';
import { Row, Col, Select, Button, message } from 'antd'; import { Row, Col, Select, Button, message } from 'antd';
import { HoverName, ParaObj, VisualMapValue, Dimobj } from '../../static/interface'; import { ParaObj, VisualMapValue, Dimobj } from '../../static/interface';
const Option = Select.Option; const Option = Select.Option;
require('echarts/lib/chart/parallel'); require('echarts/lib/chart/parallel');
require('echarts/lib/component/tooltip'); require('echarts/lib/component/tooltip');
...@@ -243,30 +243,19 @@ class Para extends React.Component<{}, ParaState> { ...@@ -243,30 +243,19 @@ class Para extends React.Component<{}, ParaState> {
}; };
} else { } else {
visualMapObj = { visualMapObj = {
bottom: '20px',
type: 'continuous', type: 'continuous',
precision: 3, precision: 3,
min: visualValue.minAccuracy, min: visualValue.minAccuracy,
max: visualValue.maxAccuracy, max: visualValue.maxAccuracy,
color: ['#CA0000', '#FFC400', '#90EE90'] color: ['#CA0000', '#FFC400', '#90EE90'],
calculable: true
}; };
} }
let optionown = { let optionown = {
parallelAxis, parallelAxis,
tooltip: { tooltip: {
trigger: 'item', trigger: 'item'
formatter: function (params: HoverName) {
return params.name;
}
},
toolbox: {
show: true,
left: 'right',
iconStyle: {
normal: {
borderColor: '#ddd'
}
},
z: 202
}, },
parallel: { parallel: {
parallelAxisDefault: { parallelAxisDefault: {
...@@ -276,9 +265,6 @@ class Para extends React.Component<{}, ParaState> { ...@@ -276,9 +265,6 @@ class Para extends React.Component<{}, ParaState> {
} }
}, },
visualMap: visualMapObj, visualMap: visualMapObj,
highlight: {
type: 'highlight'
},
series: { series: {
type: 'parallel', type: 'parallel',
smooth: true, smooth: true,
......
...@@ -98,7 +98,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -98,7 +98,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
data: sequence data: sequence
}, },
yAxis: { yAxis: {
name: 'Accuracy', name: 'Default Metric',
type: 'value', type: 'value',
data: intermediateArr data: intermediateArr
}, },
...@@ -165,7 +165,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -165,7 +165,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
key: 'sequenceId', key: 'sequenceId',
width: 120, width: 120,
className: 'tableHead', className: 'tableHead',
sorter: (a: TableObj, b: TableObj) => (a.sequenceId as number) - (b.sequenceId as number), sorter: (a: TableObj, b: TableObj) => (a.sequenceId as number) - (b.sequenceId as number)
}, { }, {
title: 'Id', title: 'Id',
dataIndex: 'id', dataIndex: 'id',
...@@ -305,6 +305,11 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -305,6 +305,11 @@ class TableList extends React.Component<TableListProps, TableListState> {
const parametersRow = { const parametersRow = {
parameters: record.description.parameters parameters: record.description.parameters
}; };
const intermediate = record.description.intermediate;
let showIntermediate = '';
if (intermediate && intermediate.length > 0) {
showIntermediate = intermediate.join(', ');
}
let isLogLink: boolean = false; let isLogLink: boolean = false;
const logPathRow = record.description.logPath; const logPathRow = record.description.logPath;
if (record.description.isLink !== undefined) { if (record.description.isLink !== undefined) {
...@@ -340,6 +345,10 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -340,6 +345,10 @@ class TableList extends React.Component<TableListProps, TableListState> {
<span className="logContent">{logPathRow}</span> <span className="logContent">{logPathRow}</span>
</div> </div>
} }
<Row className="intermediate logpath">
<span className="logName">Intermediate Result:</span>
{showIntermediate}
</Row>
</pre> </pre>
); );
}; };
......
...@@ -15,6 +15,7 @@ interface Parameters { ...@@ -15,6 +15,7 @@ interface Parameters {
parameters: ErrorParameter; parameters: ErrorParameter;
logPath?: string; logPath?: string;
isLink?: boolean; isLink?: boolean;
intermediate?: Array<string>;
} }
interface Experiment { interface Experiment {
...@@ -76,10 +77,6 @@ interface Dimobj { ...@@ -76,10 +77,6 @@ interface Dimobj {
data?: string[]; data?: string[];
} }
interface HoverName {
name: string;
}
interface ParaObj { interface ParaObj {
data: number[][]; data: number[][];
parallelAxis: Array<Dimobj>; parallelAxis: Array<Dimobj>;
...@@ -90,8 +87,9 @@ interface VisualMapValue { ...@@ -90,8 +87,9 @@ interface VisualMapValue {
minAccuracy: number; minAccuracy: number;
} }
export {TableObj, Parameters, Experiment, export {
TableObj, Parameters, Experiment,
AccurPoint, TrialNumber, TrialJob, AccurPoint, TrialNumber, TrialJob,
DetailAccurPoint, TooltipForAccuracy, DetailAccurPoint, TooltipForAccuracy,
HoverName, ParaObj, VisualMapValue, Dimobj ParaObj, VisualMapValue, Dimobj
}; };
\ No newline at end of file
.logpath{ .logpath{
margin-left: 10px; margin-left: 10px;
font-size: 14px;
.logName{ .logName{
color: #268BD2; color: #268BD2;
margin-right: 5px;
} }
.logContent{ .logContent{
...@@ -18,3 +19,8 @@ ...@@ -18,3 +19,8 @@
color: blue; color: blue;
text-decoration: underline; text-decoration: underline;
} }
.intermediate{
white-space: normal;
font-size: 14px;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment