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

Support more search space and maxDuration format #190

Merged
merged 4 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions src/webui/src/components/Para.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ class Para extends React.Component<{}, ParaState> {
});
break;

case 'randint':
parallelAxis.push({
dim: i,
name: dimName[i],
max: searchKey._value[0],
min: 0
});
break;

case 'choice':
const data: Array<string> = [];
for (let j = 0; j < searchKey._value.length; j++) {
Expand All @@ -148,14 +157,12 @@ class Para extends React.Component<{}, ParaState> {
});
break;

case 'loguniform':
default:
parallelAxis.push({
dim: i,
name: dimName[i]
});
break;

default:
}
}
// get data for every lines. if dim is choice type
Expand Down
28 changes: 23 additions & 5 deletions src/webui/src/components/Sessionpro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ class Sessionpro extends React.Component<{}, SessionState> {
};
}

convertTime = (num: number) => {
let hour = Math.floor(num / 3600 % 24);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mod 24 here? it seems there is no day unit here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

let result: string = '';
if (num % 3600 === 0) {
return result = hour + 'h';
}
let min = Math.floor(num / 60 % 60);
if (hour < 1) {
return result = min + '';
} else {
return result = hour + 'h ' + min + 'min';
}
}
Copy link
Contributor

@chicm-ms chicm-ms Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can be simplified as following:
const hour = Math.floor(num / 3600);
const min = Math.floor(num / 60 % 60);
return hour > 0 ? `${hour} h ${min} min` : `${min} min`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much.


// show session
showSessionPro = () => {
axios(`${MANAGER_IP}/experiment`, {
Expand Down Expand Up @@ -124,7 +138,7 @@ class Sessionpro extends React.Component<{}, SessionState> {
const searchSpace = JSON.parse(sessionData.params.searchSpace);
Object.keys(searchSpace).map(item => {
const key = searchSpace[item]._type;
if (key === 'loguniform') {
if (key === 'loguniform' || key === 'qloguniform') {
let value = searchSpace[item]._value;
const a = Math.pow(10, value[0]);
const b = Math.pow(10, value[1]);
Expand Down Expand Up @@ -358,11 +372,15 @@ class Sessionpro extends React.Component<{}, SessionState> {
const {
trialProfile, searchSpace, tunerAssessor, tableData, status
} = this.state;

const maxRuntime = this.convertTime(trialProfile.maxDuration);
let running;
let runningStr = '';
if (trialProfile.endTime === 'not over') {
running = trialProfile.maxDuration - trialProfile.execDuration;
runningStr = this.convertTime(running);
} else {
running = 0;
runningStr = '0';
}
return (
<div className="session" id="session">
Expand All @@ -389,11 +407,11 @@ class Sessionpro extends React.Component<{}, SessionState> {
</div>
<p>
<span>Duration</span>
<span className="messcont">{trialProfile.maxDuration}s</span>
<span className="messcont">{maxRuntime}</span>
</p>
<p>
<span>Still&nbsp;running</span>
<span className="messcont">{running}s</span>
<span>Still&nbsp;run</span>
<span className="messcont">{runningStr}</span>
</p>
</div>
<div className="logo">
Expand Down