每天在特定时间运行Google Colab [英] Running google colab every day at a specific time

查看:119
本文介绍了每天在特定时间运行Google Colab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近构建了一个可在Google Colaboratory上运行的Python程序,我需要每天在特定时间运行该程序,那么有什么办法可以安排它在Google Colab上运行?

I recently have built a Python program that runs on Google Colaboratory, I need to run the program every day at a specific time, So Is there any way to schedule it to run on Google Colab?

推荐答案

您需要创建一个列出所有协作URL的 notebooks.csv .然后使用 colabctl 运行每个笔记本(依次在CSV中同步提及),然后暂停n秒钟,然后再次运行它们.

You need to create a notebooks.csv listing all the Colaboratory URLs. Then use colabctl to run each notebook (In order, synchronously mentioned in the CSV) and then pauses for a period of n seconds of time before running them again.

然后您可以运行 python colabctl.py< end-string>< sleep-seconds>

回购中有一个 gCookies.pkl 文件.确保您的本地Python版本与用于创建此序列化pkl文件的版本相同.

There's a gCookies.pkl file in the repo. Ensure that your local Python version is the same one as used to create this serialized pkl file.

参考: https://github.com/TensorTom/colabctl

现在我们已经准备好笔记本和脚本,接下来是能够通过SSH进入Google colab.

Now that we have a notebook and script ready, next is to be able to SSH into Google colab.

  • 在ngrok.com上创建帐户
  • 将以下代码复制并粘贴到colab中,该代码将安装ngrok并为我们创建隧道

来源: https://gist.github.com/yashkumaratri/204755a85977586cebbb58dc971496da#file-google-colab-ssh

  • 现在,在本地计算机上,打开终端和SSH以连接到Colab系统.

ssh root@0.tcp.ngrok.io -p< port_num_generation_above>

现在,您可以通过SSH终端访问整个系统.并且可以继续对本地环境中的任何其他玉米脚本使用colabctl来执行您的远程colab脚本.

Now you have access to the whole system through SSH terminal. And can continue to use colabctl to any other corn script on local environment to execute your remote colab script.

这篇关于每天在特定时间运行Google Colab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