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

Running on down or non-existent backend #80

Closed
sabreitweiser opened this issue Sep 25, 2017 · 2 comments
Closed

Running on down or non-existent backend #80

sabreitweiser opened this issue Sep 25, 2017 · 2 comments
Assignees

Comments

@sabreitweiser
Copy link

Currently, when running on a backend which is down the job submits but times out; furthermore, if the backend does not exist at all, the program throws an uncaught error and stops. It would be nice to have the API relay information about nodes which are down, and to have the SDK use that to detect if a job is submitted to a down or non-existent backend. This could easily be addressed by adding a check into qiskit/_jobprocessor.py here:

    def submit(self, silent=True):
       ...
        for q_job in self.q_jobs:
            if q_job.backend in self._local_backends:
                future = executor.submit(run_local_simulator,
                                         q_job.qobj)
            elif self.online and q_job.backend in self._online_backends:
                future = executor.submit(run_remote_backend,
                                         q_job.qobj,
                                         self._api)

            #Check for down/non-existent backend?

            future.silent = silent

Particularly given that, at the moment, credits do not regenerate after a timed out job, it would be great especially to know if a node is down. I found this error when trying to run on the new ibmqx5 backend, which I do not believe is returned by the API as available.

Here's the full error text

Traceback (most recent call last):
File "asdf.py", line 15, in
result = Q_program.execute(["superposition"], backend='ibmqx5', shots=1024)
File "/Users/sabreitweiser/qiskit-sdk-py/qiskit/_quantumprogram.py", line 1144, in execute
result = self.run(qobj, wait=wait, timeout=timeout, silent=silent)
File "/Users/sabreitweiser/qiskit-sdk-py/qiskit/_quantumprogram.py", line 965, in run
self._run_internal([qobj], wait, timeout, silent)
File "/Users/sabreitweiser/qiskit-sdk-py/qiskit/_quantumprogram.py", line 1055, in _run_internal
jp.submit()
File "/Users/sabreitweiser/qiskit-sdk-py/qiskit/_jobprocessor.py", line 359, in submit
future.silent = silent
UnboundLocalError: local variable 'future' referenced before assignment

And the minimal program to reproduce (which is just a slightly modified version of the README example)

import sys
sys.path.append('/Users/sabreitweiser/qiskit-sdk-py/')
from qiskit import QuantumProgram
import Qconfig

Q_program = QuantumProgram()
QX_TOKEN = Qconfig.APItoken
QX_URL = "https://quantumexperience.ng.bluemix.net/api"
Q_program.set_api(QX_TOKEN, QX_URL)
qr = Q_program.create_quantum_register("qr", 2)
cr = Q_program.create_classical_register("cr", 2)
qc = Q_program.create_circuit("superposition", [qr], [cr])
qc.h(qr[0])
qc.measure(qr, cr)
result = Q_program.execute(["superposition"], backend='ibmqx5', shots=1024)
print(result)
print(result.get_data("superposition"))
@atilag
Copy link
Member

atilag commented Sep 25, 2017

Thanks for the report @sabreitweiser!
Yeah, we have already noticed this issue.
I'll be working on it and fix it asap.

@atilag atilag self-assigned this Sep 25, 2017
@diego-plan9
Copy link
Member

Closed via #85!

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