-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix no log from subprocess on trial #3653
Changes from 1 commit
ee40d6c
e0eaef9
437aaac
750e468
dba74d5
16f327b
d72aa02
c2beb9f
8a5115a
a00aa31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,13 +414,13 @@ class LocalTrainingService implements TrainingService { | |
if (process.platform === 'win32') { | ||
script.push(`cd $env:NNI_CODE_DIR`); | ||
script.push( | ||
`cmd.exe /c ${this.config.trialCommand} 2>&1 | Out-File "${path.join(workingDirectory, 'stderr')}" -encoding utf8`, | ||
`cmd.exe /c ${this.config.trialCommand} 1> "${path.join(workingDirectory, 'stdout')}" 2> "${path.join(workingDirectory, 'stderr')}" -encoding utf8`, | ||
`$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`); | ||
} else { | ||
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')}"`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still cannot view stdout from WebUI. That should be a problem? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIxed, After some investigate about this issue, here are some result: option2: option3: option4: I recommend remove sys.stdout redirect which is only works for local platform. (Somehow, It is no works for subprocess output if only setup "sys.stdout" on parent process, You have to change the code by "subprocess.Popen(your_command, stdout=sys.stdout)") |
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with cmd. Can someone check this?