qiboteam / qibo-client

Qibo remote connection client.
https://qibo.science
Apache License 2.0
1 stars 0 forks source link

`qibo-client` 404 error #39

Closed BrunoLiegiBastonLiegi closed 1 week ago

BrunoLiegiBastonLiegi commented 2 months ago

Running the example shown in the readme results in a connection error.

[2024-05-10 12:56:09,926] INFO: Post new circuit on the server
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[4], line 2
      1 # run the circuit
----> 2 result = client.run_circuit(circuit, nshots=1000, device="sim")

File ~/python_envs/qibo/lib/python3.11/site-packages/qibo_client/qibo_client.py:167, in Client.run_circuit(self, circuit, nshots, device)
    164 logger.info("Post new circuit on the server")
    166 try:
--> 167     self._post_circuit(circuit, nshots, device)
    168 except JobPostServerError as err:
    169     logger.error(err.message)

File ~/python_envs/qibo/lib/python3.11/site-packages/qibo_client/qibo_client.py:195, in Client._post_circuit(self, circuit, nshots, device)
    192 response = requests.post(url, json=payload, timeout=constants.TIMEOUT)
    194 # checks
--> 195 response.raise_for_status()
    196 check_response_has_keys(response, ["pid", "message"])
    198 # save the response

File ~/python_envs/qibo/lib/python3.11/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1016     http_error_msg = (
   1017         f"{self.status_code} Server Error: {reason} for url: {self.url}"
   1018     )
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: https://cloud.qibo.science/run_circuit/

I am using qibo-client/main. This is blocking some developments in qibo-cloud-backends (qiboteam/qibo-cloud-backends#20, qiboteam/qibo-cloud-backends#7) and qibo indirectly (qiboteam/qibo#1282).

scarrazza commented 2 months ago

@BrunoLiegiBastonLiegi thanks. I believe this is due to the new quota system, cc @marcorossi5.

marcorossi5 commented 1 month ago

This is due to the following lines:

https://github.com/qiboteam/qibo-webapp/blob/7edd2b389074650a4c3ce0d3574e235871f5ddd5/src/accounts/views.py#L84-L85

Both of try to access objects that are not present in the database. We should fix the fixtures to correctly load the objects in the database schema.

scarrazza commented 1 month ago

@marcorossi5 thanks, could you please take care of this and deploy the new website?

BrunoLiegiBastonLiegi commented 1 month ago

Hi, I noticed that a fix for this has been merged. However, I still get the 404 error by simply running the code example. I don't think it's due to my token being wrong, because the same error happens in qibo-cloud-backends main https://github.com/qiboteam/qibo-cloud-backends/actions/runs/8917928327/job/25510345685.

scarrazza commented 1 month ago

@marcorossi5 for completeness, please find below the circuit which is generating issues during the json encoding:

from qibo.quantum_info import random_clifford
from qibo import gates

circuit = random_clifford(3)
circuit.add(gates.M(0, 2))
scarrazza commented 1 week ago

This is now fixed in Qibo.