Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
ca2253c3
Commit
ca2253c3
authored
Oct 14, 2019
by
Yuge Zhang
Committed by
QuanluZhang
Oct 14, 2019
Browse files
cmd -> cmd.exe (#1603)
parent
5bd994de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
src/nni_manager/common/utils.ts
src/nni_manager/common/utils.ts
+5
-5
src/nni_manager/training_service/common/util.ts
src/nni_manager/training_service/common/util.ts
+1
-1
src/nni_manager/training_service/local/localTrainingService.ts
...ni_manager/training_service/local/localTrainingService.ts
+1
-1
No files found.
src/nni_manager/common/utils.ts
View file @
ca2253c3
...
...
@@ -445,10 +445,10 @@ function getTunerProc(command: string, stdio: StdioOptions, newCwd: string, newE
/**
* judge whether the process is alive
*/
async
function
isAlive
(
pid
:
any
):
Promise
<
boolean
>
{
async
function
isAlive
(
pid
:
any
):
Promise
<
boolean
>
{
let
deferred
:
Deferred
<
boolean
>
=
new
Deferred
<
boolean
>
();
let
alive
:
boolean
=
false
;
if
(
process
.
platform
===
'
win32
'
){
if
(
process
.
platform
===
'
win32
'
)
{
try
{
const
str
=
cp
.
execSync
(
`powershell.exe Get-Process -Id
${
pid
}
-ErrorAction SilentlyContinue`
).
toString
();
if
(
str
)
{
...
...
@@ -458,7 +458,7 @@ async function isAlive(pid:any): Promise<boolean> {
catch
(
error
)
{
}
}
else
{
else
{
try
{
await
cpp
.
exec
(
`kill -0
${
pid
}
`
);
alive
=
true
;
...
...
@@ -473,11 +473,11 @@ async function isAlive(pid:any): Promise<boolean> {
/**
* kill process
*/
async
function
killPid
(
pid
:
any
):
Promise
<
void
>
{
async
function
killPid
(
pid
:
any
):
Promise
<
void
>
{
let
deferred
:
Deferred
<
void
>
=
new
Deferred
<
void
>
();
try
{
if
(
process
.
platform
===
"
win32
"
)
{
await
cpp
.
exec
(
`cmd /c taskkill /PID
${
pid
}
/F`
);
await
cpp
.
exec
(
`cmd
.exe
/c taskkill /PID
${
pid
}
/F`
);
}
else
{
await
cpp
.
exec
(
`kill -9
${
pid
}
`
);
...
...
src/nni_manager/training_service/common/util.ts
View file @
ca2253c3
...
...
@@ -156,7 +156,7 @@ export async function execRemove(directory: string): Promise<void> {
*/
export
async
function
execKill
(
pid
:
string
):
Promise
<
void
>
{
if
(
process
.
platform
===
'
win32
'
)
{
await
cpp
.
exec
(
`cmd /c taskkill /PID
${
pid
}
/T /F`
);
await
cpp
.
exec
(
`cmd
.exe
/c taskkill /PID
${
pid
}
/T /F`
);
}
else
{
await
cpp
.
exec
(
`pkill -P
${
pid
}
`
);
}
...
...
src/nni_manager/training_service/local/localTrainingService.ts
View file @
ca2253c3
...
...
@@ -490,7 +490,7 @@ class LocalTrainingService implements TrainingService {
const
script
:
string
[]
=
[];
if
(
process
.
platform
===
'
win32
'
)
{
script
.
push
(
`cmd /c
${
localTrialConfig
.
command
}
2>
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
`
,
`cmd
.exe
/c
${
localTrialConfig
.
command
}
2>
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
`
,
`$NOW_DATE = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds`
,
`$NOW_DATE = "$NOW_DATE" + (Get-Date -Format fff).ToString()`
,
`Write $LASTEXITCODE " " $NOW_DATE | Out-File
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
-NoNewline -encoding utf8`
);
...
...
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