Reputation: 125
Common fix to google colab fails
Google colab times out after 30-90 mins instead of 12 hours, and trying
function ConnectButton(){
console.log("Working");
document.querySelector("#connect").click()
}
setInterval(ConnectButton,60000);
raises errors in the inspector view. Is there a screenshot or different solution to prevent colab from disconnecting? I've already tried this solution and it doesn't work. Thanks for help in advance.
Upvotes: 0
Views: 490
Reputation:
there are many ways to solve this problem, these scripts become obsolete after a while, because google isn't stupid..
I advise you to write a script for example in python that provides to make clicks for you like this:
import numpy as np
import time
import mouse
while True:
random_row = np.random.random_sample()*100
random_col = np.random.random_sample()*10
random_time = np.random.random_sample()*np.random.random_sample() * 100
mouse.wheel(1000)
mouse.wheel(-1000)
mouse.move(random_row, random_col, absolute=False, duration=0.2)
mouse.move(-random_row, -random_col, absolute=False, duration = 0.2)
mouse.LEFT
time.sleep(random_time)
or you can generate a new cell using this javascript script like this:
function ClickConnect(){
console.log("Working");
document.querySelector("colab-toolbar-button").click()
} setInterval(ClickConnect,60000)
Upvotes: 1