Maged
Maged

Reputation: 998

How to terminate Colab session programmatically?

To save consumed compute units in Colab (as there's an option) to pay as you go, how to terminate / shut down Colab session using a code programmatically?

Upvotes: 7

Views: 1511

Answers (1)

Maged
Maged

Reputation: 998

Use the following function

from google.colab import runtime
runtime.unassign()

It will delete the currently connected runtime and disconnect the notebook. It's announced here.

Upvotes: 10

Related Questions