Skip to content

Wait for dvc lock using sleep cycle #2031

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

Closed
prihoda opened this issue May 21, 2019 · 5 comments
Closed

Wait for dvc lock using sleep cycle #2031

prihoda opened this issue May 21, 2019 · 5 comments
Labels
enhancement Enhances DVC p3-nice-to-have It should be done this or next sprint

Comments

@prihoda
Copy link
Contributor

prihoda commented May 21, 2019

Currently, we are waiting for the dvc lock file for 5 seconds and then fail if it is still not available. Would there be an issue with waiting for the lock using a sleep cycle with a defined refresh delay (~2s) and timeout (~2min or configurable)? Or are there some other long-term plans that would solve this problem?

This would be especially useful for the IntelliJ plugin or any other tool that calls DVC programmatically.

@efiop
Copy link
Contributor

efiop commented May 21, 2019

Might be missing something, but how is it different from just adjusting timeout from 5 seconds to 2 minutes?

@prihoda
Copy link
Contributor Author

prihoda commented May 21, 2019

Well if I understand it correctly, the _do_lock method will throw the LockError exception immediately if the lock is not available. Now we catch the LockError for the first time it happens, sleep for the provided timeout and then try again, this time failing for good if the lock is not available:

try:
    self._do_lock()
    return
except LockError:
    time.sleep(self.TIMEOUT)

self._do_lock()

@efiop
Copy link
Contributor

efiop commented May 21, 2019

Ah, you are right. For some reason, I've thought that we had a "true" timeout there. Thanks!

@prihoda
Copy link
Contributor Author

prihoda commented May 21, 2019

Anyway, from the IntelliJ plugin's side, I realized that at this moment it might actually be better to keep a queue of DVC commands and make sure that we are processing it sequentially. The only problem is that if we implement some smarter lock method that allows some commands to be run in parallel (e.g. using per-stage locking), the plugin would have to be aware of which commands can run in parallel and which can not.

@efiop
Copy link
Contributor

efiop commented May 21, 2019

@prihoda that would be a great way to go about it, especially considering that some commands like repro might run for longer than a pre-set timeout, so you would not be able to choose that timeout correctly beforehand.

@efiop efiop added p3-nice-to-have It should be done this or next sprint and removed p4 labels Sep 25, 2019
@efiop efiop closed this as completed Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC p3-nice-to-have It should be done this or next sprint
Projects
None yet
Development

No branches or pull requests

2 participants