Closed MAliNaqvi closed 7 years ago
Hi @MAliNaqvi, thanks for the issue.
The case where server_name
is not specified should be handled inside https://github.com/cassinyio/SwarmSpawner/blob/master/cassinyspawner/swarmspawner.py#L142
I just updated the master branch with a new commit.
Can you check if it works?
Hi @barrachri thank you for the quick response.
The change doesn't work.
https://www.dropbox.com/s/wv8lxyqlryg52yh/Screenshot%202017-03-16%2019.00.15.png?dl=0 the left terminal the server logs with the error right terminal I show the docker container which is running the hub, as well as the latest incorporated code
@barrachri A colleague of mine @evgeniwk tracked the problem to this line:
This section relates to allowing multiple servers per user. If we set c.JupyterHub.allow_multiple_servers = False
to JupyterHub.allow_multiple_servers = True
The server_name appears correctly: https://www.dropbox.com/s/snn9reyg0cvj1a8/Screenshot%202017-03-16%2019.13.50.png?dl=0
but there is a 404.
So the problem was that 'self.server_name' always exists and is not none but ''
that is False.
You can remove 'c.JupyterHub.allow_multiple_servers = False' because we are still working on this feature.
With the last commit this problem should be resolved.
If you get a 404 error:
@barrachri
The new change https://github.com/cassinyio/SwarmSpawner/blob/254f07899fb6a18fe1ff235a0e91acc485509942/cassinyspawner/swarmspawner.py#L150-L153
gives an attribute error:
jupyterhub.1.mpvej68c1wtx@moby | File "/srv/jupyterhub/src/swarmspawner/cassinyspawner/swarmspawner.py", line 150, in service_name
jupyterhub.1.mpvej68c1wtx@moby | if self.server_name:
jupyterhub.1.mpvej68c1wtx@moby | AttributeError: 'SwarmSpawner' object has no attribute 'server_name'
We can solve it either by:
if hasattr(self, 'server_name'):
if self.server_name:
server_name = self.server_name
else:
server_name = 1
else:
server_name = 1
or a simpler version would be:
server_name = 1
if hasattr(self, 'server_name'):
if self.server_name:
server_name = self.server_name
I have tested both and they work.
Hi @MAliNaqvi thanks for the patient.
So service_name
is also called outside def start()
this why we get AttributeError
.
With the last version of the spawner it works.
I am waiting for a feedback to close this issue.
@barrachri yes the latest code works. This issue can be closed.
@barrachri
Issue: Starting the notebook service via swarmspawner results in:
Explanation: The hub can't find the service
jupyter-77e417a2b692b459f1deaac61b3bf5ba-1
associated with a usernameanaqvi
. It checks user options for a server_name:https://github.com/cassinyio/SwarmSpawner/blob/master/cassinyspawner/swarmspawner.py#L292-L293
however it doesn't assign a value to server_name if there are no user options. That is if the
c.SwarmSpawner.use_user_options = False
in jupyterhub_config.py then it doesn't assign the server_name anything. This results in the DNS name to be:jupyter-77e417a2b692b459f1deaac61b3bf5ba-
which is against the regex for DNS names in Docker
^[a-zA-Z0-9](?:[-_]*[A-Za-z0-9]+)*$
as it contains a dash at the end.This can be confirmed by changing this line: https://github.com/cassinyio/SwarmSpawner/blob/master/cassinyspawner/swarmspawner.py#L156
from
to
Possible solution: I have a minor commit that fixes this issue by assigning the value of 1 to self.server_name after the if statement: https://github.com/MAliNaqvi/SwarmSpawner/commit/49fb55b328ccd01020267cbd76c0a1fefa23a1ca