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

Method wait

dwave/cloud/computation.py:409–444  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

_load_resultMethod · 0.95
wait_multipleMethod · 0.45
wait_idMethod · 0.45
postMethod · 0.45
postMethod · 0.45
getMethod · 0.45
_blocking_pollMethod · 0.45
_blocking_loadMethod · 0.45
gated_decoderMethod · 0.45
test_fallbackMethod · 0.45
beeMethod · 0.45

Calls

no outgoing calls

Tested by 13

postMethod · 0.36
postMethod · 0.36
getMethod · 0.36
_blocking_pollMethod · 0.36
_blocking_loadMethod · 0.36
gated_decoderMethod · 0.36
test_fallbackMethod · 0.36
beeMethod · 0.36
test_prioritizationMethod · 0.36
test_successMethod · 0.36
authorizeMethod · 0.36