Skip to content

Commit 500e94e

Browse files
authored
Merge pull request #459 from afshin/backport-5136
Add descriptive log for port unavailable and port-retries=0
2 parents 6cad9ee + 5a5052e commit 500e94e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

jupyter_server/serverapp.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,6 @@ def _observe_contents_manager_class(self, change):
11451145
"until its next major release (2.x)."
11461146
)
11471147

1148-
@observe('notebook_dir')
1149-
def _update_notebook_dir(self, change):
1150-
self.log.warning(_i18n("notebook_dir is deprecated, use root_dir"))
1151-
self.root_dir = change['new']
1152-
11531148
kernel_manager_class = Type(
11541149
default_value=AsyncMappingKernelManager,
11551150
klass=MappingKernelManager,
@@ -1767,7 +1762,10 @@ def init_httpserver(self):
17671762
self.http_server.listen(port, self.ip)
17681763
except socket.error as e:
17691764
if e.errno == errno.EADDRINUSE:
1770-
self.log.info(_i18n('The port %i is already in use, trying another port.') % port)
1765+
if self.port_retries:
1766+
self.log.info(_i18n('The port %i is already in use, trying another port.') % port)
1767+
else:
1768+
self.log.info(_i18n('The port %i is already in use.') % port)
17711769
continue
17721770
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
17731771
self.log.warning(_i18n("Permission to listen on port %i denied") % port)
@@ -1779,8 +1777,12 @@ def init_httpserver(self):
17791777
success = True
17801778
break
17811779
if not success:
1782-
self.log.critical(_i18n('ERROR: the Jupyter server could not be started because '
1780+
if self.port_retries:
1781+
self.log.critical(_i18n('ERROR: the notebook server could not be started because '
17831782
'no available port could be found.'))
1783+
else:
1784+
self.log.critical(_i18n('ERROR: the notebook server could not be started because '
1785+
'port %i is not available.') % port)
17841786
self.exit(1)
17851787

17861788
@staticmethod

0 commit comments

Comments
 (0)