-
Notifications
You must be signed in to change notification settings - Fork 1.2k
dvc: move repo lock from CLI to API #2519
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
Conversation
|
I don't think flufl locks are reentrable, you will need to make extra effort to provide that. |
|
@Suor Maybe I'm missing something, but our locks were never reentarable. Or are you talking about us wanting that in the upcoming patches related to stage locks? |
|
I see you don't lock pull, a composite command. Is it safe though? Some other call might get in between and remove freshly downloaded files. |
|
Or target stage might be modified/removed between the locks. |
|
@Suor Great points! I'll adjust that using intermediate |
|
@efiop I would say making locks or just |
|
@Suor Btw found the bug in |
|
@Suor I would really preferer not to use reenterable locks as long as I can. Non-reenterable locks help find bugs, as they pose very strict requirements. But I'll definitely take a look. Thanks 🙂 |
For the longest time we've had `repo.lock`, but were only using it from CLI when running specific command, instead of simply properly taking it on API operations. This patch takes care of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what kind of bugs non-reentrable locks will prevent. Not permitting calling one api call form another one? Do we want that?
The code complications are not big for now, though.
| ret = cmd.run_cmd() | ||
| ret = cmd.run() | ||
| except LockError: | ||
| logger.exception("failed to lock before running a command") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we show more descriptive and actionable message? Like what is happening, i.e. that some concurrent dvc command is blocking. And if that is not so then what lock files should people remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@Suor The initial idea was that it would protect from re-collecting the DAG, but, as we've seen with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
For the longest time we've had
repo.lock, but were only using it fromCLI when running specific command, instead of simply properly taking it
on API operations. This patch takes care of that.
Related to #755
Have you followed the guidelines in our
Contributing document?
Does your PR affect documented changes or does it add new functionality
that should be documented? If yes, have you created a PR for
dvc.org documenting it or at
least opened an issue for it? If so, please add a link to it.