add Spawner.get_url

for retrieving the spawner url. Occurs on startup.

Default is a no-op and no Spawner needs to implement this.
This commit is contained in:
Min RK
2018-11-09 13:22:08 +01:00
parent fc25b0e10d
commit eb19a73044

View File

@@ -661,6 +661,22 @@ class Spawner(LoggingConfigurable):
return env
async def get_url(self):
"""Get the URL to connect to the server
Sometimes JupyterHub may ask the Spawner for its url.
This can occur e.g. when JupyterHub has restarted while a server was not finished starting,
giving Spawners a chance to recover the URL where their server is running.
The default is to trust that JupyterHub has the right information.
Only override this method in Spawners that know how to
check the correct URL for the servers they start.
This will only be asked of Spawners that claim to be running
(`poll()` returns `None`).
"""
return self.server.url
def template_namespace(self):
"""Return the template namespace for format-string formatting.