dwave.cloud.client.Client.close#

Client.close()[source]#

Perform a clean shutdown.

Waits for all the currently scheduled work to finish, kills the workers, and closes the connection pool.

Note

Ensure your code does not submit new work while the connection is closing.

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 (based on an auto-detected configuration file), 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()