"docs/git@developer.sourcefind.cn:modelzoo/stgcn.git" did not exist on "aa58d024619ca88cfc11f5501069354f19a8eb38"
Unverified Commit ade0b5b1 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Fix two bugs introduced in this sprint (#4877)

parent 21539654
......@@ -84,7 +84,8 @@ def create_experiment(args):
exp.url_prefix = url_prefix
if foreground:
exp.run(port, debug=debug)
exp.start(port, debug, RunMode.Foreground)
exp._wait_completion()
else:
exp.start(port, debug, RunMode.Detach)
......
......@@ -105,10 +105,10 @@ function randomSelect<T>(a: T[]): T {
* @param expParams: experiment startup parameters
*
*/
function getMsgDispatcherCommand(expParams: ExperimentConfig): string {
function getMsgDispatcherCommand(expParams: ExperimentConfig): string[] {
const clonedParams = Object.assign({}, expParams);
delete clonedParams.searchSpace;
return `${globals.args.pythonInterpreter} -m nni --exp_params ${Buffer.from(JSON.stringify(clonedParams)).toString('base64')}`;
return [ globals.args.pythonInterpreter, '-m', 'nni', '--exp_params', Buffer.from(JSON.stringify(clonedParams)).toString('base64') ];
}
/**
......@@ -249,16 +249,13 @@ async function getVersion(): Promise<string> {
/**
* run command as ChildProcess
*/
function getTunerProc(command: string, stdio: StdioOptions, newCwd: string, newEnv: any, newShell: boolean = true, isDetached: boolean = false): ChildProcess {
let cmd: string = command;
let arg: string[] = [];
function getTunerProc(command: string[], stdio: StdioOptions, newCwd: string, newEnv: any, newShell: boolean = true, isDetached: boolean = false): ChildProcess {
// FIXME: TensorBoard has no reason to use get TUNER proc
if (process.platform === "win32") {
cmd = command.split(" ", 1)[0];
arg = command.substr(cmd.length + 1).split(" ");
newShell = false;
isDetached = true;
}
const tunerProc: ChildProcess = spawn(cmd, arg, {
const tunerProc: ChildProcess = spawn(command[0], command.slice(1), {
stdio,
cwd: newCwd,
env: newEnv,
......
......@@ -178,7 +178,7 @@ class NNIManager implements Manager {
}
this.log.info('Setup tuner...');
const dispatcherCommand: string = getMsgDispatcherCommand(config);
const dispatcherCommand: string[] = getMsgDispatcherCommand(config);
this.log.debug(`dispatcher command: ${dispatcherCommand}`);
const checkpointDir: string = await this.createCheckpointDir();
await this.setupTuner(dispatcherCommand, undefined, 'start', checkpointDir);
......@@ -211,7 +211,7 @@ class NNIManager implements Manager {
}
this.log.info('Setup tuner...');
const dispatcherCommand: string = getMsgDispatcherCommand(config);
const dispatcherCommand: string[] = getMsgDispatcherCommand(config);
this.log.debug(`dispatcher command: ${dispatcherCommand}`);
const checkpointDir: string = await this.createCheckpointDir();
await this.setupTuner(dispatcherCommand, undefined, 'resume', checkpointDir);
......@@ -457,7 +457,7 @@ class NNIManager implements Manager {
}
}
private async setupTuner(command: string, cwd: string | undefined, mode: 'start' | 'resume', dataDirectory: string): Promise<void> {
private async setupTuner(command: string[], cwd: string | undefined, mode: 'start' | 'resume', dataDirectory: string): Promise<void> {
if (this.dispatcher !== undefined) {
return;
}
......
......@@ -81,7 +81,7 @@ class NNITensorboardManager implements TensorboardManager {
return tensorboardTask;
}
private async getTensorboardStartCommand(trialJobIdList: string[], trialLogDirectoryList: string[], port: number): Promise<string> {
private async getTensorboardStartCommand(trialJobIdList: string[], trialLogDirectoryList: string[], port: number): Promise<string[]> {
if (this.tensorboardVersion === undefined) {
this.setTensorboardVersion();
if (this.tensorboardVersion === undefined) {
......@@ -105,9 +105,8 @@ class NNITensorboardManager implements TensorboardManager {
const trialJob = await this.nniManager.getTrialJob(trialJobIdList[idx]);
logRealPaths.push(`${trialJob.sequenceId}-${trialJobIdList[idx]}:${realPath}`);
}
const command = `tensorboard ${logdirCmd}=${logRealPaths.join(',')} --port=${port}`;
return command;
} catch (error){
return [ 'tensorboard', `${logdirCmd}=${logRealPaths.join(',')}`, `--port=${port}` ];
} catch (error) {
throw new Error(`${error.message}`);
}
}
......
......@@ -22,7 +22,7 @@ async function runProcess(): Promise<Error | null> {
// create fake assessor process
const stdio: StdioOptions = ['ignore', 'pipe', process.stderr, 'pipe', 'pipe'];
const command: string = 'python assessor.py';
const command: string[] = [ 'python', 'assessor.py' ];
const proc: ChildProcess = getTunerProc(command, stdio, 'core/test', process.env);
// record its sent/received commands on exit
proc.on('error', (error: Error): void => { deferred.resolve(error); });
......
......@@ -18,7 +18,7 @@ async function startProcess(): Promise<void> {
// create fake assessor process
const stdio: StdioOptions = ['ignore', 'pipe', process.stderr, 'pipe', 'pipe'];
const dispatcherCmd: string = getMsgDispatcherCommand(
const dispatcherCmd: string[] = getMsgDispatcherCommand(
// Mock tuner config
<any>{
experimentName: 'exp1',
......
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