author | description | ms.author | ms.date | ms.service | ms.subservice | ms.topic | title | uid |
---|---|---|---|---|---|---|---|---|
george-moussa |
Reference for azure.quantum.optimization.Job |
georgenm |
02/01/2021 |
azure-quantum |
optimization |
reference |
Quantum optimization job |
microsoft.quantum.optimization.job-reference |
from azure.quantum.optimization import Job
Retrieves the job result (that is, the computed solution and cost). If the job has not yet finished, blocks until it has.
results = job.get_results()
print(results)
> {'version': '1.0', 'configuration': {'1': 1, '0': 1, '2': -1, '3': 1}, 'cost': -23.0}
Refreshes the job's details by querying the workspace.
job = workspace.get_job(jobId)
job.refresh()
print(job.id)
> 5d2f9cd70f55f149e3ed3aef
Returns a boolean value indicating whether the job has finished (for example, the job is in a final state).
job = workspace.get_job(jobId)
job.refresh()
print(job.has_completed())
> False
Keeps refreshing the job's details until it reaches a final state. For more information on job states, see Azure Quantum Overview.
job = workspace.get_job(jobId)
job.wait_until_completed()
print(job.has_completed())
> True