-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add timeout for web_channel in trial_runner #2710
Conversation
Merge master
merge master
merge master
merge master
merge master
merge master
merge master
Chinese translation (microsoft#2458)
merge master
This reverts commit c5e26ef.
tools/nni_trial_tool/web_channel.py
Outdated
self.client = client | ||
nni_log(LogType.Info, 'WebChannel: connected with info %s' % url) | ||
except asyncio.TimeoutError: | ||
nni_log(LogType.Error, 'WebChannel: connect %s failed!' % url) |
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.
change the error message like below. It's more precise, and guide user to fix it.
WebChannel: connect to %s timeout! Please make sure NNIManagerIP configured correclty, and accessable.
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.
try: | ||
connect = asyncio.wait_for(websockets.connect(url), self.timeout) | ||
self._event_loop = asyncio.get_event_loop() | ||
client = self._event_loop.run_until_complete(connect) |
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.
Is it possible to hang at this line in some cases? Is a timeout needed for event loop?
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.
This self._event_loop.run_until_complete(connect) is for connect method, and connect has already handled timeout.
tools/nni_trial_tool/web_channel.py
Outdated
self.client = client | ||
nni_log(LogType.Info, 'WebChannel: connected with info %s' % url) | ||
except asyncio.TimeoutError: | ||
nni_log(LogType.Error, 'connect to %s timeout! Please make sure NNIManagerIP configured correclty, and accessable.' % url) |
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.
typo: correclty
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.