Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Fix bug of trial hyperparameters #222

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/webui/src/components/Para.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 29 additions & 8 deletions src/webui/src/components/Sessionpro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +23,7 @@ interface TableObj {
}

interface Parameters {
parameters: object;
parameters: ErrorPara;
logPath?: string;
isLink?: boolean;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
};
Expand All @@ -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
?
Expand Down
33 changes: 26 additions & 7 deletions src/webui/src/components/TrialStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ echarts.registerTheme('my_theme', {
color: '#3c8dbc'
});

interface ErrorPara {
error?: string;
}

interface DescObj {
parameters: Object;
parameters: ErrorPara;
logPath?: string;
isLink?: boolean;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
Expand All @@ -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
?
Expand Down
3 changes: 3 additions & 0 deletions src/webui/src/style/logPath.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
color: blue;
text-decoration: underline;
}
.error{
color: #CB4B16;
}