This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support more search space and maxDuration format #190
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,20 @@ class Sessionpro extends React.Component<{}, SessionState> { | |
}; | ||
} | ||
|
||
convertTime = (num: number) => { | ||
let hour = Math.floor(num / 3600 % 24); | ||
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'; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function can be simplified as following: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks very much. |
||
|
||
// show session | ||
showSessionPro = () => { | ||
axios(`${MANAGER_IP}/experiment`, { | ||
|
@@ -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]); | ||
|
@@ -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"> | ||
|
@@ -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 running</span> | ||
<span className="messcont">{running}s</span> | ||
<span>Still run</span> | ||
<span className="messcont">{runningStr}</span> | ||
</p> | ||
</div> | ||
<div className="logo"> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok