-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add close()
to all QPU and hybrid samplers
#554
Add close()
to all QPU and hybrid samplers
#554
Conversation
@arcondello, @JoelPasvolsky: cloud-client release might be a few days away, but you might want to take a preliminary look. |
Can you give some more context: the description in #77 leaves a bit to be desired. Is it a problem of users repeatedly instantiating new samplers? If so, couldn't instantiation of a sampler (e.g., |
@JoelPasvolsky, each instance of a sampler should be closed after use. Similarly to An immediate follow-up to this PR will be #91, a context manager support for samplers. Similarly to Typical abuse pattern is: def solve(problem):
bqm = create_bqm_from_problem(problem)
sampler = DWaveSampler()
return sampler.sample(bqm)
for p in problems:
t = threading.Thread(worker=solve, args=[p])
t.start() now (or after #91 rather) users will be able to do: def solve(problem):
bqm = create_bqm_from_problem(problem)
with DWaveSampler() as sampler:
return sampler.sample(bqm) (if using a shared sampler is not an option) |
a4209e8
to
ee047a0
Compare
18c7681
to
43852ce
Compare
740574f
to
312b89f
Compare
Co-authored-by: Joel Pasvolsky <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #554 +/- ##
==========================================
- Coverage 88.75% 85.14% -3.62%
==========================================
Files 21 21
Lines 1654 1669 +15
==========================================
- Hits 1468 1421 -47
- Misses 186 248 +62 ☔ View full report in Codecov by Sentry. |
I can sort them alphabetically if you want me to - satoshi nakamoto
…On Thu, 30 Jan 2025, 11:01 am Radomir Stevanovic, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In dwave/system/samplers/clique.py
<#554 (comment)>
:
> @@ -184,6 +185,18 @@ def __init__(self, *,
self.child = DWaveSampler(
failover=failover, retry_interval=retry_interval, **config)
+ def close(self):
Of 12 lists in that file, only 1 is sorted alphabetically.
—
Reply to this email directly, view it on GitHub
<#554 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACS5PQREJB7KBXOCVAXR7KT2NJZJVAVCNFSM6AAAAABWDWR5ECVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKOBUG44DSMBWHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for the feedback, @JoelPasvolsky. I believe I addressed all your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Close #77.
Note:
tests will fail because we need to releaseWe skip tests that requiredwave-cloud-client==0.13.3
first.UseAfterCloseError
from cloud client 0.13.3.Follow-up: add support for context manager protocol to all samplers.