1
$\begingroup$

I would like to find out if there is some way to rename a job automatically, either when the job is first sent to the queue, or later after the fact. I've tried searching through the forum and the documentation to try and find a solution, but nothing that seems to do the trick. The closest I have found is the qobj_id parameter, however, this is depreciated and no longer functions.

Edit: I finally found a (frustratingly easy) solution, see my answer below

$\endgroup$
2
  • $\begingroup$ I think the answer is a straight no. IDs are meant to be fixed and meaningful to the server. I suggest to save your job IDs in some csv file. $\endgroup$ Feb 9, 2023 at 22:52
  • $\begingroup$ @DanieleCuomo The job name is different from the job ID. if you go into the job details you can manually rename the job, which is an identifier separate from the ID. $\endgroup$
    – YaGoi Root
    Feb 10, 2023 at 13:00

2 Answers 2

3
+50
$\begingroup$

Recently, the API for submitting jobs has changed. I suggest you to read the following documents:

https://github.com/Qiskit/qiskit-ibm-provider

https://github.com/Qiskit/qiskit-ibm-provider/blob/main/docs/tutorials/Migration_Guide_from_qiskit-ibmq-provider.ipynb

As you can read there, job name is no longer supported.

$\endgroup$
1
  • $\begingroup$ I'm not sure if job name is completely unsupported. I actually managed to find a solution for this, see the answer that I posted. $\endgroup$
    – YaGoi Root
    Feb 10, 2023 at 21:31
2
$\begingroup$

I finally managed to find a solution. It actually ended up being so simple, that I think the only way that I had missed it was that I was looking for a solution within backend.run() or execute() and not the job object itself. The solution uses the job.update_name() method and here is a simple implementation of it.

backend = provider.get_backend('ibm_nairobi')

qreg_q = QuantumRegister(1, 'q')
creg_c = ClassicalRegister(1, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)

circuit.h(qreg_q[0])
circuit.measure(qreg_q[0], creg_c[0])

job = execute(circuit, backend, shots=8192, memory=True)
job.update_name('test_name') #the new job will have the name "test_name"
$\endgroup$
5
  • $\begingroup$ Which version of qiskit have you used? $\endgroup$ Feb 10, 2023 at 21:41
  • $\begingroup$ @MicheleAmoretti I'm honestly not sure. I work through IBM's Quantum Lab notebooks, so I suppose I use which ever version that defaults to. This was the documentation page that eventually lead me to the solution, if this helps tell what version I might be using: qiskit.org/documentation/stubs/… $\endgroup$
    – YaGoi Root
    Feb 10, 2023 at 22:37
  • 1
    $\begingroup$ I found the same documentation but I did not post it because it is no longer valid on the latest qiskit release. $\endgroup$ Feb 11, 2023 at 6:15
  • $\begingroup$ @MicheleAmoretti After doing some ready, I do agree that it is not the latest version of qiskit. However, considering that is still supported by the quantum computer side of IBM's service (as evidenced by the fact that I can actively run jobs like this), this solution should be considered valid. $\endgroup$
    – YaGoi Root
    Feb 12, 2023 at 1:00
  • $\begingroup$ quantumcomputing.stackexchange.com/questions/15741/… $\endgroup$
    – hft
    Feb 12, 2023 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.