Today runtime.py kills running tasks when one of them crashes (worker.kill()). With this approach, it is impossible to tear down resources used by tasks gracefully.
We could send workers a warning signal which they can catch and process, a few seconds prior to SIGKILL, to allow them to clean up before terminating.