dwave.cloud.client.Client.close#
- Client.close(wait: bool | None = None)[source]#
Perform a clean shutdown.
Waits for all the currently scheduled work to finish, kills the workers, and closes the connection pool.
- Parameters:
wait –
When set to true (the default), allow all (remote) jobs to finish and their results to be downloaded before shutting down the client. New jobs are never accepted while closing.
Added in version 0.14.0: The
wait
parameter. By default, we now wait for all jobs to finish on client close.
Where possible, it is recommended you use a context manager (a
with Client.from_config(...) as
construct) to ensure your code properly closes all resources.Examples
This example creates a client, executes some code (represented by a placeholder comment), and then closes the client.
>>> from dwave.cloud import Client >>> client = Client.from_config() >>> # code that uses client >>> client.close()