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
62d5812d
Unverified
Commit
62d5812d
authored
Nov 27, 2020
by
J-shang
Committed by
GitHub
Nov 27, 2020
Browse files
quick fix kill command under windows (#3106)
parent
604f8431
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
17 deletions
+9
-17
nni/tools/nnictl/command_utils.py
nni/tools/nnictl/command_utils.py
+2
-1
ts/nni_manager/main.ts
ts/nni_manager/main.ts
+7
-16
No files found.
nni/tools/nnictl/command_utils.py
View file @
62d5812d
...
...
@@ -34,7 +34,8 @@ def check_output_command(file_path, head=None, tail=None):
def
kill_command
(
pid
):
"""kill command"""
if
sys
.
platform
==
'win32'
:
psutil
.
Process
(
pid
).
terminate
()
process
=
psutil
.
Process
(
pid
=
pid
)
process
.
send_signal
(
signal
.
CTRL_BREAK_EVENT
)
else
:
cmds
=
[
'kill'
,
str
(
pid
)]
call
(
cmds
)
...
...
ts/nni_manager/main.ts
View file @
62d5812d
...
...
@@ -179,20 +179,7 @@ mkDirP(getLogDir())
console
.
error
(
`Failed to create log dir:
${
err
.
stack
}
`
);
});
function
getStopSignal
():
any
{
return
'
SIGTERM
'
;
}
function
getCtrlCSignal
():
any
{
return
'
SIGINT
'
;
}
process
.
on
(
getCtrlCSignal
(),
async
()
=>
{
const
log
:
Logger
=
getLogger
();
log
.
info
(
`Get SIGINT signal!`
);
});
process
.
on
(
getStopSignal
(),
async
()
=>
{
async
function
cleanUp
():
Promise
<
void
>
{
const
log
:
Logger
=
getLogger
();
let
hasError
:
boolean
=
false
;
try
{
...
...
@@ -206,7 +193,11 @@ process.on(getStopSignal(), async () => {
hasError
=
true
;
log
.
error
(
`
${
err
.
stack
}
`
);
}
finally
{
await
log
.
close
();
log
.
close
();
process
.
exit
(
hasError
?
1
:
0
);
}
});
}
process
.
on
(
'
SIGTERM
'
,
cleanUp
);
process
.
on
(
'
SIGBREAK
'
,
cleanUp
);
process
.
on
(
'
SIGINT
'
,
cleanUp
);
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