MolSSI/QCArchiveExamples

Internal server error

Closed this issue · 3 comments

RMeli commented

Running the molecules.ipynb locally results in a OSError: Server communication failure. Reason: Internal Server Error when executing the following cell (in the From a Dataset section):

molecules = ds.get_molecules()
molecules

The following code reproduces the issue outside of the Jupyter notebookL

import qcportal as ptl
client = ptl.FractalClient()

ds = client.get_collection("Dataset", "SMIRNOFF Coverage Set 1")

molecules = ds.get_molecules()

Full stack trace:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-7-9e5ab07f5cc6> in <module>
----> 1 molecules = ds.get_molecules()
      2 molecules

~/miniconda3/envs/chemgen/lib/python3.9/site-packages/qcportal/collections/dataset.py in get_molecules(self, subset, force)
   1548         """
   1549         indexer = self._molecule_indexer(subset=subset, force=force)
-> 1550         df = self._get_molecules(indexer, force)
   1551 
   1552         if isinstance(subset, str):

~/miniconda3/envs/chemgen/lib/python3.9/site-packages/qcportal/collections/dataset.py in _get_molecules(self, indexer, force)
   1074             molecules: List["Molecule"] = []
   1075             for i in range(0, len(molecule_ids), self.client.query_limit):
-> 1076                 molecules.extend(self.client.query_molecules(id=molecule_ids[i : i + self.client.query_limit]))
   1077             # XXX: molecules = pd.DataFrame({"molecule_id": molecule_ids, "molecule": molecules}) fails
   1078             #      test_gradient_dataset_get_molecules and I don't know why

~/miniconda3/envs/chemgen/lib/python3.9/site-packages/qcportal/client.py in query_molecules(self, id, molecule_hash, molecular_formula, limit, skip, full_return)
    407             "data": {"id": id, "molecule_hash": molecule_hash, "molecular_formula": molecular_formula},
    408         }
--> 409         response = self._automodel_request("molecule", "get", payload, full_return=full_return)
    410         return response
    411 

~/miniconda3/envs/chemgen/lib/python3.9/site-packages/qcportal/client.py in _automodel_request(self, name, rest, payload, full_return, timeout)
    272             raise TypeError(str(exc))
    273 
--> 274         r = self._request(rest, name, data=payload.serialize(self.encoding), timeout=timeout)
    275         encoding = r.headers["Content-Type"].split("/")[1]
    276         response = response_model.parse_raw(r.content, encoding=encoding)

~/miniconda3/envs/chemgen/lib/python3.9/site-packages/qcportal/client.py in _request(self, method, service, data, noraise, timeout)
    234 
    235         if (r.status_code != 200) and (not noraise):
--> 236             raise IOError("Server communication failure. Reason: {}".format(r.reason))
    237 
    238         return r

OSError: Server communication failure. Reason: Internal Server Error

The reminder of the notebook seems to run smoothly.

I found the error in the server logs. This is due to an incompatibility with how the molecules are stored vs. new versions of QCPortal.

I already have a migration queued up for fixing other issues like this, so I will add a fix for this there

RMeli commented

Amazing, thanks @bennybp !

RMeli commented

This is now fixed with MolSSI/QCFractal#676. Thanks @bennybp !