Thursday, March 12, 2020

Google Colab Session and keeping that alive

Google colab takes 90 minutes if we close the browser to disconnect the session. 12 hours if we keep the browser open. Additionally, if we close our browser with a code cell is running, if that same cell has not finished, when we reopen the browser it will still be running (the current executing cell keeps running even after browser is closed).
some times we have to keep out loaded data for long time. Usually google colab keeps disconnecting after 30 mins automatically if we do not respond. And our data is lost.
We can prevent this just by running the following code in the console and it will prevent  from disconnecting. Ctrl+ Shift + i to open inspector view . Then go to console.
function ClickConnect(){
console.log("Working"); document.querySelector("colab-toolbar-button#connect").click() } setInterval(ClickConnect,60000)
It would keep on clicking the page and prevent it from disconnecting. It will solve the issue for us.

No comments: