Commit b51c1562 authored by Lijiao's avatar Lijiao Committed by fishyds
Browse files

Fix bug of trial hypermeters (#222)

parent b88d3909
......@@ -99,7 +99,7 @@ class Para extends React.Component<{}, ParaState> {
speDimName.push(tem);
}
if (accParaData[item].status === 'SUCCEEDED') {
if (accParaData[item].finalMetricData !== undefined) {
if (accParaData[item].finalMetricData && accParaData[item].hyperParameters) {
// get acc array
accPara.push(parseFloat(accParaData[item].finalMetricData.data));
// get dim and every line specific number
......
......@@ -7,6 +7,10 @@ import JSONTree from 'react-json-tree';
require('../style/sessionpro.css');
require('../style/logPath.css');
interface ErrorPara {
error?: string;
}
interface TableObj {
key: number;
id: string;
......@@ -19,7 +23,7 @@ interface TableObj {
}
interface Parameters {
parameters: object;
parameters: ErrorPara;
logPath?: string;
isLink?: boolean;
}
......@@ -189,7 +193,11 @@ class Sessionpro extends React.Component<{}, SessionState> {
if (tableData[item].finalMetricData) {
acc = parseFloat(tableData[item].finalMetricData.data);
}
desJobDetail.parameters = JSON.parse(tableData[item].hyperParameters).parameters;
if (tableData[item].hyperParameters) {
desJobDetail.parameters = JSON.parse(tableData[item].hyperParameters).parameters;
} else {
desJobDetail.parameters = { error: 'This trial\'s parameters are not available.' };
}
if (tableData[item].logPath !== undefined) {
desJobDetail.logPath = tableData[item].logPath;
const isSessionLink = /^http/gi.test(tableData[item].logPath);
......@@ -344,6 +352,10 @@ class Sessionpro extends React.Component<{}, SessionState> {
}];
const openRow = (record: TableObj) => {
let isHasParameters = true;
if (record.description.parameters.error) {
isHasParameters = false;
}
const openRowDataSource = {
parameters: record.description.parameters
};
......@@ -354,12 +366,21 @@ class Sessionpro extends React.Component<{}, SessionState> {
}
return (
<pre id="description" className="jsontree">
<JSONTree
hideRoot={true}
shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items
data={openRowDataSource}
/>
{
isHasParameters
?
<JSONTree
hideRoot={true}
shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items
data={openRowDataSource}
/>
:
<div className="logpath">
<span className="logName">Error: </span>
<span className="error">'This trial's parameters are not available.'</span>
</div>
}
{
isLogLink
?
......
......@@ -17,8 +17,12 @@ echarts.registerTheme('my_theme', {
color: '#3c8dbc'
});
interface ErrorPara {
error?: string;
}
interface DescObj {
parameters: Object;
parameters: ErrorPara;
logPath?: string;
isLink?: boolean;
}
......@@ -237,6 +241,8 @@ class TrialStatus extends React.Component<{}, TabState> {
: '';
if (trialJobs[item].hyperParameters !== undefined) {
desc.parameters = JSON.parse(trialJobs[item].hyperParameters).parameters;
} else {
desc.parameters = { error: 'This trial\'s parameters are not available.' };
}
if (trialJobs[item].logPath !== undefined) {
desc.logPath = trialJobs[item].logPath;
......@@ -478,6 +484,10 @@ class TrialStatus extends React.Component<{}, TabState> {
];
const openRow = (record: TableObj) => {
let isHasParameters = true;
if (record.description.parameters.error) {
isHasParameters = false;
}
const parametersRow = {
parameters: record.description.parameters
};
......@@ -488,12 +498,21 @@ class TrialStatus extends React.Component<{}, TabState> {
}
return (
<pre className="hyperpar">
<JSONTree
hideRoot={true}
shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items
data={parametersRow}
/>
{
isHasParameters
?
< JSONTree
hideRoot={true}
shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items
data={parametersRow}
/>
:
<div className="logpath">
<span className="logName">Error: </span>
<span className="error">'This trial's parameters are not available.'</span>
</div>
}
{
isLogLink
?
......
......@@ -12,3 +12,6 @@
color: blue;
text-decoration: underline;
}
.error{
color: #CB4B16;
}
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