Wait for the solver to receive a response for a submitted problem. Blocking call that waits for a :class:`Future` object to complete. Args: timeout (float, optional, default=None): Maximum number of seconds to await completion. If None, waits
(self, timeout=None)
| 407 | yield f |
| 408 | |
| 409 | def wait(self, timeout=None): |
| 410 | """Wait for the solver to receive a response for a submitted problem. |
| 411 | |
| 412 | Blocking call that waits for a :class:`Future` object to complete. |
| 413 | |
| 414 | Args: |
| 415 | timeout (float, optional, default=None): |
| 416 | Maximum number of seconds to await completion. If None, waits |
| 417 | indefinitely. |
| 418 | |
| 419 | Returns: |
| 420 | Boolean: True if solver received a response. |
| 421 | |
| 422 | Examples: |
| 423 | This example creates a solver using the local system's default |
| 424 | D-Wave Cloud Client configuration file, submits a simple QUBO |
| 425 | problem to a remote D-Wave resource for 100 samples, and tries |
| 426 | waiting for 10 seconds for sampling to complete. |
| 427 | |
| 428 | >>> from dwave.cloud import Client |
| 429 | >>> client = Client.from_config() # doctest: +SKIP |
| 430 | >>> solver = client.get_solver() # doctest: +SKIP |
| 431 | >>> u, v = next(iter(solver.edges)) # doctest: +SKIP |
| 432 | >>> Q = {(u, u): -1, (u, v): 0, (v, u): 2, (v, v): -1} # doctest: +SKIP |
| 433 | >>> computation = solver.sample_qubo(Q, num_reads=100) # doctest: +SKIP |
| 434 | >>> computation.wait(timeout=10) # doctest: +SKIP |
| 435 | False |
| 436 | >>> computation.remote_status # doctest: +SKIP |
| 437 | 'IN_PROGRESS' |
| 438 | >>> computation.wait(timeout=10) # doctest: +SKIP |
| 439 | True |
| 440 | >>> computation.remote_status # doctest: +SKIP |
| 441 | 'COMPLETED' |
| 442 | >>> client.close() # doctest: +SKIP |
| 443 | """ |
| 444 | return self._results_ready_event.wait(timeout) |
| 445 | |
| 446 | def done(self): |
| 447 | """Check whether the solver received a response for a submitted problem. |
no outgoing calls