qiskit-ibm-runtime
qiskit-ibm-runtime copied to clipboard
Stop caching Qobj in the job
What is the expected enhancement?
Today we cache Qobj in the job after submission, so that it's readily available if the user wants to access it. The problem is, as the size of the machines increases, so does the size of the Qobjs. Caching Qobj in the job means Python cannot garbage collect it. This gets much worse if one submits many jobs in a single Python session, like many algorithms do.
Instead of keep a reference to the Qobj in the job, we can just retrieve it on demand. It'd be slower for users who references the Qobj multiple times, but they can easily keep a local reference rather than doing job.circuits()
each time.
Qobj has not been cached for a while, closing
The same thing applies to inputs (circuits) for primitives though. There should be an issue for that if you don't want to repurpose this one. cc @drew-distefano
I'm running into memory issues again it seems.
When I use the qiskit_ibm_provider.job.ibm_circuit_job.IBMCircuitJob
, it called self._get_params()
, which retrieves a large objector utility-sized circuits. This creates a large object in the _params['circuits']. I can't seem to get rid of it anywhere, maybe it is cached elsewhere?
We don't have Qobj anymore, but it looks like we still cache inputs