ihmwg / python-ihm

Python package for handling IHM mmCIF and BinaryCIF files
MIT License
14 stars 7 forks source link

Avoid hitting the network in MRCParser #34

Closed benmwebb closed 5 years ago

benmwebb commented 5 years ago

When we use ihm.metadata.MRCParser to parse an MRC file, if it determines that the file is deposited in EMDB, it uses the EMDB web API to extract additional information. This suffers from two problems:

  1. If the website is down or the network is unavailable (e.g. a modeling simulation being run on an internal compute cluster) this will raise an exception, killing the job.
  2. If the parser's output ends up not being used then this network access was unnecessary.

Proposal:

  1. Populate the additional information lazily, only when we actually come to write out the mmCIF file.
  2. Catch network errors, report default information in this case, and give a warning instead.