Closed HuangJunye closed 2 years ago
This is because qobj_header
is no longer an option on those backends. WIth the migration to BackendV1
backend.run()
, which is what execute
calls internally, on backends only takes explicit options the backends expose. The explicit qobj_header
field for execute()
only works with legacy backends that are built off of the deprecated BaseBackend
class which used qobj as a payload for backend.run()
. You no longer need to set this field to attach metadata to a circuit as this is supported natively by QuantumCircuit
since 0.17. To accomplish this with you should be running something like:
from qiskit import IBMQ, QuantumCircuit, execute
from qiskit.circuit.random import random_circuit
provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_qasm_simulator')
qc = random_circuit(3, 3)
qc.metadata = {'test_header': 'test'}
test_job = execute(qc, backend=backend)
of course this attaches the metadata to the circuit and will be in the corresponding experiment header (not the job header) under the metadata field in the output result.
We should update the documentation to outline that the qobj_header kwarg along with a bunch of other options for execute()
only work with legacy backend objects.
@mtreinish Thanks for the reply! That's really helpful. We will use the circuit metadata.
Information
What is the current behavior?
Qobj header from a job submitted to cloud simulator / local Aer simulator / real quantum system doesn't return the same info passed to
qobj_header
argument in theexecute
function, even though the documentation states the following:What could be the issues?
Steps to reproduce the problem
returns
Same behaviour for Aer QasmSimulator.
What is the expected behavior?
The code above should return info passed to the execute function.
Suggested solutions