Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent a Google Colab Process from being disconnected

Suppose I have to move out 3 hours away from my girlfriend's apartment, and I am running a Colab Environment. I can't stop the process and I need to bring my computer with me. How can I prevent the running process from being disconnected?

I have tried that question, but I think the Google Colab Interface has changed a bit, so the answers are no longer up-to-date.

like image 771
jgauth Avatar asked Jan 26 '23 03:01

jgauth


2 Answers

There are many answers there. Currently for me works perfectly to go to the console and type

function ClickConnect(){
    console.log("Clicked on connect button"); 
    document.querySelector("colab-connect-button").click()
}
setInterval(ClickConnect,60000)

Take note that this should prevent disconnecting after each 1.5 hours of inactivity, but each runtime, if you don't have Colab Pro, will be terminated after 12 hours.

Edit:

I have tested my self and come up that this works:

function ClickConnect(){
    console.log("Clicked on connect button"); 
    document.querySelector("#ok").click()
}
setInterval(ClickConnect,60000)

Note that it will throw an error, its ok, it means that the Disconnection notification is not shown. Once it appear it will be clicked to reconnect.

like image 136
TheShalty Avatar answered Feb 03 '23 08:02

TheShalty


There is this article from towards science that might help you prevent colab from disconecting

As a second thought, I think that as long as your laptop stays connected and active to a network it will keep running, so, an alternative is to use your phone as a hotspot to connect; use ethernet && wifi all together in order when you remove the cable you'll still be connected. But you have to keep your laptop open so you need battery fully charged; otherwise use a different device to start colab from like phone or tablet.

like image 26
TassosK Avatar answered Feb 03 '23 06:02

TassosK