dwavesystems / dwavesystems/dwave-system
Warnings unserializable
- Dominant language
- Python
- Stars
- 98
- Forks
- 67
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
**Description**
Storing sampling warnings (in `SampleSet.info`) renders sampleset JSON unserializable.
**To Reproduce**
```python
>>> 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 "", line 1, in
...
TypeError: Object of type type is not JSON serializable
```
**Expected behavior**
`json.dumps(sampleset.to_serializable())` should work.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.