Skip to content

Commit

Permalink
Merge pull request #82 from Microsoft/master
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
SparkSnail authored Nov 30, 2018
2 parents 2d9ddad + 5426cfe commit 545ad8c
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 66 deletions.
2 changes: 1 addition & 1 deletion docs/howto_1_WriteTrial.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ with tf.Session() as sess:
>>
>>`@nni.report_intermediate_result`/`@nni.report_final_result` will send the data to assessor/tuner at that line.
>>
>>Please refer to [Annotation README](../tools/annotation/README.md) for more information about annotation syntax and its usage.
>>Please refer to [Annotation README](../tools/nni_annotation/README.md) for more information about annotation syntax and its usage.

>Step 2 - Enable NNI Annotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ class KubeflowTrainingService implements TrainingService {
return Promise.reject(errorMessage);
}

const result: cpp.childProcessPromise.Result = await cpp.exec(`kubectl delete
${this.kubeflowJobPlural} -l app=${this.NNI_KUBEFLOW_TRIAL_LABEL},expId=${getExperimentId()},trialId=${trialJobId}`);
const result: cpp.childProcessPromise.Result = await cpp.exec(`kubectl delete ${this.kubeflowJobPlural} -l `
+ `app=${this.NNI_KUBEFLOW_TRIAL_LABEL},expId=${getExperimentId()},trialId=${trialJobId}`);
if(result.stderr) {
const errorMessage: string = `kubectl delete ${this.kubeflowJobPlural} for trial ${trialJobId} failed: ${result.stderr}`;
this.log.error(errorMessage);
Expand Down Expand Up @@ -318,7 +318,7 @@ class KubeflowTrainingService implements TrainingService {
this.log.error(mountError);
throw new Error(mountError);
}
}else if(this.kubeflowClusterConfig.keyVault && this.kubeflowClusterConfig.azureStorage){
} else if(this.kubeflowClusterConfig.keyVault && this.kubeflowClusterConfig.azureStorage){
const vaultName = this.kubeflowClusterConfig.keyVault.vaultName;
const valutKeyName = this.kubeflowClusterConfig.keyVault.name;
this.azureStorageAccountName = this.kubeflowClusterConfig.azureStorage.accountName;
Expand All @@ -340,7 +340,7 @@ class KubeflowTrainingService implements TrainingService {
+ `--from-literal=azurestorageaccountname=${this.azureStorageAccountName} `
+ `--from-literal=azurestorageaccountkey=${storageAccountKey}`)

}catch(error){
} catch(error){
this.log.error(`command error: ${error}`);
throw new Error(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class PAIJobInfoCollector {
}
// Set pai trial job's url to WebHDFS output path
if(paiTrialJob.hdfsLogPath) {
paiTrialJob.url = paiTrialJob.hdfsLogPath;
paiTrialJob.url += `,${paiTrialJob.hdfsLogPath}`;
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/sdk/pynni/nni/msg_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ def handle_request_trial_jobs(self, data):
ids = [_create_parameter_id() for _ in range(data)]
params_list = self.tuner.generate_multiple_parameters(ids)

for i, _ in enumerate(params_list):
send(CommandType.NewTrialJob, _pack_parameter(ids[i], params_list[i]))
# when parameters is None.
if len(params_list) == 0:
if len(params_list) < len(ids):
send(CommandType.NoMoreTrialJobs, _pack_parameter(ids[0], ''))
else:
for i, _ in enumerate(ids):
send(CommandType.NewTrialJob, _pack_parameter(ids[i], params_list[i]))
return True

def handle_update_search_space(self, data):
Expand Down
2 changes: 2 additions & 0 deletions src/sdk/pynni/nni/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def generate_multiple_parameters(self, parameter_id_list):
"""Returns multiple sets of trial (hyper-)parameters, as iterable of serializable objects.
Call 'generate_parameters()' by 'count' times by default.
User code must override either this function or 'generate_parameters()'.
If there's no more trial, user should raise nni.NoMoreTrialError exception in generate_parameters().
If so, this function will only return sets of trial (hyper-)parameters that have already been collected.
parameter_id_list: list of int
"""
result = []
Expand Down
4 changes: 0 additions & 4 deletions src/webui/src/components/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ class Overview extends React.Component<{}, OverviewState> {
}
if (tableData[item].logPath !== undefined) {
desJobDetail.logPath = tableData[item].logPath;
const isSessionLink = /^http/gi.test(tableData[item].logPath);
if (isSessionLink) {
desJobDetail.isLink = true;
}
}
topTableData.push({
key: topTableData.length,
Expand Down
7 changes: 1 addition & 6 deletions src/webui/src/components/TrialsDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
Object.keys(trialJobs).map(item => {
// only succeeded trials have finalMetricData
let desc: Parameters = {
parameters: {},
intermediate: []
parameters: {}
};
let duration = 0;
const id = trialJobs[item].id !== undefined
Expand All @@ -155,10 +154,6 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
}
if (trialJobs[item].logPath !== undefined) {
desc.logPath = trialJobs[item].logPath;
const isHyperLink = /^http/gi.test(trialJobs[item].logPath);
if (isHyperLink) {
desc.isLink = true;
}
}
const acc = getFinalResult(trialJobs[item].finalMetricData);
trialTable.push({
Expand Down
48 changes: 48 additions & 0 deletions src/webui/src/components/logPath/LogPath.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as React from 'react';
import LogPathChild from './LogPathChild';

interface LogpathProps {
logStr: string;
}

class LogPath extends React.Component<LogpathProps, {}> {

constructor(props: LogpathProps) {
super(props);

}

render() {
const { logStr } = this.props;
const isTwopath = logStr.indexOf(',') !== -1
?
true
:
false;
return (
<div>
{
isTwopath
?
<div>
<LogPathChild
eachLogpath={logStr.split(',')[0]}
logName="LogPath:"
/>
<LogPathChild
eachLogpath={logStr.split(',')[1]}
logName="hdfsLogPath:"
/>
</div>
:
<LogPathChild
eachLogpath={logStr}
logName="LogPath:"
/>
}
</div>
);
}
}

export default LogPath;
39 changes: 39 additions & 0 deletions src/webui/src/components/logPath/LogPathChild.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from 'react';

interface LogpathChildProps {
eachLogpath: string;
logName: string;
}

class LogPathChild extends React.Component<LogpathChildProps, {}> {

constructor(props: LogpathChildProps) {
super(props);

}

render() {
const { eachLogpath, logName } = this.props;
const isLink = /^http/gi.test(eachLogpath);

return (
<div>
{
isLink
?
<div className="logpath">
<span className="logName">{logName}</span>
<a className="logContent logHref" href={eachLogpath} target="_blank">{eachLogpath}</a>
</div>
:
<div className="logpath">
<span className="logName">{logName}</span>
<span className="logContent">{eachLogpath}</span>
</div>
}
</div>
);
}
}

export default LogPathChild;
25 changes: 7 additions & 18 deletions src/webui/src/components/overview/SuccessTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Table } from 'antd';
import { TableObj } from '../../static/interface';
import { convertDuration } from '../../static/function';
import '../../static/style/tableStatus.css';
import LogPath from '../logPath/LogPath';

interface SuccessTableProps {
tableSource: Array<TableObj>;
Expand Down Expand Up @@ -106,11 +107,11 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
const openRowDataSource = {
parameters: record.description.parameters
};
let isLogLink: boolean = false;
const logPathRow = record.description.logPath;
if (record.description.isLink !== undefined) {
isLogLink = true;
}
const logPathRow = record.description.logPath !== undefined
?
record.description.logPath
:
'This trial\'s logPath are not available.';
return (
<pre id="description" className="hyperpar">
{
Expand All @@ -128,19 +129,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
<span className="error">'This trial's parameters are not available.'</span>
</div>
}
{
isLogLink
?
<div className="logpath">
<span className="logName">logPath: </span>
<a className="logContent logHref" href={logPathRow} target="_blank">{logPathRow}</a>
</div>
:
<div className="logpath">
<span className="logName">logPath: </span>
<span className="logContent">{logPathRow}</span>
</div>
}
<LogPath logStr={logPathRow}/>
</pre>
);
};
Expand Down
25 changes: 7 additions & 18 deletions src/webui/src/components/trial-detail/TableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Row, Table, Button, Popconfirm, Modal, message } from 'antd';
import { MANAGER_IP, trialJobStatus } from '../../static/const';
import { convertDuration } from '../../static/function';
import { TableObj, TrialJob } from '../../static/interface';
import LogPath from '../logPath/LogPath';
require('../../static/style/tableStatus.css');
require('../../static/style/logPath.scss');
require('../../static/style/search.scss');
Expand Down Expand Up @@ -305,11 +306,11 @@ class TableList extends React.Component<TableListProps, TableListState> {
const parametersRow = {
parameters: record.description.parameters
};
let isLogLink: boolean = false;
const logPathRow = record.description.logPath;
if (record.description.isLink !== undefined) {
isLogLink = true;
}
const logPathRow = record.description.logPath !== undefined
?
record.description.logPath
:
'This trial\'s logPath are not available.';
return (
<pre id="allList" className="hyperpar">
{
Expand All @@ -327,19 +328,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
<span className="error">'This trial's parameters are not available.'</span>
</div>
}
{
isLogLink
?
<div className="logpath">
<span className="logName">logPath: </span>
<a className="logContent logHref" href={logPathRow} target="_blank">{logPathRow}</a>
</div>
:
<div className="logpath">
<span className="logName">logPath: </span>
<span className="logContent">{logPathRow}</span>
</div>
}
<LogPath logStr={logPathRow}/>
</pre>
);
};
Expand Down
2 changes: 0 additions & 2 deletions src/webui/src/static/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ interface ErrorParameter {
interface Parameters {
parameters: ErrorParameter;
logPath?: string;
isLink?: boolean;
intermediate?: Array<string>;
}

interface Experiment {
Expand Down
11 changes: 4 additions & 7 deletions src/webui/src/static/style/tableStatus.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
.RUNNING{
color: #3c8dbc;
.RUNNING,.USER_CANCELED{
color: #0071BC;
}
.FAILED{
color: #dd4b39;
}
.USER_CANCELED{
color: #FF4500;
}
.SUCCEEDED{
color: #009245;
color: #00A445;
}
.UNKNOWN{
color: #FF8C00;
}
.SYS_CANCELED{
color: red;
color: #EB0716;
}
.WAITING{
color: #008B8B;
Expand Down
2 changes: 1 addition & 1 deletion tools/nni_annotation/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Introduction
# NNI Annotation Introduction

For good user experience and reduce user effort, we need to design a good annotation grammar.

Expand Down

0 comments on commit 545ad8c

Please sign in to comment.