在 GitHub 上编辑

cache migrate

将现有的 缓存 数据迁移到 DVC 3.0 的位置。

概要

usage: dvc cache migrate [-h] [-q | -v] [--dvc-files] [--dry]

描述

强制将旧版 DVC 版本中跟踪的文件的 缓存 数据迁移到 DVC 3.0 的位置。旧缓存位置中的文件将使用 DVC 3.0 的哈希算法重新计算哈希值,原子性地移动到新的缓存位置,然后在旧位置创建指向新位置的链接。

在大多数本地文件系统上,这相当于实现了 DVC 3.0 跟踪的文件与旧版本跟踪的文件之间的去重。

对于不支持任何类型链接的文件系统,数据将从旧缓存位置复制到 DVC 3.0 位置(因此不会实现去重)。

默认情况下,dvc cache migrate 仅迁移缓存数据,不会修改 DVC 文件 中的内容。可以使用 --dvc-files 选项将仓库中所有 DVC 文件的条目迁移到 DVC 3.0 格式。

请注意,使用 --dvc-files 选项时,DVC 仅会迁移 工作区 中的 DVC 文件(不会重写 Git 历史记录)。

选项

  • --dvc-files - 将仓库中所有现有的 DVC 文件 中的条目迁移到 DVC 3.0 格式。

  • --dry - 仅打印将要执行的操作,不实际迁移任何数据。

  • -h, --help - 打印使用说明/帮助信息,然后退出。

  • -q, --quiet - 不向标准输出写入任何内容。如果没有问题则以 0 退出,否则以 1 退出。

  • -v, --verbose - 显示详细的跟踪信息。

示例:迁移前检查将执行的步骤

$ dvc cache migrate --dry
94975 files will be re-hashed and migrated to the DVC 3.0 cache location.

示例:迁移现有缓存

$ dvc cache migrate
Migrated 94975 files to DVC 3.0 cache location.

示例:迁移现有缓存并更新 DVC 文件

$ dvc cache migrate --dvc-files
Migrated 3 files to DVC 3.0 cache location.
Updating DVC file 'foo.dvc'
Modifying stage 'baz' in 'dir/dvc.yaml'
Updating lock file 'dir/dvc.lock'
Updating DVC file 'dir/bar.dvc'

To track the changes with git, run:

        git add dir/dvc.yaml foo.dvc dir/dvc.lock dir/bar.dvc

To enable auto staging, run:

        dvc config core.autostage true
内容

🐛 发现问题?告诉我们!或者修复它:

在 GitHub 上编辑

有疑问?加入我们的聊天,我们会为您提供帮助:

Discord 聊天