"examples/vscode:/vscode.git/clone" did not exist on "eac96cd7a2741bf0fb343d2e857487b1832fc4ec"
Commit 3f0697ad authored by Lijiao's avatar Lijiao Committed by fishyds
Browse files

Add error message when experiment's status is error (#338)

* Add error message when experiment error

* delete unuseful code

* Fix bug of bgcolor when experiment status is running
parent 640e7bbf
...@@ -20,10 +20,11 @@ require('../static/style/accuracy.css'); ...@@ -20,10 +20,11 @@ require('../static/style/accuracy.css');
require('../static/style/table.scss'); require('../static/style/table.scss');
require('../static/style/overviewTitle.scss'); require('../static/style/overviewTitle.scss');
interface SessionState { interface OverviewState {
tableData: Array<TableObj>; tableData: Array<TableObj>;
searchSpace: object; searchSpace: object;
status: string; status: string;
errorStr: string;
trialProfile: Experiment; trialProfile: Experiment;
option: object; option: object;
noData: string; noData: string;
...@@ -34,7 +35,7 @@ interface SessionState { ...@@ -34,7 +35,7 @@ interface SessionState {
downBool: boolean; downBool: boolean;
} }
class Overview extends React.Component<{}, SessionState> { class Overview extends React.Component<{}, OverviewState> {
public _isMounted = false; public _isMounted = false;
public intervalID = 0; public intervalID = 0;
...@@ -45,6 +46,7 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -45,6 +46,7 @@ class Overview extends React.Component<{}, SessionState> {
this.state = { this.state = {
searchSpace: {}, searchSpace: {},
status: '', status: '',
errorStr: '',
trialProfile: { trialProfile: {
id: '', id: '',
author: '', author: '',
...@@ -126,8 +128,8 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -126,8 +128,8 @@ class Overview extends React.Component<{}, SessionState> {
switch (key) { switch (key) {
case 'loguniform': case 'loguniform':
case 'qloguniform': case 'qloguniform':
const a = Math.pow(10, value[0]); const a = Math.pow(Math.E, value[0]);
const b = Math.pow(10, value[1]); const b = Math.pow(Math.E, value[1]);
value = [a, b]; value = [a, b];
searchSpace[item]._value = value; searchSpace[item]._value = value;
break; break;
...@@ -150,17 +152,30 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -150,17 +152,30 @@ class Overview extends React.Component<{}, SessionState> {
} }
} }
}); });
this.checkStatus();
}
checkStatus = () => {
axios(`${MANAGER_IP}/check-status`, { axios(`${MANAGER_IP}/check-status`, {
method: 'GET' method: 'GET'
}) })
.then(res => { .then(res => {
if (res.status === 200 && this._isMounted) { if (res.status === 200 && this._isMounted) {
this.setState({ const errors = res.data.errors;
status: res.data.status if (errors.length !== 0) {
}); this.setState({
status: res.data.status,
errorStr: res.data.errors[0]
});
} else {
this.setState({
status: res.data.status,
});
}
} }
}); });
} }
showTrials = () => { showTrials = () => {
...@@ -396,6 +411,7 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -396,6 +411,7 @@ class Overview extends React.Component<{}, SessionState> {
accuracyData, accuracyData,
accNodata, accNodata,
status, status,
errorStr,
trialNumber, trialNumber,
bestAccuracy, bestAccuracy,
downBool downBool
...@@ -414,7 +430,7 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -414,7 +430,7 @@ class Overview extends React.Component<{}, SessionState> {
onClick={this.downExperimentContent} onClick={this.downExperimentContent}
disabled={downBool} disabled={downBool}
> >
<span>Download</span> <span>Download</span>
<img src={require('../static/img/icon/download.png')} alt="icon" /> <img src={require('../static/img/icon/download.png')} alt="icon" />
</Button> </Button>
</Col> </Col>
...@@ -430,6 +446,7 @@ class Overview extends React.Component<{}, SessionState> { ...@@ -430,6 +446,7 @@ class Overview extends React.Component<{}, SessionState> {
trialProfile={trialProfile} trialProfile={trialProfile}
bestAccuracy={bestAccuracy} bestAccuracy={bestAccuracy}
status={status} status={status}
errors={errorStr}
/> />
</Col> </Col>
{/* experiment parameters search space tuner assessor... */} {/* experiment parameters search space tuner assessor... */}
......
...@@ -2,17 +2,20 @@ import * as React from 'react'; ...@@ -2,17 +2,20 @@ import * as React from 'react';
import { import {
Row, Row,
Col, Col,
Popover
} from 'antd'; } from 'antd';
import { Experiment, TrialNumber } from '../../static/interface'; import { Experiment, TrialNumber } from '../../static/interface';
import { convertTime } from '../../static/function'; import { convertTime } from '../../static/function';
import ProgressBar from './ProgressItem'; import ProgressBar from './ProgressItem';
import '../../static/style/progress.scss'; import '../../static/style/progress.scss';
import '../../static/style/probar.scss';
interface ProgressProps { interface ProgressProps {
trialProfile: Experiment; trialProfile: Experiment;
trialNumber: TrialNumber; trialNumber: TrialNumber;
bestAccuracy: string; bestAccuracy: string;
status: string; status: string;
errors: string;
} }
class Progressed extends React.Component<ProgressProps, {}> { class Progressed extends React.Component<ProgressProps, {}> {
...@@ -24,7 +27,7 @@ class Progressed extends React.Component<ProgressProps, {}> { ...@@ -24,7 +27,7 @@ class Progressed extends React.Component<ProgressProps, {}> {
render() { render() {
const { trialProfile, const { trialProfile,
trialNumber, bestAccuracy, trialNumber, bestAccuracy,
status status, errors
} = this.props; } = this.props;
// remaining time // remaining time
const bar2 = trialNumber.totalCurrentTrial - trialNumber.waitTrial - trialNumber.unknowTrial; const bar2 = trialNumber.totalCurrentTrial - trialNumber.waitTrial - trialNumber.unknowTrial;
...@@ -32,23 +35,49 @@ class Progressed extends React.Component<ProgressProps, {}> { ...@@ -32,23 +35,49 @@ class Progressed extends React.Component<ProgressProps, {}> {
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); const remaining = convertTime(trialProfile.maxDuration - trialProfile.execDuration);
let errorContent;
if (errors !== '') {
errorContent = (
<div className="errors">
{errors}
</div>
);
}
return ( return (
<Row className="progress"> <Row className="progress" id="barBack">
<Row className="basic"> <Row className="basic">
<p>Status</p> <p>Status</p>
<div className="status">{status}</div> <div className="status">
<span className={status}>{status}</span>
{
status === 'ERROR'
?
<Popover
placement="rightTop"
content={errorContent}
title="Error"
trigger="hover"
>
<span className="errorBtn">i</span>
</Popover>
:
<span />
}
</div>
</Row> </Row>
<ProgressBar <ProgressBar
who="Duration" who="Duration"
percent={percent} percent={percent}
description={runDuration} description={runDuration}
bgclass={status}
maxString={`MaxDuration: ${convertTime(trialProfile.maxDuration)}`} maxString={`MaxDuration: ${convertTime(trialProfile.maxDuration)}`}
/> />
<ProgressBar <ProgressBar
who="TrialNum" who="TrialNum"
percent={bar2Percent} percent={bar2Percent}
description={bar2.toString()} description={bar2.toString()}
bgclass={status}
maxString={`MaxTrialNumber: ${trialProfile.MaxTrialNum}`} maxString={`MaxTrialNumber: ${trialProfile.MaxTrialNum}`}
/> />
<Row className="basic colorOfbasic mess"> <Row className="basic colorOfbasic mess">
......
...@@ -6,6 +6,7 @@ interface ProItemProps { ...@@ -6,6 +6,7 @@ interface ProItemProps {
percent: number; percent: number;
description: string; description: string;
maxString: string; maxString: string;
bgclass: string;
} }
class ProgressBar extends React.Component<ProItemProps, {}> { class ProgressBar extends React.Component<ProItemProps, {}> {
...@@ -16,11 +17,11 @@ class ProgressBar extends React.Component<ProItemProps, {}> { ...@@ -16,11 +17,11 @@ class ProgressBar extends React.Component<ProItemProps, {}> {
} }
render() { render() {
const { who, percent, description, maxString } = this.props; const { who, percent, description, maxString, bgclass } = this.props;
return ( return (
<div> <div>
<Row className="probar"> <Row className={`probar ${bgclass}`}>
<Col span={6}> <Col span={6}>
<div className="name">{who}</div> <div className="name">{who}</div>
</Col> </Col>
...@@ -34,8 +35,8 @@ class ProgressBar extends React.Component<ProItemProps, {}> { ...@@ -34,8 +35,8 @@ class ProgressBar extends React.Component<ProItemProps, {}> {
/> />
</div> </div>
<Row className="description"> <Row className="description">
<Col span={12}>0</Col> <Col span={9}>0</Col>
<Col className="right" span={12}>{maxString}</Col> <Col className="right" span={15}>{maxString}</Col>
</Row> </Row>
</Col> </Col>
</Row> </Row>
......
...@@ -2,7 +2,6 @@ Button.changeBtu, Button.changeBtu:hover, Button.changeBtu:focus{ ...@@ -2,7 +2,6 @@ Button.changeBtu, Button.changeBtu:hover, Button.changeBtu:focus{
background-color: #3c8dbc; background-color: #3c8dbc;
border-color: #3c8dbc; border-color: #3c8dbc;
line-height: 30px; line-height: 30px;
font-size: 16px;
} }
Button.tableButton{ Button.tableButton{
......
...@@ -60,15 +60,15 @@ ...@@ -60,15 +60,15 @@
border: 1px solid #fff; border: 1px solid #fff;
border-radius: 0; border-radius: 0;
margin-top: 4px; margin-top: 4px;
background-color: #0071BC;
span{ span{
font-family: 'Segoe'; font-family: 'Segoe';
font-size: 16px; font-size: 14px;
line-height: 30px;
} }
img{ img{
height: 16px; height: 14px;
margin-left: 10px; margin-left: 10px;
margin-top: -6px; margin-top: -6px;
} }
......
#barBack{
/* status: 'INITIALIZED' | 'EXPERIMENT_RUNNING' | 'ERROR' | 'STOPPING' | 'STOPPED' | 'DONE' */
.EXPERIMENT_RUNNING, .STOPPING, .INITIALIZED{
/* specific status color */
color: #0071bc;
.ant-progress-bg {
background-color: #0071bc;
}
.ant-progress-text{
color: #0071bc;
}
}
.DONE, .STOPPED{
color: #009245;
.ant-progress-bg {
background-color: #009245;
}
.ant-progress-text{
color: #009245;
}
}
.ERROR{
color: #eb0716;
.ant-progress-bg {
background-color: #eb0716;
}
.ant-progress-text{
color: #eb0716;
}
}
.ant-progress-bg{
border-radius: 0 !important;
}
.ant-progress-status-success .ant-progress-bg{
border-radius: 0 12px 12px 0 !important;
}
}
.errorBtn{
margin-left: 15px;
display: inline-block;
width: 18px;
height: 18px;
line-height: 18px;
text-align: center;
font-size: 14px;
border: 1px solid #4d4d4d;
border-radius: 50%;
background-color: #4d4d4d;
color: #fff;
}
.errorBtn:hover{
cursor: pointer;
}
.errors{
width: 240px;
font-size: 14px;
color: #212121;
}
...@@ -17,14 +17,6 @@ ...@@ -17,14 +17,6 @@
border: 2px solid #e6e6e6; border: 2px solid #e6e6e6;
border-radius: 0 12px 12px 0 !important; border-radius: 0 12px 12px 0 !important;
} }
.ant-progress-bg {
border-radius: 0 !important;
}
.ant-progress-status-success .ant-progress-bg{
border-radius: 0 12px 12px 0 !important;
color: #009245;
background-color: #009245;
}
.name{ .name{
height: 34px; height: 34px;
line-height: 30px; line-height: 30px;
...@@ -43,6 +35,7 @@ ...@@ -43,6 +35,7 @@
width: 100%; width: 100%;
line-height: 24px; line-height: 24px;
font-size: 12px; font-size: 12px;
color: #212121;
.right{ .right{
text-align: right; text-align: right;
} }
......
.hyper{
width: 98%;
margin: 30px auto;
}
.rungraph{
width: 100%;
}
pre.hyperpar{
text-align: left;
}
.tables{
width: 100%;
}
/* the position of the pagination */
.ant-table-pagination.ant-pagination{
margin: 16px 0;
float: right;
margin-right: 30px;
}
Button.tableButton{
background: #3c8dbc;
border-color: #3c8dbc;
height: 28px;
line-height: 28px;
/* padding: 3px 4px; */
}
.hyperpar ul, .hyperpar ul li{
background: none !important;
}
/* kill btn style: delete its own hover style */
/* after button click the color not change */
Button.tableButton:hover, Button.tableButton:focus{
background-color: #3c8dbc;
border-color: #3c8dbc;
}
.ant-modal-title{
font-size: 20px;
}
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