Closed isuftin closed 7 years ago
Hi @isuftin , how can you say that it works?
Because you miss this line in the logs Config option "placement" not recognized by "SwarmSpawner"
?
@barrachri The line you refer to is when the configuration uses the placement
as a top-level configuration option instead of adding it into the user_options
dictionary. When used as a top-level configuration option is when DockerSpawner complains. My feature request is to have it added as a top-level configuration option.
Unless you're saying that even when used in the user_options
dictionary, it doesn't work?
Sorry, your statement was slightly difficult to read.
Hi @isuftin sorry, my message was a bit unclear.
But you got my point:
Unless you're saying that even when used in the user_options dictionary, it doesn't work?
DockerSpawner complains because placement
is not recognised as valid option, in your second example the option is not just used at all, it's just a dict inside the config.
I think it's easy to implement this feature, would like to submit a PR?
@barrachri I can try to submit a PR once I have a little time to do so. I hope to do so this week.
@isuftin thanks :)
The PR is in and I've tested it as working. With the following set in jupyterhub_config.py:
c.SwarmSpawner.placement = ["node.role == worker"]
I can inspect the launched notebook process via docker inspect <service id>
and I can see:
"Spec": {
"Name": "jupyter-5d9c68c6c50ed3d02a2fcf54f63993b6-1",
"Labels": {},
"TaskTemplate": {
"ContainerSpec": {
[...]
"Placement": {
"Constraints": [
"node.role == worker"
]
}
[...]
$ docker node inspect worker1 | grep worker
"Role": "worker",
"Hostname": "worker1",
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
5ub2qq4lt1ho registry_registry replicated 1/1 registry:2.6.2 *:5000->5000/tcp
kvm3thjufitn jupyterhub_jupyterhub replicated 1/1 localhost:5000/dlcc/jupyterhub:latest *:443->443/tcp
u4waxtqq1t3r jupyter-5d9c68c6c50ed3d02a2fcf54f63993b6-1 replicated 1/1 localhost:5000/dlcc/jupyter-singleuser:latest
$ docker service ps u4
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
wysn1oijgmdp jupyter-5d9c68c6c50ed3d02a2fcf54f63993b6-1.1 localhost:5000/dlcc/jupyter-singleuser:latest worker1 Running Running 9 minutes ago
Working as expected!
Thanks!
merged.
As with other options we can choose for configuring the swarm deployment, I feel as though
placement
should be available as a configuration option not only to be set through user_options.An example of what I mean...
As a configuration level option, it currently does not work: jupyterhub_config.py
Launch logs:
But it does work if I add it under user_options and set to use user_options to true jupyterhub_config.py
Launch logs: