cassinyio / SwarmSpawner

This repo is deprecated. A spawner for JupyterHub
BSD 3-Clause "New" or "Revised" License
23 stars 36 forks source link

Check all tasks when polling #24

Closed FlorianRhiem closed 6 years ago

FlorianRhiem commented 6 years ago

Previously, only the first task returned by docker was checked to find the running task. This commit checks all tasks instead so that the SwarmSpawner can tolerate tasks which failed to start.

When a user stops and rapidly restarts their server, the first few tasks of the newly created notebook service may fail to start due to the address still being in use. After several attempts, a task will start successfully, but fail to work correctly as poll() does not recognize that a running task exists.

The tasks returned don't seem to be ordered chronologically or by state, so task[-1] instead of task[0] does not solve the issue. I iterate over all tasks instead of returning as soon as possible so that the (seemingly arbitrary) order of tasks does not change which task states are logged.

barrachri commented 6 years ago

Thanks @FlorianRhiem.