-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add foreground mode in nnictl #1956
Add foreground mode in nnictl #1956
Conversation
merge master
merge master
Update evolution doc (microsoft#1493)
merge master
merge master
merge master
augment pylintrc (microsoft#1643)
fix console.log (microsoft#1636)
merge master
merge master
merge master
merge master
Filter prune algo implementation (microsoft#1655)
merge master
merge master
merge master
merge master
merge master
merge master
merge master
merge master
merge master
merge master
Support monitor mode when creating or resuming a new experiment (microsoft#1933)
Add test for documentation build (microsoft#1924)
fix pipeline status badge (microsoft#1942)
I thought this could be done fully in |
The log content of node process is written to log file, if it is operated in |
if args.foreground: | ||
try: | ||
while True: | ||
log_content = rest_process.stdout.readline().strip().decode('utf-8') |
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.
how about atderr?
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.
There is no stderr content, since we only use console.log
, while stderr catch the content of console.error()
.
@@ -120,9 +122,15 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None | |||
stderr_file.write(log_header) | |||
if sys.platform == 'win32': | |||
from subprocess import CREATE_NEW_PROCESS_GROUP | |||
process = Popen(cmds, cwd=entry_dir, stdout=stdout_file, stderr=stderr_file, creationflags=CREATE_NEW_PROCESS_GROUP) | |||
if args.foreground: | |||
process = Popen(cmds, cwd=entry_dir, stdout=PIPE, stderr=STDOUT, creationflags=CREATE_NEW_PROCESS_GROUP) |
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.
a little strange here, for win32, stderr is STDOUT, for linux, stderr is PIPE?
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.
https://stackoverflow.com/questions/10406532/python-subprocess-output-on-windows
If I set stderr=PIPE
in windows, the process will crash, so I redirect stderr=STDOUT
.
src/nni_manager/common/log.ts
Outdated
@@ -81,6 +82,7 @@ class Logger { | |||
} | |||
|
|||
this.readonly = isReadonly(); | |||
this.foreground = foreground; |
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.
Suggest to do a little bit refactor on log.ts:
currently fileName being undefined means to use nnimanager.log as output file. change it to:
- undefined means send output to STDOUT.
- Move file name
nnimanager.log
into main.ts
Then we do not need a foreground
flag for log.ts. Because both log files and STDOUT are places where log class can send content to, we do not need an extract flag foreground
for STDOUT from log class perspective.
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.
fixed.
No description provided.