Skip to content
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

command-reference/update: add docs for new --rev option #890

Closed
wants to merge 3 commits into from

Conversation

ilgooz
Copy link

@ilgooz ilgooz commented Jan 2, 2020

documentation of iterative/dvc#2993.

--

Disregard the recommendations below if you use Edit on GitHub button to improve the docs in place.

❗ Please read the guidelines in the Contributing to the Documentation list if you make any substantial changes to the documentation or JS engine.

🐛 Please make sure to mention Fix #issue (if applicable) in the description of the PR. This enables GitHub to link the PR to the corresponding bug and close it automatically when PR is merged.

Thank you for the contribution - we'll try to review and merge it as soon as possible. 🙏

@ilgooz ilgooz force-pushed the feature/command-update-rev branch from 38cebc2 to 99bd5b9 Compare January 2, 2020 13:26
@ilgooz ilgooz marked this pull request as ready for review January 2, 2020 13:27
@@ -39,6 +39,12 @@ to learn how to "update" fixed-revision imports.

## Options

- `--rev` - specific
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the note in the description above ... we should probably update it as well? does --rev override dvc import --rev, for example?

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done by 82c8b5c, can you please re-check?

- `--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 DVC repository to
update the data from. Repository's revision formed by the first import is used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we lock a specific revision for import-url or for dvc import something (no --rev)? It's not 100% clear.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a discussion for choosing a behavior here: iterative/dvc#2849 (comment)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed by 82c8b5c, can you please re-check?

Copy link
Member

@shcheklein shcheklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilgooz good stuff! thanks for updating the docs. Please, take a look at the comments. Also, it would be great to have an example to see the clear difference in the behavior.

Copy link
Contributor

@jorgeorpinel jorgeorpinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I have some comments, see below.

Also, see #890 (review)


I think we should revise the last paragraph in the description "... when the --rev (revision) option of dvc import has been used to create an import stage..." and/or add a new one explaining the relationship/interactions/cases when using --rev options in dvc import and then in dvc update again. If you can get that change started I can review the wording and phrasing if needed.

static/docs/command-reference/update.md Outdated Show resolved Hide resolved
static/docs/command-reference/update.md Outdated Show resolved Hide resolved
@jorgeorpinel
Copy link
Contributor

Oops it seems Ivan and myself did similar reviews simultaneously. Sorry 😬 I'll try to combine them.

@ilgooz
Copy link
Author

ilgooz commented Jan 4, 2020

Big thanks @jorgeorpinel! I'll continue with applying the requested changes once we figure out this one: iterative/dvc#2849 (comment)

@ilgooz
Copy link
Author

ilgooz commented Jan 4, 2020

@ilgooz good stuff! thanks for updating the docs. Please, take a look at the comments. Also, it would be great to have an example to see the clear difference in the behavior.

added an example by 82c8b5c but we need to create a new branch named v2 with updated source on the iterative/example-get-started repo to create new results.

-> 'model.pkl'
```

Since the source files has changed, we see the results of our "update".
Copy link
Author

@ilgooz ilgooz Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since the source files has changed, we see the results of our "update".
Since the source files are different at `v2` comparing to the currently locked revision, we see the side effects of our "update" as different results.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like

Suggested change
Since the source files has changed, we see the results of our "update".
This actually has an effect because the `model.pkl.dvc` file at tag `v2` points to different data that what's currently in the `rev_lock` field of the import stage.

