Good morning,
I’m running notebooks in SwarmSpawner infrastructure and I saw that if a node, where the notebook is running, goes down (e.g. simulated via a ‘docker swarm leave’ on that node), the notebook is automatically spawned on another node.
That’s a good news (due to docker) but JupyterHub seems not to be aware of that …
Are there methods in JupyterHub config (SwarmSpawner class) to trap such event ?
Regards,
Bernard
Good morning,
Actually, the poll method is aware of any change , so when a jupyter notebook is re-spawned to another host (by docker) you can get all the details (container_id and node_id for example) with such a basic piece of code
service = yield self.get_task()
service_state = service["Status"]
if 'ContainerStatus' in service_state :
container_id = service_state['ContainerStatus']['ContainerID'] if 'ContainerID' in service_state['ContainerStatus'] else ""
if 'NodeID' in service:
node_id = service['NodeID']
Regards,
Bernard