Skip to content
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

403 Forbidden on certain ising problem submissions #536

Open
iamashwin99 opened this issue Sep 16, 2024 · 5 comments
Open

403 Forbidden on certain ising problem submissions #536

iamashwin99 opened this issue Sep 16, 2024 · 5 comments

Comments

@iamashwin99
Copy link

Description
When submitting a simple ising problem such as :

from dwave.system import EmbeddingComposite, DWaveSampler
qpu = DWaveSampler(region='eu-central-1')
q0 = qpu.nodelist[1]
q1 =  next(iter(qpu.adjacency[q0]))
q0, q1  # The two chosen qubits
qpu.sample_ising({}, {(q0, q1): -1}, num_reads=738, annealing_time=1195.4)

on the latest versions of the dwave-system library, I get the following error:

Python 3.8.10 | packaged by conda-forge | (default, Sep 13 2021, 21:46:58) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from dwave.system import EmbeddingComposite, DWaveSampler

q0 = qpu.nodelist[1]
q1 =  next(iter(qpu.adjacency[q0]))
q0, q1  # The two chosen qubits
qpu.sample_ising({}, {(q0, q1): -1}, num_reads=738, annealing_time=1195.4)
>>> qpu = DWaveSampler(region='eu-central-1')
>>> q0 = qpu.nodelist[1]
>>> q1 =  next(iter(qpu.adjacency[q0]))
>>> q0, q1  # The two chosen qubits
(31, 32)
>>> qpu.sample_ising({}, {(q0, q1): -1}, num_reads=738, annealing_time=1195.4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dimod/sampleset.py", line 1032, in __repr__
    self.record,
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dimod/sampleset.py", line 1126, in record
    self.resolve()
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dimod/sampleset.py", line 1490, in resolve
    samples = self._result_hook(self._future)
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/system/samplers/dwave_sampler.py", line 449, in _hook
    raise exc
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/system/samplers/dwave_sampler.py", line 436, in _hook
    return resolve(computation)
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/system/samplers/dwave_sampler.py", line 426, in resolve
    sampleset.resolve()
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dimod/sampleset.py", line 1490, in resolve
    samples = self._result_hook(self._future)
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/cloud/computation.py", line 833, in <lambda>
    sampleset = dimod.SampleSet.from_future(self, lambda f: f.wait_sampleset())
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/cloud/computation.py", line 771, in wait_sampleset
    self._load_result()
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/cloud/computation.py", line 907, in _load_result
    raise self._exception
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/cloud/client/base.py", line 1288, in _do_submit_problems
    message = Client._sapi_request(
  File "$ENV_DIR/dtest2/lib/python3.8/site-packages/dwave/cloud/client/base.py", line 1827, in _sapi_request
    raise SolverError(error_msg=error_msg, error_code=error_code)
dwave.cloud.exceptions.SolverError: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

Here are the relevant packages in that environment:

$ pip freeze | grep dwave
dwave-cloud-client==0.13.0
dwave-optimization==0.3.0
dwave-preprocessing==0.6.6
dwave-samplers==1.3.0
dwave-system==1.26.0
dwave_networkx==0.8.15

I have tried this with both Python 3.11.10 and Python 3.8.10 and have the same result each time ( not a single successful submission)

On another environment with Python3.8.10 and the following packages:

$ pip freeze | grep dwave
dwave-cloud-client==0.12.0
dwave-greedy==0.3.0
dwave-hybrid==0.6.11
dwave-inspector==0.5.0.post0
dwave-neal==0.6.0
dwave-ocean-sdk==7.0.0
dwave-optimization==0.1.0
dwave-preprocessing==0.6.5
dwave-samplers==1.2.0
dwave-system==1.25.0
dwave-tabu==0.5.0
dwave_networkx==0.8.15
dwavebinarycsp==0.3.0

The same minimal reproducible example always succeeds.
Perhaps there is a bug in the new version of one of these packages?

@iamashwin99
Copy link
Author

iamashwin99 commented Sep 16, 2024

Interestingly, on the problematic environment, the error goes away by changing slightly to a different annealing time (1195.41) or num_reads=739. But those exact values are not working

@arcondello
Copy link
Member

arcondello commented Sep 16, 2024

Hi @iamashwin99 , we're looking into it! Will let you know once we find something.

iamashwin99 added a commit to iamashwin99/dwave_sweep_studies that referenced this issue Sep 16, 2024
@randomir
Copy link
Member

Hi @iamashwin99, this seems to be related to our web application firewall being overly protective.

Until we address the issue server-side, one workaround is to disable compression on upload of QPU problems, client-side. If you change the second line of your example to:

qpu = DWaveSampler(region='eu-central-1', compress_qpu_problem_data=False)

the problem is successfully processed.

@iamashwin99
Copy link
Author

Hi @randomir, I can condfirm that this suggested soultion works!
Thanks for letting me know.

Would you like me to close the issue? or would it be a good idea to leave it open untill the server-side issue is fixed?

@randomir
Copy link
Member

Thanks for confirming, @iamashwin99. Let's keep the issue opened until we fix it server-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants