"docs/source/Tutorial/ExperimentConfig.rst" did not exist on "06e5aa78784243297bbed434a364b1873d5c415a"
Unverified Commit f1105409 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Merge pull request #2959 from microsoft/v1.9

Merge v1.9 back to master
parents 0a6c234a 88a225f8
...@@ -29,25 +29,53 @@ const convertTime = (num: number): string => { ...@@ -29,25 +29,53 @@ const convertTime = (num: number): string => {
} }
}; };
const convertTimeToSecond = (str: string): number => {
let seconds = 0;
let d, h, m;
if (str.includes('d')) {
[d, str] = str.split('d');
seconds += parseInt(d) * 24 * 3600;
}
if (str.includes('h')) {
[h, str] = str.split('h');
seconds += parseInt(h) * 3600;
}
if (str.includes('m')) {
[m, str] = str.split('m');
seconds += parseInt(m) * 60;
}
if (str) {
seconds += parseInt(str.split('s')[0]);
}
return seconds;
};
// trial's duration, accurate to seconds for example 10min 30s // trial's duration, accurate to seconds for example 10min 30s
const convertDuration = (num: number): string => { const convertDuration = (seconds: number): string => {
if (num < 1) { let str = '';
return '0s';
const d = Math.floor(seconds / (24 * 3600));
if (d > 0) {
str += `${d}d `;
} }
const hour = Math.floor(num / 3600); seconds -= d * 24 * 3600;
const minute = Math.floor((num / 60) % 60);
const second = Math.floor(num % 60); const h = Math.floor(seconds / 3600);
const result: string[] = []; if (h > 0) {
if (hour > 0) { str += `${h}h `;
result.push(`${hour}h`);
} }
if (minute > 0) { seconds -= h * 3600;
result.push(`${minute}min`);
const m = Math.floor(seconds / 60);
if (m > 0) {
str += `${m}m `;
} }
if (second > 0) { seconds -= m * 60;
result.push(`${second}s`);
if (seconds > 0) {
str += `${Math.floor(seconds)}s`;
} }
return result.join(' '); return str ? str : '0s';
}; };
function parseMetrics(metricData: string): any { function parseMetrics(metricData: string): any {
...@@ -246,6 +274,7 @@ function formatComplexTypeValue(value: any): string | number { ...@@ -246,6 +274,7 @@ function formatComplexTypeValue(value: any): string | number {
export { export {
convertTime, convertTime,
convertDuration, convertDuration,
convertTimeToSecond,
getFinalResult, getFinalResult,
getFinal, getFinal,
downFile, downFile,
......
src/webui/src/static/img/logo.png

4.01 KB | W: | H:

src/webui/src/static/img/logo.png

2.32 KB | W: | H:

src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
  • 2-up
  • Swipe
  • Onion skin
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