src-d / modelforge

Python library to share machine learning models easily and reliably.
Apache License 2.0
18 stars 13 forks source link

Bad github credentials leaves cache in an unstable state #90

Closed glimow closed 5 years ago

glimow commented 5 years ago

When the github auth fails (for example when given bad credentials), modelforge's cache is left in an unstable state. Further attempts to upload a model fail, even given the right credentials, with the following error:

Traceback (most recent call last):
 File "/home/tristan/.pyenv/versions/3.6.0/bin/modelforge", line 10, in <module>
   sys.exit(main())
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/modelforge/__main__.py", line 122, in main
   return handler(args)
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/modelforge/registry.py", line 97, in list_models
   password=args.password, cache=args.cache, log_level=args.log_level)
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/modelforge/index.py", line 83, in __init__
   self.fetch()
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/modelforge/index.py", line 110, in fetch
   if self._are_local_and_remote_heads_different():
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/modelforge/index.py", line 250, in _are_local_and_remote_heads_different
   local_head = Repo(self.cached_repo).head()
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/dulwich/repo.py", line 459, in head
   return self.refs[b'HEAD']
 File "/home/tristan/.pyenv/versions/3.6.0/lib/python3.6/site-packages/dulwich/refs.py", line 284, in __getitem__
   raise KeyError(name)
KeyError: b'HEAD'

Manually deleting the cache solves the problem. Version: 0.12.1

vmarkovtsev commented 5 years ago

@warenlg This looks familiar. Have you caught a similar problem lately?

warenlg commented 5 years ago

Yes I met this when I was passing a bad --index-repo for instance, but it did not prevent me from publishing the model later on passing the right config.