Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings unserializable #509

Open
randomir opened this issue Dec 5, 2023 · 0 comments
Open

Warnings unserializable #509

randomir opened this issue Dec 5, 2023 · 0 comments

Comments

@randomir
Copy link
Member

randomir commented Dec 5, 2023

Description
Storing sampling warnings (in SampleSet.info) renders sampleset JSON unserializable.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant