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

result.get_ran_qasm() not working #671

Closed
ajavadia opened this issue Jul 23, 2018 · 5 comments
Closed

result.get_ran_qasm() not working #671

ajavadia opened this issue Jul 23, 2018 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ajavadia
Copy link
Member

ajavadia commented Jul 23, 2018

What is the current behavior?

Result.get_ran_qasm() seem to be broken due to PR #501. That's because the Result datastructure no longer has a copy of the qobj json inside it. We should see how/if this can be fixed with the recent introduction of Qobj class.

Steps to reproduce the problem

from qiskit import *
q = QuantumRegister(3)
c = ClassicalRegister(3)
circ = QuantumCircuit(q, c)
circ.ccx(q[0], q[1], q[2])
print(circ.qasm())

result = execute(circ, 'local_qasm_simulator').result()
result.get_ran_qasm(circ.name)  # does not return an answer
@ajavadia ajavadia changed the title clean up broken methods due to Qobj result.get_ran_qasm() not working Jul 23, 2018
@delapuente delapuente self-assigned this Jul 23, 2018
@delapuente delapuente added this to the 0.6 milestone Jul 23, 2018
@diego-plan9 diego-plan9 added the bug Something isn't working label Jul 24, 2018
@jaygambetta
Copy link
Member

When we move to qobj why do we still want this option. This should be the output of the transpiler before qobj. Or are you thinking we make a qobj to qasm file

@delapuente
Copy link
Contributor

Well, while implementing I realize two cases:

If you use the wrapper shortcut execute(), you receive a BaseJob instance which does not expose the compiled QASM. The solution would be exposing the Qobj as a read-only property. Thoughts?

Is it guaranteed that the backend will always execute the QASM sent in the Qobj? If not, you need the backend to return the actual QASM it ran.

@nonhermitian
Copy link
Contributor

This seems related to #680, where running compile returns a Qobj with an incorrect qasm string, and then fails to run on the device.

@ajavadia
Copy link
Member Author

@delapuente I raised this bug mainly because the method is exposed in our API, but not working correctly at the moment.

Going forward, QASM will not be included in Qobj at all (it is only included now because devices run QASM, and can't run Qobj directly).

But even after we work with pure Qobj, it will still be very useful to see what Qobj was run after the run finished. For this, I think there should be a method BaseJob#get_ran_qobj() which returns the Qobj that was run in that Job.

Then we need two converter methods for converting from Qobj -> QASM and Qobj -> QuantumCircuit.

Does that make sense?

@delapuente
Copy link
Contributor

Agree. I would simplify the method name, say get_qobj() or a qobj property but that's all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants