# How do I identify a VQE job run in real hardware?

I am running a VQEUCCFactory for H2 on a real hardware device.

res=VQEUCCFactory(quantum_instance=QuantumInstance(provider.get_backend('ibmq_athens'),
shots=8000)
optimizer=optimizer,
initial_state=initial_state)


I left it running offline and when I go to check the results I get more than one job_id. So when I want to simulate another molecule, I obtain more jobs_id. Therefore at the end I cannot identify which jobs_id belongs to each molecules.

Is there any way to add a tag or name to my jobs to identify which molecule corresponds to each group of jobs? I have seen that it can be done (https://quantum-computing.ibm.com/lab/docs/iql/manage/account/ibmq) but I don't know how to implement the job_name of job_tag parameters to my code above.

Thank you very much in advance for the help!

• Try to see if you can use job_callback option define within QuantumInstance. qiskit.org/documentation/stubs/qiskit.aqua.QuantumInstance.html By using this option, you should be able to extract the job_id for the all the circuit execution and from that you know which is which... Jun 10, 2021 at 15:52
• It doesn't seem that you can assign a name to each job when you're running an Aqua algorithm, but you can use job_callback to get the IDs of the jobs as mentioned above. Maybe this is helpful for you: github.com/Qiskit/qiskit-aqua/issues/545. Jul 14, 2021 at 17:47

As mentioned in the comments, job_callback is the way to go.

This code snippet shows how to do this:

from qiskit.providers import JobStatus

def job_callback(job_id, job_status, queue_position, job):
if job_status == JobStatus.DONE:
# You can assign a name for the job:
job.update_name('custom_job_name')
# You can also set tags:
job.update_tags(['tag_1', 'tag_2'])

backend = provider.get_backend('ibmq_athens')
quantum_instance = QuantumInstance(backend, shots = 8000, job_callback = job_callback)


It is straightforward to add a name to a job. Here is an example from one of my scripts. Below, "circs" is a group of circuits that I submit simultaneously. Replace "jobname" with the name of the job that you want to use.

backend     = provider.get_backend('ibmq_qasm_simulator')
circs       = transpile(circs, backend=backend)
job_manager = IBMQJobManager()
job_set_foo = job_manager.run(circs, backend=backend, shots=nshots, name='jobname')
`
• Thank you very much for your answer, but what I am trying is to add a name or tag to a VQE job. I don't have explicitly the circuits. So with what I have posted I cannot find a way to add a name because I have no circuits but instead a VQE. res=VQEUCCFactory(quantum_instance=QuantumInstance(provider.get_backend('ibmq_athens'), shots=8000) optimizer=optimizer, initial_state=initial_state) Jun 11, 2021 at 9:06
• I am not sure if what you want is possible. Here is the qiskit documentation and it does not seem like you can add a name or tag. qiskit.org/documentation/stubs/… Jun 13, 2021 at 21:44