Google Colab notebooks have an idle timeout of 90 minutes and an absolute timeout of 12 hours. This means that if a user does not interact with his Google Colab notebook for more than 90 minutes, its instance will be automatically terminated. Also, the maximum lifetime of a Colab instance is 12 hours.
First, enter the cloud hard drive, Colaboratory
open a . ipynb
file
, enter the file, press F12
to pop up the check page at the bottom ,
switch to , console (控制台)
enter the following code and press Enter to prevent Colab from disconnecting
function ClickConnect(){
console.log("Working");
document.querySelector("#comments > span").click()
}
setInterval(ClickConnect,60000)
If you think the time is too short, you can modify the above code 60000
to be larger
这不需要点击连接按钮,只是点击评论按钮来保持我的会话活跃
(On the Internet, most of the anti-disconnection operations are realized by clicking the connection button)