Closed RobertArbon closed 7 years ago
As mentioned in #221, I like the idea of adding an is_json_serializable
method. It should at least remedy cases 1, 3, and 4. We should be able to fix case 2 by casting jump variables to int
from the get-go.
Thanks again for the thorough debugging!
done in #223 and #224
in
osprey/execute_worker.py
:There's an error when calling
session.commit()
I always seem to get something like:raise TypeError(repr(o) + " is not JSON serializable")
I think it's to do with the types which get put in the
params
dictionary. I've identified these cases which it fails:msmbuilder.feature_selection.FeatureSelector
object - thefeatures
parameters is anOrderedDict
.jump
type variables. The call tonp.linspace
createsnumpy.int64
(say) variables.atom_indices
parameters in, for exampleAtomPairsFeaturizer
, is anumpy.ndarray
object.ref_traj
parameter in , for example,RawPositionsFeaturizer
, is amdtraj.Trajectory
object.I've made this rather hacky attempt at a fix:
Which seems to work. But perhaps there's a better solution. Maybe cast all data types to native python types before they get put in the estimator and then just have a simple call to a function which generically checks whether the object is serializable:
This pertains to at least the following issues:
https://github.com/msmbuilder/osprey/issues/221
https://github.com/msmbuilder/osprey/issues/218