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

查看:44
本文介绍了每天在特定时间运行 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?

推荐答案

您需要创建一个 notebooks.csv 列出所有 Colaboratory URL.然后使用colabctl来运行每个notebook(按顺序,在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>,

存储库中有一个 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

现在您可以通过 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天全站免登陆