Open randomir opened 11 months ago
Description Storing sampling warnings (in SampleSet.info) renders sampleset JSON unserializable.
SampleSet.info
To Reproduce
>>> import json >>> import dimod >>> from dwave.system import EmbeddingComposite, DWaveSampler >>> from dwave.system.warnings import WarningAction >>> >>> bqm = dimod.BQM.from_ising({},{'ab': 1, 'bc': 1, 'ca': 1}) >>> sampler = EmbeddingComposite(DWaveSampler()) >>> >>> sampleset = sampler.sample(bqm, return_embedding=True, warnings=WarningAction.SAVE) >>> >>> json.dumps(sampleset.to_serializable()) Traceback (most recent call last): File "<stdin>", line 1, in <module> ... TypeError: Object of type type is not JSON serializable
Expected behavior json.dumps(sampleset.to_serializable()) should work.
json.dumps(sampleset.to_serializable())
Description Storing sampling warnings (in
SampleSet.info
) renders sampleset JSON unserializable.To Reproduce
Expected behavior
json.dumps(sampleset.to_serializable())
should work.