usage: dvc update [-h] [-q | -v] [-R] [--rev <commit>] [--to-remote] [-r <name>] [--no-download] [-j <number>] targets [targets ...] positional arguments: targets Import .dvc files to update. Using -R, directories to search for .dvc files can also be given.
To indicate which import stages to update, we can specify the corresponding
targets as command arguments.
dvc update without flags will not have an effect on import stages that are
fixed to a commit hash (
rev field in the
.dvc file). Use the
to update an imported artifact to a different revision.
$ dvc update --rev master
--rev <version>- commit hash, branch or tag name, etc. (any Git revision) of the repository to update the file or directory from. The latest commit (in the default branch) is used by default.
For data obtained with
dvc import-url --version-aware, this option can be used to specify an object version ID. By default, the current version from cloud storage will be used.
revfield in the import
--recursive- determines the files to update by searching each target directory and its subdirectories for import
.dvcfiles to inspect. If there are no directories among the targets, this option has no effect.
--no-download- Update data checksums in the
checksumfields) without actually downloading the latest data. See
dvc import-url --no-downloador
dvc import --no-downloadfor more context. Cannot be used with
--to-remote- update a
.dvcfile created with
dvc import-urland transfer the data directly to remote storage (the default one unless one is specified with -r) without saving it locally. Use
dvc pullto get the data locally.
--remote <name>- name of the
dvc remote(can only be used with
--jobs <number>- parallelism level for DVC to download data from the source. The default value is
4 * cpu_count(). Using more jobs may speed up the operation.
--help- prints the usage/help message, and exit.
--quiet- do not write anything to standard output. Exit with 0 if no problems arise, otherwise 1.
--verbose- displays detailed tracing information.
Let's first import a data artifact from our get started example repo:
$ dvc import firstname.lastname@example.org:iterative/example-get-started model.pkl Importing 'model.pkl (email@example.com:iterative/example-get-started)' -> 'model.pkl'
As DVC mentions, the import stage (
model.pkl.dvc is created. This
stage is frozen by default though, so to
reproduce it, we would need to run
dvc unfreeze on it first, then
dvc repro (and
dvc freeze again). Let's
dvc update on it instead:
$ dvc update model.pkl.dvc Output 'model.pkl' didn't change. Skipping saving. Saving information to 'model.pkl.dvc'.
This time nothing has changed, since the source project is rather stable.
See also Importing and updating fixed revisions.
Let's import a model from a specific version of our get started example repo first:
$ dvc import --rev baseline-experiment \ firstname.lastname@example.org:iterative/example-get-started \ model.pkl Importing 'model.pkl (email@example.com:iterative/example-get-started)' -> 'model.pkl'
$ dvc update model.pkl.dvc
There was no output at all, meaning, the
model.pkl file was not updated. This
is because we tied the import stage to a
rev that hasn't changed
baseline-experiment tag points to a specific Git commit). Therefore, it
was not updated.
Let's try to update the model to a different version:
$ dvc update --rev bigrams-experiment model.pkl.dvc Importing 'model.pkl (firstname.lastname@example.org:iterative/example-get-started)' -> 'model.pkl'
The import stage is overwritten, and will get updated from the latest changes in
the given commit (tag