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
684005d7
Unverified
Commit
684005d7
authored
May 27, 2021
by
Ni Hao
Committed by
GitHub
May 27, 2021
Browse files
fix no log from subprocess on trial (#3653)
Co-authored-by:
Hao Ni
<
v-nihao@microsoft.com
>
parent
277e63f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
ts/nni_manager/common/trainingService.ts
ts/nni_manager/common/trainingService.ts
+1
-1
ts/nni_manager/training_service/local/localTrainingService.ts
...ni_manager/training_service/local/localTrainingService.ts
+5
-2
No files found.
ts/nni_manager/common/trainingService.ts
View file @
684005d7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*/
*/
type
TrialJobStatus
=
'
UNKNOWN
'
|
'
WAITING
'
|
'
RUNNING
'
|
'
SUCCEEDED
'
|
'
FAILED
'
|
'
USER_CANCELED
'
|
'
SYS_CANCELED
'
|
'
EARLY_STOPPED
'
;
type
TrialJobStatus
=
'
UNKNOWN
'
|
'
WAITING
'
|
'
RUNNING
'
|
'
SUCCEEDED
'
|
'
FAILED
'
|
'
USER_CANCELED
'
|
'
SYS_CANCELED
'
|
'
EARLY_STOPPED
'
;
type
LogType
=
'
TRIAL_LOG
'
|
'
TRIAL_ERROR
'
;
type
LogType
=
'
TRIAL_LOG
'
|
'
TRIAL_STDOUT
'
|
'
TRIAL_ERROR
'
;
interface
TrainingServiceMetadata
{
interface
TrainingServiceMetadata
{
readonly
key
:
string
;
readonly
key
:
string
;
...
...
ts/nni_manager/training_service/local/localTrainingService.ts
View file @
684005d7
...
@@ -174,6 +174,8 @@ class LocalTrainingService implements TrainingService {
...
@@ -174,6 +174,8 @@ class LocalTrainingService implements TrainingService {
let
logPath
:
string
;
let
logPath
:
string
;
if
(
logType
===
'
TRIAL_LOG
'
)
{
if
(
logType
===
'
TRIAL_LOG
'
)
{
logPath
=
path
.
join
(
this
.
rootDir
,
'
trials
'
,
trialJobId
,
'
trial.log
'
);
logPath
=
path
.
join
(
this
.
rootDir
,
'
trials
'
,
trialJobId
,
'
trial.log
'
);
}
else
if
(
logType
===
'
TRIAL_STDOUT
'
){
logPath
=
path
.
join
(
this
.
rootDir
,
'
trials
'
,
trialJobId
,
'
stdout
'
);
}
else
if
(
logType
===
'
TRIAL_ERROR
'
)
{
}
else
if
(
logType
===
'
TRIAL_ERROR
'
)
{
logPath
=
path
.
join
(
this
.
rootDir
,
'
trials
'
,
trialJobId
,
'
stderr
'
);
logPath
=
path
.
join
(
this
.
rootDir
,
'
trials
'
,
trialJobId
,
'
stderr
'
);
}
else
{
}
else
{
...
@@ -412,15 +414,16 @@ class LocalTrainingService implements TrainingService {
...
@@ -412,15 +414,16 @@ class LocalTrainingService implements TrainingService {
private
getScript
(
workingDirectory
:
string
):
string
[]
{
private
getScript
(
workingDirectory
:
string
):
string
[]
{
const
script
:
string
[]
=
[];
const
script
:
string
[]
=
[];
if
(
process
.
platform
===
'
win32
'
)
{
if
(
process
.
platform
===
'
win32
'
)
{
script
.
push
(
`$PSDefaultParameterValues = @{'Out-File:Encoding' = 'utf8'}`
);
script
.
push
(
`cd $env:NNI_CODE_DIR`
);
script
.
push
(
`cd $env:NNI_CODE_DIR`
);
script
.
push
(
script
.
push
(
`cmd.exe /c
${
this
.
config
.
trialCommand
}
2>&1 | Out-File "
${
path
.
join
(
workingDirectory
,
'
std
err
'
)}
" -encoding utf8
`
,
`cmd.exe /c
${
this
.
config
.
trialCommand
}
1>
${
path
.
join
(
workingDirectory
,
'
std
out
'
)}
2>
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
`
,
`$NOW_DATE = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds`
,
`$NOW_DATE = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds`
,
`$NOW_DATE = "$NOW_DATE" + (Get-Date -Format fff).ToString()`
,
`$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
{
}
else
{
script
.
push
(
`cd $NNI_CODE_DIR`
);
script
.
push
(
`cd $NNI_CODE_DIR`
);
script
.
push
(
`eval
${
this
.
config
.
trialCommand
}
2>
"
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
"
`
);
script
.
push
(
`eval
${
this
.
config
.
trialCommand
}
1>
${
path
.
join
(
workingDirectory
,
'
stdout
'
)}
2>
${
path
.
join
(
workingDirectory
,
'
stderr
'
)}
`
);
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
process
.
platform
===
'
darwin
'
)
{
// https://superuser.com/questions/599072/how-to-get-bash-execution-time-in-milliseconds-under-mac-os-x
// 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
// Considering the worst case, write 999 to avoid negative duration
...
...
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