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
ade0b5b1
Unverified
Commit
ade0b5b1
authored
May 24, 2022
by
liuzhe-lz
Committed by
GitHub
May 24, 2022
Browse files
Fix two bugs introduced in this sprint (#4877)
parent
21539654
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
18 deletions
+15
-18
nni/tools/nnictl/launcher.py
nni/tools/nnictl/launcher.py
+2
-1
ts/nni_manager/common/utils.ts
ts/nni_manager/common/utils.ts
+5
-8
ts/nni_manager/core/nnimanager.ts
ts/nni_manager/core/nnimanager.ts
+3
-3
ts/nni_manager/extensions/nniTensorboardManager.ts
ts/nni_manager/extensions/nniTensorboardManager.ts
+3
-4
ts/nni_manager/test/core/ipcInterface.test.ts
ts/nni_manager/test/core/ipcInterface.test.ts
+1
-1
ts/nni_manager/test/core/ipcInterfaceTerminate.test.ts
ts/nni_manager/test/core/ipcInterfaceTerminate.test.ts
+1
-1
No files found.
nni/tools/nnictl/launcher.py
View file @
ade0b5b1
...
@@ -84,7 +84,8 @@ def create_experiment(args):
...
@@ -84,7 +84,8 @@ def create_experiment(args):
exp
.
url_prefix
=
url_prefix
exp
.
url_prefix
=
url_prefix
if
foreground
:
if
foreground
:
exp
.
run
(
port
,
debug
=
debug
)
exp
.
start
(
port
,
debug
,
RunMode
.
Foreground
)
exp
.
_wait_completion
()
else
:
else
:
exp
.
start
(
port
,
debug
,
RunMode
.
Detach
)
exp
.
start
(
port
,
debug
,
RunMode
.
Detach
)
...
...
ts/nni_manager/common/utils.ts
View file @
ade0b5b1
...
@@ -105,10 +105,10 @@ function randomSelect<T>(a: T[]): T {
...
@@ -105,10 +105,10 @@ function randomSelect<T>(a: T[]): T {
* @param expParams: experiment startup parameters
* @param expParams: experiment startup parameters
*
*
*/
*/
function
getMsgDispatcherCommand
(
expParams
:
ExperimentConfig
):
string
{
function
getMsgDispatcherCommand
(
expParams
:
ExperimentConfig
):
string
[]
{
const
clonedParams
=
Object
.
assign
({},
expParams
);
const
clonedParams
=
Object
.
assign
({},
expParams
);
delete
clonedParams
.
searchSpace
;
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> {
...
@@ -249,16 +249,13 @@ async function getVersion(): Promise<string> {
/**
/**
* run command as ChildProcess
* run command as ChildProcess
*/
*/
function
getTunerProc
(
command
:
string
,
stdio
:
StdioOptions
,
newCwd
:
string
,
newEnv
:
any
,
newShell
:
boolean
=
true
,
isDetached
:
boolean
=
false
):
ChildProcess
{
function
getTunerProc
(
command
:
string
[],
stdio
:
StdioOptions
,
newCwd
:
string
,
newEnv
:
any
,
newShell
:
boolean
=
true
,
isDetached
:
boolean
=
false
):
ChildProcess
{
let
cmd
:
string
=
command
;
// FIXME: TensorBoard has no reason to use get TUNER proc
let
arg
:
string
[]
=
[];
if
(
process
.
platform
===
"
win32
"
)
{
if
(
process
.
platform
===
"
win32
"
)
{
cmd
=
command
.
split
(
"
"
,
1
)[
0
];
arg
=
command
.
substr
(
cmd
.
length
+
1
).
split
(
"
"
);
newShell
=
false
;
newShell
=
false
;
isDetached
=
true
;
isDetached
=
true
;
}
}
const
tunerProc
:
ChildProcess
=
spawn
(
c
md
,
arg
,
{
const
tunerProc
:
ChildProcess
=
spawn
(
c
ommand
[
0
],
command
.
slice
(
1
)
,
{
stdio
,
stdio
,
cwd
:
newCwd
,
cwd
:
newCwd
,
env
:
newEnv
,
env
:
newEnv
,
...
...
ts/nni_manager/core/nnimanager.ts
View file @
ade0b5b1
...
@@ -178,7 +178,7 @@ class NNIManager implements Manager {
...
@@ -178,7 +178,7 @@ class NNIManager implements Manager {
}
}
this
.
log
.
info
(
'
Setup tuner...
'
);
this
.
log
.
info
(
'
Setup tuner...
'
);
const
dispatcherCommand
:
string
=
getMsgDispatcherCommand
(
config
);
const
dispatcherCommand
:
string
[]
=
getMsgDispatcherCommand
(
config
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
const
checkpointDir
:
string
=
await
this
.
createCheckpointDir
();
const
checkpointDir
:
string
=
await
this
.
createCheckpointDir
();
await
this
.
setupTuner
(
dispatcherCommand
,
undefined
,
'
start
'
,
checkpointDir
);
await
this
.
setupTuner
(
dispatcherCommand
,
undefined
,
'
start
'
,
checkpointDir
);
...
@@ -211,7 +211,7 @@ class NNIManager implements Manager {
...
@@ -211,7 +211,7 @@ class NNIManager implements Manager {
}
}
this
.
log
.
info
(
'
Setup tuner...
'
);
this
.
log
.
info
(
'
Setup tuner...
'
);
const
dispatcherCommand
:
string
=
getMsgDispatcherCommand
(
config
);
const
dispatcherCommand
:
string
[]
=
getMsgDispatcherCommand
(
config
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
const
checkpointDir
:
string
=
await
this
.
createCheckpointDir
();
const
checkpointDir
:
string
=
await
this
.
createCheckpointDir
();
await
this
.
setupTuner
(
dispatcherCommand
,
undefined
,
'
resume
'
,
checkpointDir
);
await
this
.
setupTuner
(
dispatcherCommand
,
undefined
,
'
resume
'
,
checkpointDir
);
...
@@ -457,7 +457,7 @@ class NNIManager implements Manager {
...
@@ -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
)
{
if
(
this
.
dispatcher
!==
undefined
)
{
return
;
return
;
}
}
...
...
ts/nni_manager/extensions/nniTensorboardManager.ts
View file @
ade0b5b1
...
@@ -81,7 +81,7 @@ class NNITensorboardManager implements TensorboardManager {
...
@@ -81,7 +81,7 @@ class NNITensorboardManager implements TensorboardManager {
return
tensorboardTask
;
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
)
{
if
(
this
.
tensorboardVersion
===
undefined
)
{
this
.
setTensorboardVersion
();
this
.
setTensorboardVersion
();
if
(
this
.
tensorboardVersion
===
undefined
)
{
if
(
this
.
tensorboardVersion
===
undefined
)
{
...
@@ -105,9 +105,8 @@ class NNITensorboardManager implements TensorboardManager {
...
@@ -105,9 +105,8 @@ class NNITensorboardManager implements TensorboardManager {
const
trialJob
=
await
this
.
nniManager
.
getTrialJob
(
trialJobIdList
[
idx
]);
const
trialJob
=
await
this
.
nniManager
.
getTrialJob
(
trialJobIdList
[
idx
]);
logRealPaths
.
push
(
`
${
trialJob
.
sequenceId
}
-
${
trialJobIdList
[
idx
]}
:
${
realPath
}
`
);
logRealPaths
.
push
(
`
${
trialJob
.
sequenceId
}
-
${
trialJobIdList
[
idx
]}
:
${
realPath
}
`
);
}
}
const
command
=
`tensorboard
${
logdirCmd
}
=
${
logRealPaths
.
join
(
'
,
'
)}
--port=
${
port
}
`
;
return
[
'
tensorboard
'
,
`
${
logdirCmd
}
=
${
logRealPaths
.
join
(
'
,
'
)}
`
,
`--port=
${
port
}
`
];
return
command
;
}
catch
(
error
)
{
}
catch
(
error
){
throw
new
Error
(
`
${
error
.
message
}
`
);
throw
new
Error
(
`
${
error
.
message
}
`
);
}
}
}
}
...
...
ts/nni_manager/test/core/ipcInterface.test.ts
View file @
ade0b5b1
...
@@ -22,7 +22,7 @@ async function runProcess(): Promise<Error | null> {
...
@@ -22,7 +22,7 @@ async function runProcess(): Promise<Error | null> {
// create fake assessor process
// create fake assessor process
const
stdio
:
StdioOptions
=
[
'
ignore
'
,
'
pipe
'
,
process
.
stderr
,
'
pipe
'
,
'
pipe
'
];
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
);
const
proc
:
ChildProcess
=
getTunerProc
(
command
,
stdio
,
'
core/test
'
,
process
.
env
);
// record its sent/received commands on exit
// record its sent/received commands on exit
proc
.
on
(
'
error
'
,
(
error
:
Error
):
void
=>
{
deferred
.
resolve
(
error
);
});
proc
.
on
(
'
error
'
,
(
error
:
Error
):
void
=>
{
deferred
.
resolve
(
error
);
});
...
...
ts/nni_manager/test/core/ipcInterfaceTerminate.test.ts
View file @
ade0b5b1
...
@@ -18,7 +18,7 @@ async function startProcess(): Promise<void> {
...
@@ -18,7 +18,7 @@ async function startProcess(): Promise<void> {
// create fake assessor process
// create fake assessor process
const
stdio
:
StdioOptions
=
[
'
ignore
'
,
'
pipe
'
,
process
.
stderr
,
'
pipe
'
,
'
pipe
'
];
const
stdio
:
StdioOptions
=
[
'
ignore
'
,
'
pipe
'
,
process
.
stderr
,
'
pipe
'
,
'
pipe
'
];
const
dispatcherCmd
:
string
=
getMsgDispatcherCommand
(
const
dispatcherCmd
:
string
[]
=
getMsgDispatcherCommand
(
// Mock tuner config
// Mock tuner config
<
any
>
{
<
any
>
{
experimentName
:
'
exp1
'
,
experimentName
:
'
exp1
'
,
...
...
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