Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
149 stars 154 forks source link

The cost calculation fails with an expression #851

Closed AzizNgoueya closed 1 year ago

AzizNgoueya commented 1 year ago

Describe the bug When assigning a value containing an operation in the Options().max_execution_time, I got an error {"code":1208,"message":"Invalid job request body: Key: \\\'ProgramRunParams.Cost\\\' Error:Field validation for \\\'Cost\\\' failed on the \\\'min\\\' tag.","solution":"Check the JSON schema.","more_info":"https://cloud.ibm.com/apidocs/quantum-computing#error-handling"}

Steps to reproduce

options = Options()
options.max_execution_time = 4*60
sampler = Sampler(session = backend, options = options)
circuit = QuantumCircuit(1,1)
circuit.h(0)
circuit.measure_all()
job = sampler.run(circuit, shots = 1024) 

Expected behavior It should work

Suggested solutions

options.max_execution_time = 240 works

Additional Information

merav-aharoni commented 1 year ago

options.max_execution_time must be at least 300 seconds. So actually both versions should fail. I suggest we improve the error message.

kt474 commented 1 year ago

fixed by #853