Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

add reusable for win remote #3500

Merged
merged 8 commits into from
Apr 7, 2021

Conversation

acured
Copy link
Contributor

@acured acured commented Mar 31, 2021

No description provided.

@@ -31,6 +32,8 @@ import { SharedStorageService, SharedStorageConfig } from './sharedStorage';
import { NFSSharedStorageService } from './shared_storages/nfsStorageService'
import { AzureBlobSharedStorageService } from './shared_storages/azureblobStorageService'
import { TrialDetail } from './trial';
import { LinuxCommands } from "../remote_machine/extends/linuxCommands";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trialDispatcher.ts is a common service, should not import common commands from remote_machine folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

environment.command = `mkdir -p envs/${envId} && cd envs/${envId} && ${environment.command}`;

environment.command = new LinuxCommands().reusableStartCommand(envId, this.isDeveloping);
environment.commandforwin = new WindowsCommands().reusableStartCommand(envId, this.isDeveloping);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commandforwin seems only for remote windows mode in this PR, don't put it here, this trialDispatcher is for common commands. Suggest to refer localEnvironmentService to see how it process local windows commands, or refactor logic to extract windows command and put it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


environment.command = `mkdir -p envs/${envId} && cd envs/${envId} && ${environment.command}`;

environment.command = `python3 -m nni.tools.trial_tool.trial_runner`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break other training service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

} else {
const prepare = `mkdir -p envs/${environment.envId} && cd envs/${environment.envId}`;
const startrun = `sh ../install_nni.sh && python3 -m nni.tools.trial_tool.trial_runner`;
const developingScript = "[ -d \"nni_trial_tool\" ] && echo \"nni_trial_tool exists already\" || (mkdir ./nni_trial_tool && tar -xof ../nni_trial_tool.tar.gz -C ./nni_trial_tool) && pip3 install websockets";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems these linux commands already set in trialDispatcher.ts and could use original commands directly, only need to add windows comands in remoteEnvironmentService.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, Fixed.

@@ -225,8 +225,10 @@ class TrialDispatcher implements TrainingService {
const codeFileName = await storageService.copyDirectory(codeDir, envDir, true);
storageService.rename(codeFileName, "nni-code.tar.gz");

const installFileName = storageService.joinPath(envDir, 'install_nni.sh');
const installFileName = storageService.joinPath(envDir, `install_nni.sh`);
const installFileNameForWin = storageService.joinPath(envDir, `install_nni.cmd`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other places in nni using .ps1 under windows, better to unify .ps1 in this place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


if (executor.getIsWindows()) {
const prepare = `envs\\install_nni.cmd && mkdir envs\\${environment.envId} && cd envs\\${environment.envId}`;
const startrun = `cd .. && install_nni.cmd && cd ${environment.envId} && python -m nni.tools.trial_tool.trial_runner`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems install twice? envs\\install_nni.cmd and install_nni.cmd

and multi cd can be simplified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -110,6 +109,15 @@ class ShellExecutor {
this.sshClient.end();
}

public async getIsWindows(): Promise<boolean>{
const result = await this.execute("ver")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have ShellExecutor.isWindows to check if is windows, if necessary, change isWindows to public.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

script = logLevel == "debug" ? `${prepare} && ${developingScript} && ${startrun}` : `${prepare} && ${startrun}`;
}

script = `cd ${environment.runnerWorkingFolder} && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this script value will override line 221.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only works for windows "isdebug" mode or not, Default(Linux) is not affected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIxed.

@acured acured force-pushed the AddReusableForWinRemote branch from 281c043 to e32bda9 Compare April 7, 2021 03:28
@SparkSnail SparkSnail merged commit 80bc953 into microsoft:master Apr 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants