Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add descriptive log for port unavailable and port-retries=0 #459

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,11 +1145,6 @@ def _observe_contents_manager_class(self, change):
"until its next major release (2.x)."
)

@observe('notebook_dir')
def _update_notebook_dir(self, change):
self.log.warning(_i18n("notebook_dir is deprecated, use root_dir"))
self.root_dir = change['new']

kernel_manager_class = Type(
default_value=AsyncMappingKernelManager,
klass=MappingKernelManager,
Expand Down Expand Up @@ -1767,7 +1762,10 @@ def init_httpserver(self):
self.http_server.listen(port, self.ip)
except socket.error as e:
if e.errno == errno.EADDRINUSE:
self.log.info(_i18n('The port %i is already in use, trying another port.') % port)
if self.port_retries:
self.log.info(_i18n('The port %i is already in use, trying another port.') % port)
else:
self.log.info(_i18n('The port %i is already in use.') % port)
continue
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
self.log.warning(_i18n("Permission to listen on port %i denied") % port)
Expand All @@ -1779,8 +1777,12 @@ def init_httpserver(self):
success = True
break
if not success:
self.log.critical(_i18n('ERROR: the Jupyter server could not be started because '
if self.port_retries:
self.log.critical(_i18n('ERROR: the notebook server could not be started because '
'no available port could be found.'))
else:
self.log.critical(_i18n('ERROR: the notebook server could not be started because '
'port %i is not available.') % port)
self.exit(1)

@staticmethod
Expand Down