MolSSI / QCFractal

A distributed compute and database platform for quantum chemistry.
https://molssi.github.io/QCFractal/
BSD 3-Clause "New" or "Revised" License
144 stars 47 forks source link

ResultRecord.get_molecule() caching without client #665

Closed SimonBoothroyd closed 12 months ago

SimonBoothroyd commented 3 years ago

Is your feature request related to a problem? Please describe.

The ResultRecord.get_molecule() function currently checks for a client before checking to see if the molecule is already cached. This means that a client is required even when the local cache is available, and hence a REST call does not need to be made.

I ran into this issue when trying to store a record + it's associated molecule locally, and then loading and combining the two for use in some unit tests. In this case the cache is populated, but the client is not set.

Describe the solution you'd like

It would be good to move the client check inside of the if statement which is triggered when the molecule is not in the cache.

Describe alternatives you've considered

My current workaround is to just monkey patch the client check inside the unit tests to return true regardless if the client is present. There maybe be a more canonical way to handle this however that I'm not aware of, so please let me know if this is the case.

Additional context

bennybp commented 12 months ago

This behavior is much improved in v0.50, and should handle disconnected records