MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / sampleset

Method sampleset

dwave/cloud/computation.py:835–862  ·  view source on GitHub ↗

Return :class:`~dimod.SampleSet` representation of the results. Adds a `.wait_id` method to retrieve the id before the sampleset is resolved.

(self)

Source from the content-addressed store, hash-verified

833
834 @property
835 def sampleset(self):
836 """Return :class:`~dimod.SampleSet` representation of the results.
837
838 Adds a `.wait_id` method to retrieve the id before the sampleset is
839 resolved.
840 """
841
842 try:
843 import dimod
844 except ImportError:
845 raise RuntimeError("Can't construct SampleSet without dimod. "
846 "Re-install the library with 'bqm' support.")
847
848 # check if sampleset already resolved
849 sampleset = self._sampleset() if self._sampleset else None
850 if sampleset is not None:
851 return sampleset
852
853 sampleset = dimod.SampleSet.from_future(self, lambda f: f.wait_sampleset())
854
855 if not hasattr(sampleset, 'wait_id'):
856 # the id is stored in the info field, but to be consistent with the
857 # samplesets constructed .from_future, we add the method as well
858 # note: sampleset has .wait_id() since dimod 0.12.18+, but we want
859 # to support older dimods as well
860 sampleset.wait_id = self.wait_id
861
862 return sampleset
863
864 @property
865 def timing(self):

Callers

nothing calls this directly

Calls 1

wait_samplesetMethod · 0.80

Tested by

no test coverage detected