Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
e21a6984
Unverified
Commit
e21a6984
authored
Oct 26, 2020
by
liuzhe-lz
Committed by
GitHub
Oct 26, 2020
Browse files
[v2.0] Refactor code hierarchy (part 2) (#2987)
parent
f98ee672
Changes
231
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
16 additions
and
15 deletions
+16
-15
test/config/pr_tests.yml
test/config/pr_tests.yml
+2
-2
test/nni_test/nnitest/validators.py
test/nni_test/nnitest/validators.py
+2
-2
ts/nni_manager/package.json
ts/nni_manager/package.json
+1
-1
ts/nni_manager/training_service/common/gpuData.ts
ts/nni_manager/training_service/common/gpuData.ts
+1
-1
ts/nni_manager/training_service/common/util.ts
ts/nni_manager/training_service/common/util.ts
+1
-1
ts/nni_manager/training_service/dlts/dltsData.ts
ts/nni_manager/training_service/dlts/dltsData.ts
+1
-1
ts/nni_manager/training_service/kubernetes/kubernetesData.ts
ts/nni_manager/training_service/kubernetes/kubernetesData.ts
+1
-1
ts/nni_manager/training_service/pai/paiK8S/paiK8SData.ts
ts/nni_manager/training_service/pai/paiK8S/paiK8SData.ts
+1
-1
ts/nni_manager/training_service/remote_machine/extends/linuxCommands.ts
.../training_service/remote_machine/extends/linuxCommands.ts
+2
-2
ts/nni_manager/training_service/remote_machine/extends/windowsCommands.ts
...raining_service/remote_machine/extends/windowsCommands.ts
+2
-2
ts/nni_manager/training_service/reusable/trialDispatcher.ts
ts/nni_manager/training_service/reusable/trialDispatcher.ts
+2
-1
No files found.
test/config/pr_tests.yml
View file @
e21a6984
...
...
@@ -47,8 +47,8 @@ testCases:
config
:
maxTrialNum
:
4
trialConcurrency
:
4
launchCommand
:
python3 -c 'from nni.
nnicli
import Experiment; exp = Experiment(); exp.start_experiment("$configFile")'
stopCommand
:
python3 -c 'from nni.
nnicli
import Experiment; exp = Experiment(); exp.connect_experiment("http://localhost:8080/"); exp.stop_experiment()'
launchCommand
:
python3 -c 'from nni.
experiment
import Experiment; exp = Experiment(); exp.start_experiment("$configFile")'
stopCommand
:
python3 -c 'from nni.
experiment
import Experiment; exp = Experiment(); exp.connect_experiment("http://localhost:8080/"); exp.stop_experiment()'
validator
:
class
:
NnicliValidator
platform
:
linux darwin
...
...
test/nni_test/nnitest/validators.py
View file @
e21a6984
...
...
@@ -6,8 +6,8 @@ from os import remove
import
subprocess
import
json
import
requests
from
nni.
nnicli
import
Experiment
from
nni.
nni_cmd
.updater
import
load_search_space
from
nni.
experiment
import
Experiment
from
nni.
tools.nnictl
.updater
import
load_search_space
from
utils
import
METRICS_URL
,
GET_IMPORTED_DATA_URL
...
...
ts/nni_manager/package.json
View file @
e21a6984
...
...
@@ -12,7 +12,6 @@
"license"
:
"MIT"
,
"dependencies"
:
{
"azure-storage"
:
"^2.10.2"
,
"chai-as-promised"
:
"^7.1.1"
,
"child-process-promise"
:
"^2.2.1"
,
"express"
:
"^4.16.3"
,
"express-joi-validator"
:
"^2.0.0"
,
...
...
@@ -53,6 +52,7 @@
"@typescript-eslint/eslint-plugin"
:
"^2.10.0"
,
"@typescript-eslint/parser"
:
"^2.10.0"
,
"chai"
:
"^4.1.2"
,
"chai-as-promised"
:
"^7.1.1"
,
"eslint"
:
"^6.7.2"
,
"glob"
:
"^7.1.3"
,
"mocha"
:
"^8.1.3"
,
...
...
ts/nni_manager/training_service/common/gpuData.ts
View file @
e21a6984
...
...
@@ -79,6 +79,6 @@ export function parseGpuIndices(gpuIndices?: string): Set<number> | undefined {
export
const
GPU_INFO_COLLECTOR_FORMAT_WINDOWS
:
string
=
`
$env:METRIC_OUTPUT_DIR="{0}"
$app = Start-Process "python" -ArgumentList "-m nni
_
gpu_tool.gpu_metrics_collector" -passthru -NoNewWindow
$app = Start-Process "python" -ArgumentList "-m nni
.tools.
gpu_tool.gpu_metrics_collector" -passthru -NoNewWindow
Write $app.ID | Out-File {1} -NoNewline -encoding utf8
`
;
ts/nni_manager/training_service/common/util.ts
View file @
e21a6984
...
...
@@ -236,7 +236,7 @@ export function getScriptName(fileNamePrefix: string): string {
}
export
function
getGpuMetricsCollectorBashScriptContent
(
scriptFolder
:
string
):
string
{
return
`echo $$ >
${
scriptFolder
}
/pid ; METRIC_OUTPUT_DIR=
${
scriptFolder
}
python3 -m nni
_
gpu_tool.gpu_metrics_collector`
;
return
`echo $$ >
${
scriptFolder
}
/pid ; METRIC_OUTPUT_DIR=
${
scriptFolder
}
python3 -m nni
.tools.
gpu_tool.gpu_metrics_collector`
;
}
export
function
runGpuMetricsCollector
(
scriptFolder
:
string
):
void
{
...
...
ts/nni_manager/training_service/dlts/dltsData.ts
View file @
e21a6984
...
...
@@ -4,5 +4,5 @@
export
const
DLTS_TRIAL_COMMAND_FORMAT
:
string
=
`export NNI_PLATFORM=dlts NNI_SYS_DIR={0} NNI_OUTPUT_DIR={1} NNI_TRIAL_JOB_ID={2} NNI_EXP_ID={3} NNI_TRIAL_SEQ_ID={4} MULTI_PHASE={5} \
&& cd $NNI_SYS_DIR && sh install_nni.sh \
&& cd '{6}' && python3 -m nni
_
trial_tool.trial_keeper --trial_command '{7}' \
&& cd '{6}' && python3 -m nni
.tools.
trial_tool.trial_keeper --trial_command '{7}' \
--nnimanager_ip '{8}' --nnimanager_port '{9}' --nni_manager_version '{10}' --log_collection '{11}'`
;
ts/nni_manager/training_service/kubernetes/kubernetesData.ts
View file @
e21a6984
...
...
@@ -52,5 +52,5 @@ mkdir -p $NNI_OUTPUT_DIR
cp -r $NNI_CODE_DIR/. $NNI_SYS_DIR/code
sh $NNI_SYS_DIR/install_nni.sh
cd $NNI_SYS_DIR/code
python3 -m nni
_
trial_tool.trial_keeper --trial_command '{8}' --nnimanager_ip {9} --nnimanager_port {10} \
python3 -m nni
.tools.
trial_tool.trial_keeper --trial_command '{8}' --nnimanager_ip {9} --nnimanager_port {10} \
--nni_manager_version '{11}' --log_collection '{12}' 1>$NNI_OUTPUT_DIR/trialkeeper_stdout 2>$NNI_OUTPUT_DIR/trialkeeper_stderr`
;
ts/nni_manager/training_service/pai/paiK8S/paiK8SData.ts
View file @
e21a6984
...
...
@@ -16,5 +16,5 @@ fi`;
export
const
PAI_K8S_TRIAL_COMMAND_FORMAT
:
string
=
`export NNI_PLATFORM=pai NNI_SYS_DIR={0} NNI_OUTPUT_DIR={1} NNI_TRIAL_JOB_ID={2} NNI_EXP_ID={3} NNI_TRIAL_SEQ_ID={4} MULTI_PHASE={5} \
&& NNI_CODE_DIR={6} && mkdir -p $NNI_SYS_DIR/code && cp -r $NNI_CODE_DIR/. $NNI_SYS_DIR/code && sh $NNI_SYS_DIR/install_nni.sh \
&& cd $NNI_SYS_DIR/code && python3 -m nni
_
trial_tool.trial_keeper --trial_command '{7}' --nnimanager_ip '{8}' --nnimanager_port '{9}' \
&& cd $NNI_SYS_DIR/code && python3 -m nni
.tools.
trial_tool.trial_keeper --trial_command '{7}' --nnimanager_ip '{8}' --nnimanager_port '{9}' \
--nni_manager_version '{10}' --log_collection '{11}' | tee $NNI_OUTPUT_DIR/trial.log`
;
ts/nni_manager/training_service/remote_machine/extends/linuxCommands.ts
View file @
e21a6984
...
...
@@ -26,7 +26,7 @@ class LinuxCommands extends OsCommands {
cp -r $NNI_CODE_DIR/. $NNI_SYS_DIR/code
sh $NNI_SYS_DIR/install_nni.sh
cd $NNI_SYS_DIR/code
python3 -m nni
_
trial_tool.trial_keeper --trial_command '
${
cudaVisibleSetting
}
${
command
}
' --nnimanager_ip '
${
nniManagerAddress
}
' \
python3 -m nni
.tools.
trial_tool.trial_keeper --trial_command '
${
cudaVisibleSetting
}
${
command
}
' --nnimanager_ip '
${
nniManagerAddress
}
' \
--nnimanager_port '
${
nniManagerPort
}
' --nni_manager_version '
${
nniManagerVersion
}
' \
--job_id_file
${
jobIdFileName
}
\
--log_collection '
${
logCollection
}
' 1>$NNI_OUTPUT_DIR/trialkeeper_stdout 2>$NNI_OUTPUT_DIR/trialkeeper_stderr
...
...
@@ -34,7 +34,7 @@ class LinuxCommands extends OsCommands {
}
public
generateGpuStatsScript
(
scriptFolder
:
string
):
string
{
return
`echo $$ >
${
scriptFolder
}
/pid ; METRIC_OUTPUT_DIR=
${
scriptFolder
}
python3 -m nni
_
gpu_tool.gpu_metrics_collector`
;
return
`echo $$ >
${
scriptFolder
}
/pid ; METRIC_OUTPUT_DIR=
${
scriptFolder
}
python3 -m nni
.tools.
gpu_tool.gpu_metrics_collector`
;
}
public
createFolder
(
folderName
:
string
,
sharedFolder
:
boolean
=
false
):
string
{
...
...
ts/nni_manager/training_service/remote_machine/extends/windowsCommands.ts
View file @
e21a6984
...
...
@@ -38,7 +38,7 @@ class WindowsCommands extends OsCommands {
)
echo starting script
python -m nni
_
trial_tool.trial_keeper --trial_command "
${
command
}
" --nnimanager_ip "
${
nniManagerAddress
}
" --nnimanager_port "
${
nniManagerPort
}
" --nni_manager_version "
${
nniManagerVersion
}
" --log_collection "
${
logCollection
}
" --job_id_file
${
jobIdFileName
}
1>%NNI_OUTPUT_DIR%/trialkeeper_stdout 2>%NNI_OUTPUT_DIR%/trialkeeper_stderr
python -m nni
.tools.
trial_tool.trial_keeper --trial_command "
${
command
}
" --nnimanager_ip "
${
nniManagerAddress
}
" --nnimanager_port "
${
nniManagerPort
}
" --nni_manager_version "
${
nniManagerVersion
}
" --log_collection "
${
logCollection
}
" --job_id_file
${
jobIdFileName
}
1>%NNI_OUTPUT_DIR%/trialkeeper_stdout 2>%NNI_OUTPUT_DIR%/trialkeeper_stderr
echo save exit code(%ERRORLEVEL%) and time
echo|set /p="%ERRORLEVEL% " >
${
exitCodeFile
}
...
...
@@ -46,7 +46,7 @@ class WindowsCommands extends OsCommands {
}
public
generateGpuStatsScript
(
scriptFolder
:
string
):
string
{
return
`powershell -command $env:Path=If($env:prePath){$env:prePath}Else{$env:Path};$env:METRIC_OUTPUT_DIR='
${
scriptFolder
}
';$app = Start-Process -FilePath python -NoNewWindow -passthru -ArgumentList '-m nni
_
gpu_tool.gpu_metrics_collector' -RedirectStandardOutput
${
scriptFolder
}
\\scriptstdout -RedirectStandardError
${
scriptFolder
}
\\scriptstderr;Write $PID ^| Out-File
${
scriptFolder
}
\\pid -NoNewline -encoding utf8;wait-process $app.ID`
;
return
`powershell -command $env:Path=If($env:prePath){$env:prePath}Else{$env:Path};$env:METRIC_OUTPUT_DIR='
${
scriptFolder
}
';$app = Start-Process -FilePath python -NoNewWindow -passthru -ArgumentList '-m nni
.tools.
gpu_tool.gpu_metrics_collector' -RedirectStandardOutput
${
scriptFolder
}
\\scriptstdout -RedirectStandardError
${
scriptFolder
}
\\scriptstderr;Write $PID ^| Out-File
${
scriptFolder
}
\\pid -NoNewline -encoding utf8;wait-process $app.ID`
;
}
public
createFolder
(
folderName
:
string
,
sharedFolder
:
boolean
=
false
):
string
{
...
...
ts/nni_manager/training_service/reusable/trialDispatcher.ts
View file @
e21a6984
...
...
@@ -228,6 +228,7 @@ class TrialDispatcher implements TrainingService {
const
runnerSettings
=
storageService
.
joinPath
(
envDir
,
"
settings.json
"
);
await
storageService
.
save
(
JSON
.
stringify
(
this
.
runnerSettings
),
runnerSettings
);
// FIXME: what the hell is this?
if
(
this
.
isDeveloping
)
{
let
trialToolsPath
=
path
.
join
(
__dirname
,
"
../../../../../tools/nni_trial_tool
"
);
if
(
false
===
fs
.
existsSync
(
trialToolsPath
))
{
...
...
@@ -598,7 +599,7 @@ class TrialDispatcher implements TrainingService {
const
envName
=
`nni_exp_
${
this
.
experimentId
}
_env_
${
envId
}
`
;
const
environment
=
environmentService
.
createEnvironmentInformation
(
envId
,
envName
);
environment
.
command
=
`sh ../install_nni.sh && python3 -m nni
_
trial_tool.trial_runner`
;
environment
.
command
=
`sh ../install_nni.sh && python3 -m nni
.tools.
trial_tool.trial_runner`
;
if
(
this
.
isDeveloping
)
{
environment
.
command
=
"
[ -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 &&
"
+
environment
.
command
;
...
...
Prev
1
…
8
9
10
11
12
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment