From d55aff9aeeb79ac754d30fbdedcfc980516216bc Mon Sep 17 00:00:00 2001 From: Masahito Kumagai <55102763+kumagaimasahito@users.noreply.github.com> Date: Tue, 10 Dec 2019 20:45:40 +0900 Subject: [PATCH 1/3] add __del__ into the DWaveSampler --- dwave/system/samplers/dwave_sampler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwave/system/samplers/dwave_sampler.py b/dwave/system/samplers/dwave_sampler.py index ae3cf3c2..873ecbf1 100644 --- a/dwave/system/samplers/dwave_sampler.py +++ b/dwave/system/samplers/dwave_sampler.py @@ -163,6 +163,8 @@ def __init__(self, failover=False, retry_interval=-1, **config): self.failover = failover self.retry_interval = retry_interval + def __del__(self): + self.client.close() @property def properties(self): From 77b52b3a31a4f91348c31fb9e14dc75df331835d Mon Sep 17 00:00:00 2001 From: Masahito Kumagai <55102763+kumagaimasahito@users.noreply.github.com> Date: Fri, 13 Dec 2019 21:00:32 +0900 Subject: [PATCH 2/3] Update dwave_sampler.py --- dwave/system/samplers/dwave_sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwave/system/samplers/dwave_sampler.py b/dwave/system/samplers/dwave_sampler.py index 873ecbf1..6acafdcc 100644 --- a/dwave/system/samplers/dwave_sampler.py +++ b/dwave/system/samplers/dwave_sampler.py @@ -79,7 +79,7 @@ def wrapper(sampler, *args, **kwargs): return wrapper -class DWaveSampler(dimod.Sampler, dimod.Structured): +class DWaveSampler2(dimod.Sampler, dimod.Structured): """A class for using the D-Wave system as a sampler. Uses parameters set in a configuration file, as environment variables, or From 849e25e8bfe3a88ae5a9ce50c7ac87600632f158 Mon Sep 17 00:00:00 2001 From: Masahito Kumagai <55102763+kumagaimasahito@users.noreply.github.com> Date: Fri, 13 Dec 2019 21:05:47 +0900 Subject: [PATCH 3/3] add __del__ for client.close --- dwave/system/samplers/dwave_sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwave/system/samplers/dwave_sampler.py b/dwave/system/samplers/dwave_sampler.py index 6acafdcc..873ecbf1 100644 --- a/dwave/system/samplers/dwave_sampler.py +++ b/dwave/system/samplers/dwave_sampler.py @@ -79,7 +79,7 @@ def wrapper(sampler, *args, **kwargs): return wrapper -class DWaveSampler2(dimod.Sampler, dimod.Structured): +class DWaveSampler(dimod.Sampler, dimod.Structured): """A class for using the D-Wave system as a sampler. Uses parameters set in a configuration file, as environment variables, or