"vscode:/vscode.git/clone" did not exist on "784572590f019e304675fc4e6650077fcf9c9680"
Unverified Commit f0a2d396 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Merge pull request #150 from Microsoft/master

merge master
parents 080ae00d 0330333c
...@@ -8,8 +8,8 @@ const TabPane = Tabs.TabPane; ...@@ -8,8 +8,8 @@ const TabPane = Tabs.TabPane;
interface OpenRowProps { interface OpenRowProps {
trainingPlatform: string; trainingPlatform: string;
showLogModalOverview: Function;
record: TableObj; record: TableObj;
logCollection: boolean;
} }
class OpenRow extends React.Component<OpenRowProps, {}> { class OpenRow extends React.Component<OpenRowProps, {}> {
...@@ -20,7 +20,7 @@ class OpenRow extends React.Component<OpenRowProps, {}> { ...@@ -20,7 +20,7 @@ class OpenRow extends React.Component<OpenRowProps, {}> {
} }
render() { render() {
const { trainingPlatform, record, showLogModalOverview } = this.props; const { trainingPlatform, record, logCollection } = this.props;
let isHasParameters = true; let isHasParameters = true;
if (record.description.parameters.error) { if (record.description.parameters.error) {
...@@ -62,7 +62,7 @@ class OpenRow extends React.Component<OpenRowProps, {}> { ...@@ -62,7 +62,7 @@ class OpenRow extends React.Component<OpenRowProps, {}> {
<PaiTrialLog <PaiTrialLog
logStr={logPathRow} logStr={logPathRow}
id={record.id} id={record.id}
showLogModal={showLogModalOverview} logCollection={logCollection}
/> />
: :
<TrialLog logStr={logPathRow} id={record.id} /> <TrialLog logStr={logPathRow} id={record.id} />
......
...@@ -5,8 +5,7 @@ import { DOWNLOAD_IP } from '../../static/const'; ...@@ -5,8 +5,7 @@ import { DOWNLOAD_IP } from '../../static/const';
interface PaiTrialChildProps { interface PaiTrialChildProps {
logString: string; logString: string;
id: string; id: string;
showLogModal: Function; logCollect: boolean;
isdisLogbtn?: boolean;
} }
class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> { class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> {
...@@ -17,7 +16,7 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> { ...@@ -17,7 +16,7 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> {
} }
render() { render() {
const { logString, id } = this.props; const { logString, id, logCollect } = this.props;
return ( return (
<div> <div>
{ {
...@@ -26,7 +25,9 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> { ...@@ -26,7 +25,9 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> {
<div /> <div />
: :
<Row> <Row>
<Row> {
logCollect
?
<a <a
target="_blank" target="_blank"
href={`${DOWNLOAD_IP}/trial_${id}.log`} href={`${DOWNLOAD_IP}/trial_${id}.log`}
...@@ -34,7 +35,9 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> { ...@@ -34,7 +35,9 @@ class PaiTrialChild extends React.Component<PaiTrialChildProps, {}> {
> >
trial stdout trial stdout
</a> </a>
</Row> :
<span>trial stdout: {logString}</span>
}
</Row> </Row>
} }
</div> </div>
......
...@@ -2,13 +2,12 @@ import * as React from 'react'; ...@@ -2,13 +2,12 @@ import * as React from 'react';
import { Row } from 'antd'; import { Row } from 'antd';
import { DOWNLOAD_IP } from '../../static/const'; import { DOWNLOAD_IP } from '../../static/const';
import PaiTrialChild from './PaiTrialChild'; import PaiTrialChild from './PaiTrialChild';
import LogPathChild from './LogPathChild';
interface PaitrialLogProps { interface PaitrialLogProps {
logStr: string; logStr: string;
id: string; id: string;
showLogModal: Function; logCollection: boolean;
trialStatus?: string;
isdisLogbutton?: boolean;
} }
class PaitrialLog extends React.Component<PaitrialLogProps, {}> { class PaitrialLog extends React.Component<PaitrialLogProps, {}> {
...@@ -19,9 +18,7 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> { ...@@ -19,9 +18,7 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> {
} }
render() { render() {
const { logStr, id, showLogModal, const { logStr, id, logCollection } = this.props;
isdisLogbutton
} = this.props;
const isTwopath = logStr.indexOf(',') !== -1 const isTwopath = logStr.indexOf(',') !== -1
? ?
true true
...@@ -34,6 +31,9 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> { ...@@ -34,6 +31,9 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> {
isTwopath isTwopath
? ?
<Row> <Row>
{
logCollection
?
<Row> <Row>
<a <a
target="_blank" target="_blank"
...@@ -44,13 +44,24 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> { ...@@ -44,13 +44,24 @@ class PaitrialLog extends React.Component<PaitrialLogProps, {}> {
</a> </a>
<a target="_blank" href={logStr.split(',')[1]}>hdfsLog</a> <a target="_blank" href={logStr.split(',')[1]}>hdfsLog</a>
</Row> </Row>
:
<Row>
<LogPathChild
eachLogpath={logStr.split(',')[0]}
logName="trial stdout:"
/>
<LogPathChild
eachLogpath={logStr.split(',')[1]}
logName="hdfsLog:"
/>
</Row>
}
</Row> </Row>
: :
<PaiTrialChild <PaiTrialChild
logString={logStr} logString={logStr}
id={id} id={id}
showLogModal={showLogModal} logCollect={logCollection}
isdisLogbtn={isdisLogbutton}
/> />
} }
</div> </div>
......
...@@ -5,11 +5,12 @@ import { ...@@ -5,11 +5,12 @@ import {
Row, Table, Button, Popconfirm, Modal, Checkbox Row, Table, Button, Popconfirm, Modal, Checkbox
} from 'antd'; } from 'antd';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
import { MANAGER_IP, DOWNLOAD_IP, trialJobStatus, COLUMN, COLUMN_INDEX } from '../../static/const'; import { MANAGER_IP, trialJobStatus, COLUMN, COLUMN_INDEX } from '../../static/const';
import { convertDuration, intermediateGraphOption, killJob } from '../../static/function'; import { convertDuration, intermediateGraphOption, killJob } from '../../static/function';
import { TableObj, TrialJob } from '../../static/interface'; import { TableObj, TrialJob } from '../../static/interface';
import OpenRow from '../public-child/OpenRow'; import OpenRow from '../public-child/OpenRow';
import DefaultMetric from '../public-child/DefaultMetrc'; // import DefaultMetric from '../public-child/DefaultMetrc';
import IntermediateVal from '../public-child/IntermediateVal';
import '../../static/style/search.scss'; import '../../static/style/search.scss';
require('../../static/style/tableStatus.css'); require('../../static/style/tableStatus.css');
require('../../static/style/logPath.scss'); require('../../static/style/logPath.scss');
...@@ -30,6 +31,7 @@ interface TableListProps { ...@@ -30,6 +31,7 @@ interface TableListProps {
tableSource: Array<TableObj>; tableSource: Array<TableObj>;
updateList: Function; updateList: Function;
platform: string; platform: string;
logCollection: boolean;
} }
interface TableListState { interface TableListState {
...@@ -38,8 +40,6 @@ interface TableListState { ...@@ -38,8 +40,6 @@ interface TableListState {
isObjFinal: boolean; isObjFinal: boolean;
isShowColumn: boolean; isShowColumn: boolean;
columnSelected: Array<string>; // user select columnKeys columnSelected: Array<string>; // user select columnKeys
logModal: boolean;
logMessage: string;
} }
interface ColumnIndex { interface ColumnIndex {
...@@ -61,9 +61,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -61,9 +61,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
modalVisible: false, modalVisible: false,
isObjFinal: false, isObjFinal: false,
isShowColumn: false, isShowColumn: false,
logModal: false, columnSelected: COLUMN
columnSelected: COLUMN,
logMessage: ''
}; };
} }
...@@ -107,51 +105,6 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -107,51 +105,6 @@ class TableList extends React.Component<TableListProps, TableListState> {
} }
} }
updateTrialLogMessage = (id: string) => {
this._trialId = id;
axios(`${DOWNLOAD_IP}/trial_${this._trialId}.log`, {
method: 'GET'
})
.then(res => {
if (res.status === 200) {
if (this._isMounted) {
this.setState(() => ({
logMessage: res.data
}));
}
}
})
.catch(error => {
if (error.response.status === 500) {
if (this._isMounted) {
this.setState(() => ({
logMessage: 'failed to get log message'
}));
}
}
});
}
showLogModal = (id: string) => {
this.updateTrialLogMessage(id);
this.intervalTrialLog = window.setInterval(this.updateTrialLogMessage.bind(this, this._trialId), 10000);
if (this._isMounted) {
this.setState({
logModal: true
});
}
}
hideLogModal = () => {
window.clearInterval(this.intervalTrialLog);
if (this._isMounted) {
this.setState({
logModal: false,
logMessage: ''
});
}
}
hideShowColumnModal = () => { hideShowColumnModal = () => {
if (this._isMounted) { if (this._isMounted) {
this.setState({ this.setState({
...@@ -222,12 +175,12 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -222,12 +175,12 @@ class TableList extends React.Component<TableListProps, TableListState> {
} }
openRow = (record: TableObj) => { openRow = (record: TableObj) => {
const { platform } = this.props; const { platform, logCollection } = this.props;
return ( return (
<OpenRow <OpenRow
showLogModalOverview={this.showLogModal}
trainingPlatform={platform} trainingPlatform={platform}
record={record} record={record}
logCollection={logCollection}
/> />
); );
} }
...@@ -243,7 +196,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -243,7 +196,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
render() { render() {
const { entries, tableSource, updateList } = this.props; const { entries, tableSource, updateList } = this.props;
const { intermediateOption, modalVisible, isShowColumn, columnSelected} = this.state; const { intermediateOption, modalVisible, isShowColumn, columnSelected } = this.state;
let showTitle = COLUMN; let showTitle = COLUMN;
let bgColor = ''; let bgColor = '';
const trialJob: Array<TrialJob> = []; const trialJob: Array<TrialJob> = [];
...@@ -348,17 +301,19 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -348,17 +301,19 @@ class TableList extends React.Component<TableListProps, TableListState> {
title: 'Default Metric', title: 'Default Metric',
dataIndex: 'acc', dataIndex: 'acc',
key: 'acc', key: 'acc',
width: 200, width: 160,
sorter: (a: TableObj, b: TableObj) => { sorter: (a: TableObj, b: TableObj) => {
if (a.acc !== undefined && b.acc !== undefined) { const aa = a.description.intermediate;
return JSON.parse(a.acc.default) - JSON.parse(b.acc.default); const bb = b.description.intermediate;
if (aa !== undefined && bb !== undefined) {
return aa[aa.length - 1] - bb[bb.length - 1];
} else { } else {
return NaN; return NaN;
} }
}, },
render: (text: string, record: TableObj) => { render: (text: string, record: TableObj) => {
return ( return (
<DefaultMetric record={record}/> <IntermediateVal record={record} />
); );
} }
}); });
......
...@@ -46,6 +46,7 @@ interface Experiment { ...@@ -46,6 +46,7 @@ interface Experiment {
assessor?: object; assessor?: object;
advisor?: object; advisor?: object;
clusterMetaData?: object; clusterMetaData?: object;
logCollection?: string;
} }
// trial accuracy // trial accuracy
......
...@@ -98,8 +98,8 @@ def parse_args(): ...@@ -98,8 +98,8 @@ def parse_args():
parser_trial_ls.add_argument('id', nargs='?', help='the id of experiment') parser_trial_ls.add_argument('id', nargs='?', help='the id of experiment')
parser_trial_ls.set_defaults(func=trial_ls) parser_trial_ls.set_defaults(func=trial_ls)
parser_trial_kill = parser_trial_subparsers.add_parser('kill', help='kill trial jobs') parser_trial_kill = parser_trial_subparsers.add_parser('kill', help='kill trial jobs')
parser_trial_kill.add_argument('id', nargs='?', help='the id of experiment') parser_trial_kill.add_argument('id', nargs='?', help='id of the trial to be killed')
parser_trial_kill.add_argument('--trialid', '-t', required=True, dest='trialid', help='the id of trial to be killed') parser_trial_kill.add_argument('--experiment', '-E', required=True, dest='experiment', help='experiment id of the trial')
parser_trial_kill.set_defaults(func=trial_kill) parser_trial_kill.set_defaults(func=trial_kill)
#parse experiment command #parse experiment command
...@@ -149,8 +149,8 @@ def parse_args(): ...@@ -149,8 +149,8 @@ def parse_args():
parser_log_stderr.add_argument('--path', action='store_true', default=False, help='get the path of stderr file') parser_log_stderr.add_argument('--path', action='store_true', default=False, help='get the path of stderr file')
parser_log_stderr.set_defaults(func=log_stderr) parser_log_stderr.set_defaults(func=log_stderr)
parser_log_trial = parser_log_subparsers.add_parser('trial', help='get trial log path') parser_log_trial = parser_log_subparsers.add_parser('trial', help='get trial log path')
parser_log_trial.add_argument('id', nargs='?', help='the id of experiment') parser_log_trial.add_argument('id', nargs='?', help='id of the trial to be found the log path')
parser_log_trial.add_argument('--trialid', '-T', dest='trialid', help='find trial log path by id') parser_log_trial.add_argument('--experiment', '-E', dest='experiment', help='experiment id of the trial, xperiment ID of the trial, required when id is not empty.')
parser_log_trial.set_defaults(func=log_trial) parser_log_trial.set_defaults(func=log_trial)
#parse package command #parse package command
......
...@@ -76,9 +76,12 @@ def check_experiment_id(args): ...@@ -76,9 +76,12 @@ def check_experiment_id(args):
return None return None
else: else:
return running_experiment_list[0] return running_experiment_list[0]
if hasattr(args, "experiment"):
if experiment_dict.get(args.experiment):
return args.experiment
elif hasattr(args, "id"):
if experiment_dict.get(args.id): if experiment_dict.get(args.id):
return args.id return args.id
else:
print_error('Id not correct!') print_error('Id not correct!')
return None return None
...@@ -239,7 +242,7 @@ def trial_kill(args): ...@@ -239,7 +242,7 @@ def trial_kill(args):
return return
running, _ = check_rest_server_quick(rest_port) running, _ = check_rest_server_quick(rest_port)
if running: if running:
response = rest_delete(trial_job_id_url(rest_port, args.trialid), 20) response = rest_delete(trial_job_id_url(rest_port, args.id), 20)
if response and check_response(response): if response and check_response(response):
print(response.text) print(response.text)
else: else:
...@@ -327,6 +330,7 @@ def log_trial(args): ...@@ -327,6 +330,7 @@ def log_trial(args):
else: else:
print_error('Restful server is not running...') print_error('Restful server is not running...')
exit(1) exit(1)
if args.experiment:
if args.id: if args.id:
if trial_id_path_dict.get(args.id): if trial_id_path_dict.get(args.id):
print('id:' + args.id + ' path:' + trial_id_path_dict[args.id]) print('id:' + args.id + ' path:' + trial_id_path_dict[args.id])
...@@ -334,7 +338,11 @@ def log_trial(args): ...@@ -334,7 +338,11 @@ def log_trial(args):
print_error('trial id is not valid!') print_error('trial id is not valid!')
exit(1) exit(1)
else: else:
for key in trial_id_path_dict.keys(): print_error('please specific the trial id!')
print_error("trial id list in this experiment: " + str(list(trial_id_path_dict.keys())))
exit(1)
else:
for key in trial_id_path_dict:
print('id:' + key + ' path:' + trial_id_path_dict[key]) print('id:' + key + ' path:' + trial_id_path_dict[key])
def get_config(args): def get_config(args):
......
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