Closed IceKhan13 closed 1 year ago
Hi, I'd like to help with this. Are there any other details you can point out about this issue?
Hey @yonMaor ! Thank you for jumping in!
We have custom json decoder and encoder in serverless client here
and here
We are using them to encode and decode arguments to a program here https://github.com/Qiskit-Extensions/quantum-serverless/blob/7060fca8d0b662d80028fbfdf0b33fe4f2004a72/client/quantum_serverless/core/job.py#L171 or here
We want to use those encoder/decoder in places where we are saving results of program and reading them back. In this function for saving results https://github.com/Qiskit-Extensions/quantum-serverless/blob/7060fca8d0b662d80028fbfdf0b33fe4f2004a72/client/quantum_serverless/core/job.py#L286 and in this function to get them back
Let me know if you need further clarification and if I need to assign this task to you.
Thank you!
In the issue description you refer to all of the types that the Program arguments support. I'm not sure that I understand what types you mean exactly
We have Program
class that has constructor parameter arguments
, which is python dictionary. This dictionary has type Dict[str, Union[<python_primitives>, QiskitRuntimeService, QuantumCircuit, np.ndarray, Operator, ...]]
. This dictionary is serialized and passed as argument to execution. Serialization from dict to json format is happening with encoders and decoder.
Encoder and decoder have all types necessary.
You can check implementation here of QiskitObjectsEncoder or/and check parent class RuntimeEncoder
https://github.com/Qiskit-Extensions/quantum-serverless/blob/7060fca8d0b662d80028fbfdf0b33fe4f2004a72/client/quantum_serverless/serializers/program_serializers.py#L38
Same with decoder :)
Only thing necessary here is use this encoder and decoder
Cool, I'll take a look and see if I have more questions. Thanks for the explanations
I took a look at this issue since it's been a couple months since it was previously assigned. I think I have the solution and will be submitting a pull request soon.
What is the expected enhancement?
Client:
save_result
should support all types thatProgram.arguments
support.Currently
save_result
only support dictionaries.This can be achieved just by using encoder and decoder from program arguments.