qiskit-experiments
qiskit-experiments copied to clipboard
If experiment_data.save() fails it should raise an exception
https://github.com/Qiskit/qiskit-experiments/blob/049436a3d184adb51bb559316483cd44f1e2c925/qiskit_experiments/framework/experiment_data.py#L1339
Here; if you hit this condition the experiment data is not saved, but the function returns as if it had saved. In the context of, for example launching a bunch of experiments from a loop, this could cause a user to lose a lot of data. (or am I missing something here?)
Users don't typically call expdata.save()
and then immediately overwrite expdata
with the experiment data returned from the next experiment, which is why this hasn't been surfaced as an issue so far, but I do think the handling can be improved here. Since suppress_errors
is already a flag, I'm not sure why it doesn't apply to this conditional as well. @gadial what do you think?
(If you want another use case, run_qe will return with an exit code that indicates success, even if save() fails.)
I agree; no reason not to raise an error here if we already have the (new) suppress_errors
flag.
I put in a fix for this in #1278. Note that if you were calling save()
, which is what most users do, it already raises an error when there's no service: https://github.com/Qiskit-Extensions/qiskit-experiments/blob/f33bed7e143b68bd53243c061c603bb5216c9e54/qiskit_experiments/framework/experiment_data.py#L1696-L1705
So the new fix is only for the case when someone calls save_metadata()
separately to save only the metadata.