-
Notifications
You must be signed in to change notification settings - Fork 406
cmd-ref: document --rev option on update #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,8 +62,7 @@ To actually [track the data](https://dvc.org/doc/get-started/add-files), | |
| `git add` (and `git commit`) the import stage. | ||
|
|
||
| Note that import stages are considered always locked, meaning that if you run | ||
| `dvc repro`, they won't be updated. Use `dvc update` or | ||
| [re-import](#example-fixed-revisions-re-importing) them to update the downloaded | ||
| `dvc repro`, they won't be updated. Use `dvc update` to update the downloaded | ||
| data artifact from the source repo. | ||
|
|
||
| ## Options | ||
|
|
@@ -130,7 +129,7 @@ Several of the values above are pulled from the original stage file | |
| subfields under `repo` are used to save the origin and version of the | ||
| dependency, respectively. | ||
|
|
||
| ## Example: Fixed revisions & re-importing | ||
| ## Example: Fixed revisions and updating to different revision | ||
|
|
||
| To import a specific version of a <abbr>data artifact</abbr>, we may use the | ||
| `--rev` option: | ||
|
|
@@ -160,23 +159,14 @@ deps: | |
| If `rev` is a Git branch or tag (where the underlying commit changes), the data | ||
| source may have updates at a later time. To bring it up to date if so (and | ||
| update `rev_lock` in the DVC-file), simply use `dvc update <stage>.dvc`. If | ||
| `rev` is a specific commit hash (does not change), `dvc update` will never have | ||
| an effect on the import stage. You may **re-import** a different commit instead, | ||
| by using `dvc import` again with a different (or without) `--rev`. For example: | ||
| `rev` is a specific commit (does not change), `dvc update` will never have an | ||
| effect on the import stage. You may `dvc update` to a different commit, using | ||
| `--rev`: | ||
|
|
||
| ```dvc | ||
| $ dvc import --rev master \ | ||
| git@github.com:iterative/dataset-registry.git \ | ||
| use-cases/cats-dogs | ||
| $ dvc update --rev cats-dogs-v2 | ||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| The import stage is overwritten, and will now be able update normally with | ||
| `dvc update`. | ||
|
|
||
| > In the above example, the value for `rev` in the new import stage will be | ||
| > `master` (default branch), so the command is equivalent to not using `--rev` | ||
| > at all. | ||
|
Comment on lines
-173
to
-178
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This info is still useful if using --rev master above, just a little different: > In the above example, the value for `rev` in the new import stage will be
> `master` (a branch) so it will be able update normally going forward. |
||
|
|
||
| ## Example: Data registry | ||
|
|
||
| If you take a look at our | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ projects</abbr>, and corresponding [DVC-files](/doc/user-guide/dvc-file-format). | |||||||||||||||||||||||||||||||||
| ## Synopsis | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```usage | ||||||||||||||||||||||||||||||||||
| usage: dvc update [-h] [-q | -v] targets [targets ...] | ||||||||||||||||||||||||||||||||||
| usage: dvc update [-h] [-q | -v] [--rev [REV]] targets [targets ...] | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| positional arguments: | ||||||||||||||||||||||||||||||||||
| targets DVC-files to update. | ||||||||||||||||||||||||||||||||||
|
|
@@ -27,20 +27,32 @@ Note that import stages are considered always locked, meaning that if you run | |||||||||||||||||||||||||||||||||
| update them. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| `dvc update` will not have an effect on import stages that are fixed to a commit | ||||||||||||||||||||||||||||||||||
| hash (`rev` field in the DVC-file). Please refer to | ||||||||||||||||||||||||||||||||||
| [Fixed revisions & re-importing](/doc/command-reference/import#example-fixed-revisions-re-importing) | ||||||||||||||||||||||||||||||||||
| for more details. | ||||||||||||||||||||||||||||||||||
| hash (`rev` field in the DVC-file). To update the imported artifacts to a | ||||||||||||||||||||||||||||||||||
| certain revision, `--rev` with specified revision can be used. | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```dvc | ||||||||||||||||||||||||||||||||||
| dvc update --rev master | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Options | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - `--rev` - specific | ||||||||||||||||||||||||||||||||||
| [Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References) | ||||||||||||||||||||||||||||||||||
| (such as a branch name, a tag, or a commit hash) of the repository to update | ||||||||||||||||||||||||||||||||||
| the file or directory from (also starts tracking the given revision). | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| > Note that this adds or updates a `rev` field in the DVC-file that fixes it | ||||||||||||||||||||||||||||||||||
| > to this revision (and updates `rev_lock` in the DVC-file). This can have an | ||||||||||||||||||||||||||||||||||
| > impact on the behavior of `dvc update` later. | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets just copy this from import:
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - `-h`, `--help` - prints the usage/help message, and exit. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if no | ||||||||||||||||||||||||||||||||||
| problems arise, otherwise 1. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - `-v`, `--verbose` - displays detailed tracing information. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Examples | ||||||||||||||||||||||||||||||||||
| ## Example: Updating imported artifacts | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Let's first import a data artifact from our | ||||||||||||||||||||||||||||||||||
| [get started example repo](https://github.com/iterative/example-get-started): | ||||||||||||||||||||||||||||||||||
|
|
@@ -69,3 +81,41 @@ stable. | |||||||||||||||||||||||||||||||||
| > Note that `dvc update` updates the `rev_lock` field of the corresponding | ||||||||||||||||||||||||||||||||||
| > [DVC-file](/doc/user-guide/dvc-file-format) (when there are changes to bring | ||||||||||||||||||||||||||||||||||
| > in). | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Example: Updating imported artifacts to a specified revision | ||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
And explain what fixed revision is in the first p. Again, maybe just copy the example from |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Let's import a data artifact from an older commit from our | ||||||||||||||||||||||||||||||||||
jorgeorpinel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| [get started example repo](https://github.com/iterative/example-get-started) at | ||||||||||||||||||||||||||||||||||
| first: | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```dvc | ||||||||||||||||||||||||||||||||||
| $ dvc import --rev baseline-experiment git@github.com:iterative/example-get-started model.pkl | ||||||||||||||||||||||||||||||||||
| Importing 'model.pkl (git@github.com:iterative/example-get-started)' | ||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to include obvious outputs
This comment was marked as resolved.
Sorry, something went wrong. |
||||||||||||||||||||||||||||||||||
| -> 'model.pkl' | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| After this, the import stage (DVC-file) `model.pkl.dvc` is created. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Let's try to run `dvc update` on the given stage file, and see what happens. | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```dvc | ||||||||||||||||||||||||||||||||||
| $ 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 with a `rev` that never changes (i.e. tag | ||||||||||||||||||||||||||||||||||
| is tied to a specific commit). Therefore, it was not updated. | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Let's try to update the model to a different experiment `bigrams-experiment`: | ||||||||||||||||||||||||||||||||||
skshetry marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```dvc | ||||||||||||||||||||||||||||||||||
| $ dvc update --rev bigrams-experiment model.pkl.dvc | ||||||||||||||||||||||||||||||||||
| Importing 'model.pkl (git@github.com:iterative/example-get-started)' | ||||||||||||||||||||||||||||||||||
| -> 'model.pkl' | ||||||||||||||||||||||||||||||||||
jorgeorpinel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| The import stage is overwritten, and will get updated from the latest changes in | ||||||||||||||||||||||||||||||||||
| the given revision (i.e. `bigrams-experiment` tag). | ||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. given commit (tag `bigrams-experiment) |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| > In the above example, the value for `rev` in the new import stage will be | ||||||||||||||||||||||||||||||||||
| > `bigrams-experiment`. | ||||||||||||||||||||||||||||||||||
jorgeorpinel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.