2
$\begingroup$

Suppose I run the following code:

job = execute(qc, backend = backend, shots = 1024, optimization_level = 0)

Then the job takes a long time to run. We know that job_id (from job.job_id()) is a unique identifier for a job. Can I just save job_id and then turn it off and restore the job variable with job_id the next day?

Or what information can I save that will allow me to get the job.result() after I drop the line?

The motivation for this problem is that I don't want to increase the workload due to network reasons when I am waiting for many tasks to run. It will be much easier to handle data when there is job.result(). Otherwise, I can only go to https://quantum-computing.ibm.com/ to download the result data, and the data format is not easy to use.

thank you for your help!

$\endgroup$

2 Answers 2

2
$\begingroup$

I take it you're running the jobs on an IBMQ backend and not one of the local simulators.
If so, just keep track of job_id, then use the retrieve_job function to retrieve the job at a later point in time and get its result.

$\endgroup$
1
$\begingroup$

In order to fully recover your Job object from IBMQ, you need two things:

  • the backend name
  • the job id

Once you sent your job, you can save those like this:

job_id = job.job_id()
backend_name = job.backend().name()

Later, when the job is done, you can recover the Job object like this:

provider = IBMQ.load_account()
job = provider.get_backend(backend_name).retrieve_job(job_id)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.