dwave.cloud.computation.Future.wait#
- Future.wait(timeout=None)[source]#
Wait for the solver to receive a response for a submitted problem.
Blocking call that waits for a
Future
object to complete.- Parameters:
timeout (float, optional, default=None) – Maximum number of seconds to await completion. If None, waits indefinitely.
- Returns:
True if solver received a response.
- Return type:
Boolean
Examples
This example creates a solver using the local system’s default D-Wave Cloud Client configuration file, submits a simple QUBO problem to a remote D-Wave resource for 100 samples, and tries waiting for 10 seconds for sampling to complete.
>>> from dwave.cloud import Client >>> client = Client.from_config() >>> solver = client.get_solver() >>> u, v = next(iter(solver.edges)) >>> Q = {(u, u): -1, (u, v): 0, (v, u): 2, (v, v): -1} >>> computation = solver.sample_qubo(Q, num_reads=100) >>> computation.wait(timeout=10) False >>> computation.remote_status 'IN_PROGRESS' >>> computation.wait(timeout=10) True >>> computation.remote_status 'COMPLETED' >>> client.close()