Keep blocking task alive after session expires

I have a use case that allows the user to trigger a blocking task on the server side (via a button click). However this blocking task may run up to a few days. Obviously the browser will not be open for such a long period which eventually destroys the session. Is there a possibility to allow the blocking task to finish without being killed in the meantime?

You can execute arbitrary Python code, so most anything is possible. But as always, things come down to details. You can execute the long task in a separate process, or (if you only have one Bokeh server and expect it to stay running) in a separate thread. It might be more robust to have a separate service behind a REST API though. Beyond that, more details are needed to offer guidance about “re-connecting”. Is there just one user and session at a time? Many users and one session to view? Many users all with their own sessions? Can you tolerate having a special URL to return to (e.g. with a URL arguments in it)?