"src/vscode:/vscode.git/clone" did not exist on "49d5af1002c37e19db071271b7560ae6c64fefd5"
Unverified Commit 1609e8a4 authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

[bug fix] Experiment list could not open experiment with prefix (#4511)

parent 6ec6ad58
...@@ -104,6 +104,7 @@ def start_experiment(action, exp_id, config, port, debug, run_mode, url_prefix): ...@@ -104,6 +104,7 @@ def start_experiment(action, exp_id, config, port, debug, run_mode, url_prefix):
pid=proc.pid, pid=proc.pid,
logDir=config.experiment_working_directory, logDir=config.experiment_working_directory,
tag=[], tag=[],
prefixUrl=url_prefix
) )
_logger.info('Setting up...') _logger.info('Setting up...')
......
...@@ -7,7 +7,7 @@ import MessageInfo from '../modals/MessageInfo'; ...@@ -7,7 +7,7 @@ import MessageInfo from '../modals/MessageInfo';
import { compareDate, filterByStatusOrPlatform, getSortedSource } from './expFunction'; import { compareDate, filterByStatusOrPlatform, getSortedSource } from './expFunction';
import { MAXSCREENCOLUMNWIDHT, MINSCREENCOLUMNWIDHT } from './experimentConst'; import { MAXSCREENCOLUMNWIDHT, MINSCREENCOLUMNWIDHT } from './experimentConst';
import { Hearder } from './Header'; import { Hearder } from './Header';
import NameColumn from './TrialIdColumn'; import TrialIdColumn from './TrialIdColumn';
import FilterBtns from './FilterBtns'; import FilterBtns from './FilterBtns';
import { TitleContext } from '../overview/TitleContext'; import { TitleContext } from '../overview/TitleContext';
import { Title } from '../overview/Title'; import { Title } from '../overview/Title';
...@@ -194,7 +194,7 @@ class Experiment extends React.Component<{}, ExpListState> { ...@@ -194,7 +194,7 @@ class Experiment extends React.Component<{}, ExpListState> {
className: 'tableHead leftTitle', className: 'tableHead leftTitle',
data: 'string', data: 'string',
onColumnClick: this.onColumnClick, onColumnClick: this.onColumnClick,
onRender: (item: any): React.ReactNode => <NameColumn port={item.port} status={item.status} id={item.id} /> onRender: (item: any): React.ReactNode => <TrialIdColumn item={item} />
}, },
{ {
name: 'Status', name: 'Status',
......
import * as React from 'react'; import * as React from 'react';
import { Stack } from '@fluentui/react'; import { Stack } from '@fluentui/react';
import { AllExperimentList } from '../../static/interface';
import CopyButton from '../public-child/CopyButton'; import CopyButton from '../public-child/CopyButton';
interface TrialIdColumnProps { interface TrialIdColumnProps {
port: number; item: AllExperimentList;
id: string;
status: string;
} }
class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> { class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> {
...@@ -14,14 +13,17 @@ class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> { ...@@ -14,14 +13,17 @@ class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> {
} }
render(): React.ReactNode { render(): React.ReactNode {
const { port, id, status } = this.props; const { item } = this.props;
const hostname = window.location.hostname; const hostname = window.location.hostname;
const protocol = window.location.protocol; const protocol = window.location.protocol;
const webuiPortal = `${protocol}//${hostname}:${port}/oview`; const webuiPortal =
item.prefixUrl === null
? `${protocol}//${hostname}:${item.port}/oview`
: `${protocol}//${hostname}:${item.port}/${this.formatPrefix(item.prefixUrl)}/oview`;
return ( return (
<Stack horizontal className='ellipsis idCopy'> <Stack horizontal className='ellipsis idCopy'>
{status === 'STOPPED' ? ( {item.status === 'STOPPED' ? (
<div className='idColor'>{id}</div> <div className='idColor'>{item.id}</div>
) : ( ) : (
<a <a
href={webuiPortal} href={webuiPortal}
...@@ -29,13 +31,25 @@ class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> { ...@@ -29,13 +31,25 @@ class TrialIdColumn extends React.Component<TrialIdColumnProps, {}> {
target='_blank' target='_blank'
rel='noopener noreferrer' rel='noopener noreferrer'
> >
{id} {item.id}
</a> </a>
)} )}
<CopyButton value={id} /> <CopyButton value={item.id} />
</Stack> </Stack>
); );
} }
private formatPrefix(prefix): string {
if (prefix.startsWith('/')) {
prefix = prefix.slice(1);
}
if (prefix.endsWith('/')) {
prefix = prefix.slice(0, prefix.length - 1);
}
return prefix;
}
} }
export default TrialIdColumn; export default TrialIdColumn;
...@@ -207,6 +207,7 @@ interface AllExperimentList { ...@@ -207,6 +207,7 @@ interface AllExperimentList {
pid: number; pid: number;
webuiUrl: string[]; webuiUrl: string[];
logDir: string[]; logDir: string[];
prefixUrl: string;
} }
interface Tensorboard { interface Tensorboard {
......
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