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

gdrive: a pair of cleanup refactors (upstream branch) #3382

Merged
merged 2 commits into from
Feb 23, 2020
Merged

Conversation

Suor
Copy link
Contributor

@Suor Suor commented Feb 22, 2020

No description provided.

Employ @Retry(filter_errors) and @wrap_prop() to pack things up a bit.
- cache root transparently
- make cache dirs and ids symmetric, i.e. both using full paths
- implement .list_cache_paths() instead of .all() like in the rest of
the remotes
@codecov
Copy link

codecov bot commented Feb 22, 2020

Codecov Report

Merging #3382 into master will increase coverage by 0.06%.
The diff coverage is 92.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3382      +/-   ##
==========================================
+ Coverage   92.96%   93.03%   +0.06%     
==========================================
  Files         140      140              
  Lines        8515     8480      -35     
==========================================
- Hits         7916     7889      -27     
+ Misses        599      591       -8
Impacted Files Coverage Δ
dvc/remote/gdrive.py 87.74% <92.18%> (+1.97%) ⬆️
dvc/updater.py 54.65% <0%> (-1.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5101bf1...121bce7. Read the comment docs.

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.

Thanks @Suor , good cleanup! Let's cross some checkboxes from the #2865 :)

@efiop efiop merged commit 3a5e588 into master Feb 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the gdrive-pretty branch February 23, 2020 04:11
@@ -41,30 +38,18 @@ def __init__(self, path):
)


@decorator
def _wrap_pydrive_retriable(call):
def gdrive_retry(func):
from pydrive2.files import ApiRequestError
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I'm now getting:

Traceback (most recent call last):
  File "/home/efiop/.pyenv/versions/3.7.0-dvc/bin/dvc", line 8, in <module>
    from dvc.main import main                             
  File "/home/efiop/git/dvc/dvc/main.py", line 6, in <module>           
    from dvc import analytics                 
  File "/home/efiop/git/dvc/dvc/analytics.py", line 17, in <module>    
    from dvc.repo import Repo      
  File "/home/efiop/git/dvc/dvc/repo/__init__.py", line 18, in <module>     
    from dvc.remote.base import RemoteActionNotImplemented
  File "/home/efiop/git/dvc/dvc/remote/__init__.py", line 5, in <module>   
    from dvc.remote.gdrive import RemoteGDrive
  File "/home/efiop/git/dvc/dvc/remote/gdrive.py", line 70, in <module>
    class RemoteGDrive(RemoteBASE):
  File "/home/efiop/git/dvc/dvc/remote/gdrive.py", line 207, in RemoteGDrive
    progress_name="",             
  File "/home/efiop/git/dvc/dvc/remote/gdrive.py", line 42, in gdrive_retry
    from pydrive2.files import ApiRequestError
ModuleNotFoundError: No module named 'pydrive2'              

it wasn't triggered before, not sure what went wrong.

Copy link
Member

Choose a reason for hiding this comment

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

@efiop how do you reproduce this? I tried with some simple tests and was not able to get this error 🤔

I'm getting it if GDrive support is not enabled. Which means the we don't catch and transform the error properly (or what other mechanism do we use to give users instructions on how to install remote support?)

  File "/Users/ivan/Projects/dvc/.env/bin/dvc", line 8, in <module>
    from dvc.main import main
  File "/Users/ivan/Projects/dvc/dvc/main.py", line 6, in <module>
    from dvc import analytics
  File "/Users/ivan/Projects/dvc/dvc/analytics.py", line 17, in <module>
    from dvc.repo import Repo
  File "/Users/ivan/Projects/dvc/dvc/repo/__init__.py", line 18, in <module>
    from dvc.remote.base import RemoteActionNotImplemented
  File "/Users/ivan/Projects/dvc/dvc/remote/__init__.py", line 5, in <module>
    from dvc.remote.gdrive import RemoteGDrive
  File "/Users/ivan/Projects/dvc/dvc/remote/gdrive.py", line 70, in <module>
    class RemoteGDrive(RemoteBASE):
  File "/Users/ivan/Projects/dvc/dvc/remote/gdrive.py", line 207, in RemoteGDrive
    progress_name="",
  File "/Users/ivan/Projects/dvc/dvc/remote/gdrive.py", line 42, in gdrive_retry
    from pydrive2.files import ApiRequestError
ModuleNotFoundError: No module named 'pydrive2'

No error if DVC is installed with [all,test].

Copy link
Contributor

Choose a reason for hiding this comment

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

@shcheklein Getting that error from any dvc command when pydrive is not installed. Not even trying to push to pydrive or anything. Looks like python tries to run that code for some strange reason.

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