We are using jupyterLab for some long running operations (doing physic simulations in our case). The user should be able to stop these operations safely without killing the kernel.
Is there a clean ways to do this?
Are there maybe even best practices for this?
My cell looks something like this:
environment = gym.make()
running = True
while running:
environment.step()
running = ???
serialize(environment)
Notes
- This is not a duplicate of How to stop the running cell if interupt kernel does not work[...], because I'm looking for a save way to stop without interrupting the control flow.
- This is not a duplicate of How to stop an infinite loop safely in Python?, because I'm looking for a way that is suited for JupyterNotebooks and JupyterLab.