Notice I also avoided the term "lock" here as well.
(Please rewrap.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also keep the entire

Note that dvc update updates the rev_lock field...

note here, at the end of the doc.

Copy link
Contributor

@jorgeorpinel jorgeorpinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phew! Sorry, lots of comments in this review, but we're getting there.

> In the above example, the value for `rev` in the new import stage will be
> `master`, which happens to be the default branch in this Git repository, so
> the command is equivalent to not using `--rev` at all.
moves (e.g. a branch), you may use `dvc update` preferably with `--rev` option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
moves (e.g. a branch), you may use `dvc update` preferably with `--rev` option
moves (e.g. a branch), you may use `dvc update`

Why "preferably with --rev option"?

> `master`, which happens to be the default branch in this Git repository, so
> the command is equivalent to not using `--rev` at all.
moves (e.g. a branch), you may use `dvc update` preferably with `--rev` option
to bring the data up to date. Using `--rev` also updates the fixed-revision.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to bring the data up to date. Using `--rev` also updates the fixed-revision.
to bring the data up to date.

Instead of that last sentence, I would keep some of the deleted text from above and change it a little bit. Somehing like:

For typically static references (e.g. tags), or for SHA commits, in order to update an import, it's necessary to use dvc update --rev with a different reference, as shown below. This will replace the rev field in the DVC-file (import stage).

$ dvc update --rev <new-ref> \
             [email protected]:iterative/dataset-registry.git \
             use-cases/cats-dogs

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that it should be consistent and title should be updated. It's not important to have "re-import" now. It def worth mentioning that it overwrites the file if you run it again, though. Not sure about the example section - let you decide :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for removing the "re-import" term everywhere then (including from the corresponding link hrefs).

@@ -7,7 +7,7 @@ repositories</abbr>, and corresponding
## Synopsis

```usage
usage: dvc update [-h] [-q | -v] targets [targets ...]
usage: dvc update [-h] [-q | -v] [--rev [REV]] targets [targets ...]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please break into 2 lines so there's no scroll bar on the rendered cmd ref:

Suggested change
usage: dvc update [-h] [-q | -v] [--rev [REV]] targets [targets ...]
usage: dvc update [-h] [-q | -v] [--rev [REV]]
targets [targets ...]

Comment on lines -30 to -38
Another detail to note is that when the `--rev` (revision) option of
`dvc import` has been used to create an import stage, DVC is not aware of what
kind of
[Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References) this
is, for example a branch or a tag. For typically static references (e.g. tags),
or for SHA commits, `dvc update` will not have any effect on the import. Refer
to the
[re-importing example](/doc/command-reference/import#example-fixed-revisions-re-importing)
to learn how to "update" fixed-revision imports.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole sentence

Another detail to note is that when the `--rev` (revision) option of
`dvc import` has been used to create an import stage, DVC is not aware of what
kind of
[Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References) this
is, for example a branch or a tag.

is still valid and informative, I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes I know I said we should revise this paragraph in #890 (comment) but didn't necessarily mean delete this sentence 🙂

to the
[re-importing example](/doc/command-reference/import#example-fixed-revisions-re-importing)
to learn how to "update" fixed-revision imports.
To "update" fixed-revision to static references (e.g. tags), or for SHA commits,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To "update" fixed-revision to static references (e.g. tags), or for SHA commits,
To update [fixed-revision](/doc/command-reference/import#example-fixed-revisions-re-importing) import stages (e.g. tags or SHA commits),

(Please rewrap to 80 chars.)

- `--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 DVC repository to
update the data from. Using this option also updates the fixed-revision.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this option also updates the fixed-revision.

OK but maybe we should explain what a fixed revision is and what exactly gets updated in the DVC-file (import stage), instead of using that term. Please lmk if you'd like some suggestions, I can def. help with the writing part if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For inspiration check out this not, found in the Examples section below:

Note that dvc update updates the rev_lock field of the corresponding DVC-file (when there are changes to bring in).

Comment on lines +77 to +78
To update from and also lock to a specific revision of a <abbr>data
artifact</abbr>, we may use the `--rev` option this time:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the examples! How about:

To force an update from a specific version of a data artifact, we may specify a Git revision with the --rev option:

for this sentence? And please wrap <abbr>data artifact</abbr> in the first paragraph of this whole Examples section instead (thanks for catching this.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(p.s. I think let's avoid the term "lock" here which results confusing given how it's previously used, and given our dvc lock command, among other types of locking in DVC.)

-> 'model.pkl'
```

Since the source files has changed, we see the results of our "update".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like

Suggested change
Since the source files has changed, we see the results of our "update".
This actually has an effect because the `model.pkl.dvc` file at tag `v2` points to different data that what's currently in the `rev_lock` field of the import stage.

Notice I also avoided the term "lock" here as well.
(Please rewrap.)

-> 'model.pkl'
```

Since the source files has changed, we see the results of our "update".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also keep the entire

Note that dvc update updates the rev_lock field...

note here, at the end of the doc.

@jorgeorpinel
Copy link
Contributor

OK so this is going stale. Should we close until iterative/dvc/pull/2993 is merged? Or just wait for now? @shcheklein

@shcheklein
Copy link
Member

@jorgeorpinel let's keep it open until we make some decision on the core project side, please. @ilgooz could you please address the comments in the dvc repo so that we can move this forward?

@shcheklein
Copy link
Member

closing this since the PR in the core repo is closed as stale

@shcheklein shcheklein closed this Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants