qiskit_serverless.core.save_result¶
- save_result(result)[source]¶
Saves job results.
Note
data passed to save_result function must be json serializable (use dictionaries). Default serializer is compatible with IBM QiskitRuntime provider serializer. List of supported types [ndarray, QuantumCircuit, Parameter, ParameterExpression, NoiseModel, Instruction]. See full list via link.
- Links:
Source of serializer: https://github.com/Qiskit/qiskit-ibm-runtime/blob/0.14.0/qiskit_ibm_runtime/utils/json.py#L197
Example
>>> # save dictionary >>> save_result({"key": "value"}) >>> # save circuit >>> circuit: QuantumCircuit = ... >>> save_result({"circuit": circuit}) >>> # save primitives data >>> quasi_dists = Sampler.run(circuit).result().quasi_dists >>> # {"1x0": 0.1, ...} >>> save_result(quasi_dists)
- Parameters:
result (
Dict
[str
,Any
]) – data that will be accessible from job handler .result() method.