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
9dec51e2
"...composable_kernel_onnxruntime.git" did not exist on "0ffe956ab1c1a8e128c2d6e419de68fcc1a8b5ff"
Unverified
Commit
9dec51e2
authored
Nov 11, 2019
by
SparkSnail
Committed by
GitHub
Nov 11, 2019
Browse files
Support space in logDir (#1694)
parent
0168ff1c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
src/nni_manager/common/experimentStartupInfo.ts
src/nni_manager/common/experimentStartupInfo.ts
+1
-1
src/nni_manager/training_service/common/util.ts
src/nni_manager/training_service/common/util.ts
+14
-14
src/nni_manager/training_service/local/localTrainingService.ts
...ni_manager/training_service/local/localTrainingService.ts
+6
-6
No files found.
src/nni_manager/common/experimentStartupInfo.ts
View file @
9dec51e2
...
...
@@ -43,7 +43,7 @@ class ExperimentStartupInfo {
this
.
initialized
=
true
;
if
(
logDir
!==
undefined
&&
logDir
.
length
>
0
)
{
this
.
logDir
=
path
.
join
(
logDir
,
getExperimentId
());
this
.
logDir
=
path
.
join
(
path
.
normalize
(
logDir
)
,
getExperimentId
());
}
else
{
this
.
logDir
=
path
.
join
(
os
.
homedir
(),
'
nni
'
,
'
experiments
'
,
getExperimentId
());
}
...
...
src/nni_manager/training_service/common/util.ts
View file @
9dec51e2
...
...
@@ -70,11 +70,11 @@ export async function validateCodeDir(codeDir: string) : Promise<number> {
*/
export
async
function
execMkdir
(
directory
:
string
,
share
:
boolean
=
false
):
Promise
<
void
>
{
if
(
process
.
platform
===
'
win32
'
)
{
await
cpp
.
exec
(
`powershell.exe New-Item -Path
${
directory
}
-ItemType "directory" -Force`
);
await
cpp
.
exec
(
`powershell.exe New-Item -Path
"
${
directory
}
"
-ItemType "directory" -Force`
);
}
else
if
(
share
)
{
await
cpp
.
exec
(
`(umask 0; mkdir -p
${
directory
}
)`
);
await
cpp
.
exec
(
`(umask 0; mkdir -p
'
${
directory
}
'
)`
);
}
else
{
await
cpp
.
exec
(
`mkdir -p
${
directory
}
`
);
await
cpp
.
exec
(
`mkdir -p
'
${
directory
}
'
`
);
}
return
Promise
.
resolve
();
...
...
@@ -87,9 +87,9 @@ export async function execMkdir(directory: string, share: boolean = false): Prom
*/
export
async
function
execCopydir
(
source
:
string
,
destination
:
string
):
Promise
<
void
>
{
if
(
process
.
platform
===
'
win32
'
)
{
await
cpp
.
exec
(
`powershell.exe Copy-Item
${
source
}
-Destination
${
destination
}
-Recurse`
);
await
cpp
.
exec
(
`powershell.exe Copy-Item
"
${
source
}
"
-Destination
"
${
destination
}
"
-Recurse`
);
}
else
{
await
cpp
.
exec
(
`cp -r
${
source
}
${
destination
}
`
);
await
cpp
.
exec
(
`cp -r
'
${
source
}
' '
${
destination
}
'
`
);
}
return
Promise
.
resolve
();
...
...
@@ -101,9 +101,9 @@ export async function execCopydir(source: string, destination: string): Promise<
*/
export
async
function
execNewFile
(
filename
:
string
):
Promise
<
void
>
{
if
(
process
.
platform
===
'
win32
'
)
{
await
cpp
.
exec
(
`powershell.exe New-Item -Path
${
filename
}
-ItemType "file" -Force`
);
await
cpp
.
exec
(
`powershell.exe New-Item -Path
"
${
filename
}
"
-ItemType "file" -Force`
);
}
else
{
await
cpp
.
exec
(
`touch
${
filename
}
`
);
await
cpp
.
exec
(
`touch
'
${
filename
}
'
`
);
}
return
Promise
.
resolve
();
...
...
@@ -115,9 +115,9 @@ export async function execNewFile(filename: string): Promise<void> {
*/
export
function
runScript
(
filePath
:
string
):
cp
.
ChildProcess
{
if
(
process
.
platform
===
'
win32
'
)
{
return
cp
.
exec
(
`powershell.exe -ExecutionPolicy Bypass -file
${
filePath
}
`
);
return
cp
.
exec
(
`powershell.exe -ExecutionPolicy Bypass -file
"
${
filePath
}
"
`
);
}
else
{
return
cp
.
exec
(
`bash
${
filePath
}
`
);
return
cp
.
exec
(
`bash
'
${
filePath
}
'
`
);
}
}
...
...
@@ -128,9 +128,9 @@ export function runScript(filePath: string): cp.ChildProcess {
export
async
function
execTail
(
filePath
:
string
):
Promise
<
cpp
.
childProcessPromise
.
Result
>
{
let
cmdresult
:
cpp
.
childProcessPromise
.
Result
;
if
(
process
.
platform
===
'
win32
'
)
{
cmdresult
=
await
cpp
.
exec
(
`powershell.exe Get-Content
${
filePath
}
-Tail 1`
);
cmdresult
=
await
cpp
.
exec
(
`powershell.exe Get-Content
"
${
filePath
}
"
-Tail 1`
);
}
else
{
cmdresult
=
await
cpp
.
exec
(
`tail -n 1
${
filePath
}
`
);
cmdresult
=
await
cpp
.
exec
(
`tail -n 1
'
${
filePath
}
'
`
);
}
return
Promise
.
resolve
(
cmdresult
);
...
...
@@ -142,9 +142,9 @@ export async function execTail(filePath: string): Promise<cpp.childProcessPromis
*/
export
async
function
execRemove
(
directory
:
string
):
Promise
<
void
>
{
if
(
process
.
platform
===
'
win32
'
)
{
await
cpp
.
exec
(
`powershell.exe Remove-Item
${
directory
}
-Recurse -Force`
);
await
cpp
.
exec
(
`powershell.exe Remove-Item
"
${
directory
}
"
-Recurse -Force`
);
}
else
{
await
cpp
.
exec
(
`rm -rf
${
directory
}
`
);
await
cpp
.
exec
(
`rm -rf
'
${
directory
}
'
`
);
}
return
Promise
.
resolve
();
...
...
@@ -173,7 +173,7 @@ export function setEnvironmentVariable(variable: { key: string; value: string })
if
(
process
.
platform
===
'
win32
'
)
{
return
`$env:
${
variable
.
key
}
="
${
variable
.
value
}
"`
;
}
else
{
return
`export
${
variable
.
key
}
=
${
variable
.
value
}
`
;
return
`export
${
variable
.
key
}
=
'
${
variable
.
value
}
'
`
;
}
}
...
...
src/nni_manager/training_service/local/localTrainingService.ts
View file @
9dec51e2
...
...
@@ -490,18 +490,18 @@ class LocalTrainingService implements TrainingService {
const
script
:
string
[]
=
[];
if
(
process
.
platform
===
'
win32
'
)
{
script
.
push
(
`cmd.exe /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 $LASTEXITCODE " " $NOW_DATE | Out-File
"
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
"
-NoNewline -encoding utf8`
);
}
else
{
script
.
push
(
`eval
${
localTrialConfig
.
command
}
2>
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
`
);
script
.
push
(
`eval
${
localTrialConfig
.
command
}
2>
"
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
"
`
);
if
(
process
.
platform
===
'
darwin
'
)
{
// https://superuser.com/questions/599072/how-to-get-bash-execution-time-in-milliseconds-under-mac-os-x
// Considering the worst case, write 999 to avoid negative duration
script
.
push
(
`echo $?
\`
date +%s999
\`
>
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
`
);
script
.
push
(
`echo $?
\`
date +%s999
\`
>
'
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
'
`
);
}
else
{
script
.
push
(
`echo $?
\`
date +%s%3N
\`
>
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
`
);
script
.
push
(
`echo $?
\`
date +%s%3N
\`
>
'
${
path
.
join
(
workingDirectory
,
'
.nni
'
,
'
state
'
)}
'
`
);
}
}
...
...
@@ -522,7 +522,7 @@ class LocalTrainingService implements TrainingService {
if
(
process
.
platform
!==
'
win32
'
)
{
runScriptContent
.
push
(
'
#!/bin/bash
'
);
}
runScriptContent
.
push
(
`cd
${
this
.
localTrialConfig
.
codeDir
}
`
);
runScriptContent
.
push
(
`cd
'
${
this
.
localTrialConfig
.
codeDir
}
'
`
);
for
(
const
variable
of
variables
)
{
runScriptContent
.
push
(
setEnvironmentVariable
(
variable
));
}
...
...
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