dwavesystems / dwave-system

An API for easily incorporating the D-Wave system as a sampler, either directly or through Leap's cloud-based hybrid samplers
https://docs.ocean.dwavesys.com/
Apache License 2.0
87 stars 62 forks source link

Fix QPU failover - signal solver failover condition (on resolve) #465

Closed randomir closed 1 year ago

randomir commented 1 year ago

Change in DWaveSampler/DWaveCliqueSampler behavior: when failover=True is specified on construction, solver failover is only signalled, and the actual failover is left as an exercise for the developer. :laughing:

The "dirty" bit we solve here is SAPI/solver exception unification:

Note that RetryCondition is a specialization of FailoverCondition, so catching FailoverCondition and doing sampler.trigger_failover() should handle all failover cases.

codecov-commenter commented 1 year ago

Codecov Report

Merging #465 (3f75aad) into master (6a27508) will decrease coverage by 4.77%. The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
- Coverage   91.13%   86.36%   -4.78%     
==========================================
  Files          23       23              
  Lines        1546     1540       -6     
==========================================
- Hits         1409     1330      -79     
- Misses        137      210      +73     
Impacted Files Coverage Δ
dwave/system/samplers/dwave_sampler.py 82.03% <91.66%> (-4.02%) :arrow_down:
dwave/system/exceptions.py 100.00% <100.00%> (ø)
dwave/system/samplers/clique.py 73.85% <100.00%> (-13.97%) :arrow_down:
dwave/system/coupling_groups.py 12.50% <0.00%> (-81.25%) :arrow_down:
dwave/system/samplers/leap_hybrid_sampler.py 61.42% <0.00%> (-14.29%) :arrow_down:
dwave/system/composites/embedding.py 96.57% <0.00%> (-1.15%) :arrow_down:
dwave/system/testing.py 95.12% <0.00%> (-0.82%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more