8000 GitHub - Ynkcc/kaggle-env-setup · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Kaggle 环境持久化工具集

解决 Kaggle Notebook 每次重启后环境数据(Rust 工具链、IDE 数据、SSH 隧道)全部丢失的问题。

Kaggle Notebook 重启会清空整个 /root 文件系统。本工具集将"恢复环境"固化为可重复执行的脚本,利用 /kaggle/working(Kaggle 会话间保留位置)作为备份中转。

脚本说明

脚本 作用
tunnel.py 配置 sshd + Cloudflare 隧道穿透(密钥认证,同步 Kaggle 环境变量)
setup.sh 一键恢复:拉取项目 → 恢复 Rust → 恢复 IDE 数据 → 同步环境变量 → 启动隧道
backup.sh 备份 Rust 工具链与 IDE 数据到 /kaggle/working

使用方法

首次使用(当前环境)

# 1. 备份 Rust 工具链 + IDE 数据到 /kaggle/working
bash backup.sh

# 2. 启动 Cloudflare SSH 隧道(打印可直连域名)
python3 tunnel.py

环境重启后

# 方式一:项目已同步到 /kaggle/working
bash /kaggle/working/<项目名>/scripts/setup.sh

# 方式二:从 GitHub 拉取后运行
git clone <你的项目地址> && bash <项目>/setup.sh

可选参数

  • setup.sh --no-tunnel:只恢复环境,不启动隧道
  • setup.sh --no-rust:跳过 Rust 安装
  • backup.sh --no-rust / backup.sh --no-ide:按需备份

前置配置

使用前需在 tunnel.py 中填入你的 SSH 公钥(public_key 变量):

public_key = "ssh-rsa AAAA... your-public-key"

重要说明

  • /kaggle/working 不是永久存储,约 20 小时无活动会被 Kaggle 清理。
  • 代码本身最可靠的持久化方式是推送到 GitHub,重启后 git clone 恢复。
  • Cloudflare 隧道域名(trycloudflare.com)每次重启都会变化。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0