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

Deal gracefully with connection problems to remote repositories #4

Closed
marcenko opened this issue Apr 15, 2021 · 4 comments
Closed

Deal gracefully with connection problems to remote repositories #4

marcenko opened this issue Apr 15, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@marcenko
Copy link
Contributor

Will retrieve a list of gene acronyms from Allen Atlas now.
This may take a minute.
Traceback (most recent call last):
   File "aioserver.py", line 25, in <module>
     import brainscapes
   File "/webjugex/brainscapes/brainscapes/__init__.py", line 24, in
<module>
     from .atlas import REGISTRY as atlases
   File "/webjugex/brainscapes/brainscapes/atlas.py", line 21, in <module>
     from . import parcellations, spaces, features, logger
   File "/webjugex/brainscapes/brainscapes/features/__init__.py", line
30, in <module>
     extractor_types,gene_names,modalities = __init__()
   File "/webjugex/brainscapes/brainscapes/features/__init__.py", line
22, in __init__
     from .genes import AllenBrainAtlasQuery
   File "/webjugex/brainscapes/brainscapes/features/genes.py", line 65,
in <module>
     class AllenBrainAtlasQuery(FeatureExtractor):
   File "/webjugex/brainscapes/brainscapes/features/genes.py", line 123,
in AllenBrainAtlasQuery
     +"This may take a minute."))
   File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
     return _default_decoder.decode(s)
   File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
     raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Happens quite seldom, but we should maybe catch the error if it happens.

---------- old comments ---------
Dickscheid, Timo

This is a very general thing. How shall we deal with a situation where the remote repositories could not be reached? Brainscapes works offline with cached data, but without a network connection on initial setup it doesn't quite make sense to use brainscapes. To be discussed, any opinions?

To provide a suggestion, I would distinguish some cases:

  1. Remote configuration of brainscapes cannot be retrieved - fail with an exception, ask to check neetwork connection. No reasonable use of brainscapes will be possible.
  2. Retrieval of certain data features fails, as in this issue. I would print a warning about the problem but continue, with this feature type missing.

However, 2. has implications for the cache. We need to make sure we do not store an empty cache item that will be re-opened later on. If no cache item is generated, brainscapes will try to run the query again next time.

@dickscheid
Copy link
Contributor

The gene names are now stored with the source code for efficiency.

@dickscheid dickscheid added the bug Something isn't working label Apr 20, 2021
@dickscheid dickscheid changed the title Error on populating the cache (probably related to gene-data from Allen Brain API) Deal gracefully with connection problems to remote repositories Apr 20, 2021
@dickscheid dickscheid added help wanted enhancement New feature or request and removed bug Something isn't working help wanted labels Apr 20, 2021
@skoehnen
Copy link
Contributor

skoehnen commented Apr 20, 2021

The gene names are now stored with the source code for efficiency.

Hmm, not sure what you mean here.
My understanding is that gene labels are subject to change, we shouldn't hard-code them.

@dickscheid
Copy link
Contributor

dickscheid commented Apr 20, 2021

If they change very frequently, we need to add them to the caching mechanism but remove them from the package loading sequence. If they change rarely, I still consider it a good solution to save them statically with the code. They are nonly used for autocompletion, so if the list is slightly outdated at times that's not really a problem, but we need to organize the maintenance. Do you have an estimate of the frequency of changes to the gene names?

@dickscheid
Copy link
Contributor

should be adressed together with #22, will extend #22 and close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants