Qiskit / qiskit-tutorials

A collection of Jupyter notebooks showing how to use the Qiskit SDK
Apache License 2.0
2.34k stars 1.29k forks source link

Backend filter not functioning #853

Closed kentarotamura612 closed 4 years ago

kentarotamura612 commented 4 years ago

Informations

Qiskit Software Version
Qiskit 0.14.0
Terra 0.11.0
Aer 0.3.4
Ignis 0.2.0
Aqua 0.6.1
IBM Q Provider 0.4.4
Python 3.7.3 | packaged by conda-forge | (default, Dec 6 2019, 08:54:18) [GCC 7.3.0]
OS Linux
CPUs 8
Memory (Gb) 31.409332275390625

Mon Dec 23 09:40:13 2019 UTC

What is the current behavior?

code

my = IBMQ.get_provider(hub='ibm-q-keio', group='keio-internal', project='keio-students')
my.backends(simulator=False, operational=True)

output

HTTPError                                 Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py in request(self, method, url, bare, **kwargs)
    206             response = super().request(method, final_url, **kwargs)
--> 207             response.raise_for_status()
    208         except RequestException as ex:

/opt/conda/lib/python3.7/site-packages/requests/models.py in raise_for_status(self)
    939         if http_error_msg:
--> 940             raise HTTPError(http_error_msg, response=self)
    941 

HTTPError: 404 Client Error: Not Found for url: https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q-keio/Groups/keio-internal/Projects/keio-students/devices/ibmq_20_tokyo/queue/status?access_token=...

The above exception was the direct cause of the following exception:

RequestsApiError                          Traceback (most recent call last)
<ipython-input-13-5756dce9fe95> in <module>
----> 1 my.backends(simulator=False, operational=True)

/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqbackendservice.py in __call__(self, name, filters, timeout, **kwargs)
     92             kwargs['backend_name'] = name
     93 
---> 94         return filter_backends(backends, filters=filters, **kwargs)
     95 
     96     def jobs(

/opt/conda/lib/python3.7/site-packages/qiskit/providers/providerutils.py in filter_backends(backends, filters, **kwargs)
     61     # each backend).
     62     if status_filters:
---> 63         backends = [b for b in backends if
     64                     _match_all(b.status(), status_filters)]
     65 

/opt/conda/lib/python3.7/site-packages/qiskit/providers/providerutils.py in <listcomp>(.0)
     62     if status_filters:
     63         backends = [b for b in backends if
---> 64                     _match_all(b.status(), status_filters)]
     65 
     66     # 3. Apply acceptor filter.

/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqbackend.py in status(self)
    215             IBMQBackendError: If the status can't be formatted properly.
    216         """
--> 217         api_status = self._api.backend_status(self.name())
    218 
    219         try:

/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py in backend_status(self, backend_name)
     86             backend status.
     87         """
---> 88         return self.client_api.backend(backend_name).status()
     89 
     90     def backend_properties(

/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/rest/backend.py in status(self)
     79         """Return backend status."""
     80         url = self.get_url('status')
---> 81         response = self.session.get(url).json()
     82 
     83         # Adjust fields according to the specs (BackendStatus).

/opt/conda/lib/python3.7/site-packages/requests/sessions.py in get(self, url, **kwargs)
    544 
    545         kwargs.setdefault('allow_redirects', True)
--> 546         return self.request('GET', url, **kwargs)
    547 
    548     def options(self, url, **kwargs):

/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py in request(self, method, url, bare, **kwargs)
    224                 self._modify_chained_exception_messages(ex)
    225 
--> 226             raise RequestsApiError(message) from ex
    227 
    228         return response

RequestsApiError: '404 Client Error: Not Found for url: https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q-keio/Groups/keio-internal/Projects/keio-students/devices/ibmq_20_tokyo/queue/status?access_token=.... Backend not found., Error code: 2000.'

What is the expected behavior?

This phenomenon occurs when using an account where the "ibmq_20_tokyo" device is one of the allocated backends.

Suggested solutions

"ibmq_20_tokyo " is probably falsely labeled as operational = True. Changing the label of "ibmq_20_tokyo " to operational = False could solve the problem.

nonhermitian commented 4 years ago

There is no more ibmq_20_toyko. But also this was an issue with retired devices and being able to retrieve jobs from the device. This is no longer true.