dwave.cloud.computation.Future.cancel

Future.cancel()[source]

Try to cancel the problem corresponding to this result.

Non-blocking call to the remote resource in a best-effort attempt to prevent execution of a problem.

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 (and in this case succeeds) to cancel it.

>>> 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)   # doctest: +SKIP
>>> computation.cancel()  # doctest: +SKIP
>>> computation.done()   # doctest: +SKIP
True
>>> computation.remote_status    # doctest: +SKIP
u'CANCELLED'
>>> client.close()