circuit_list.append(Q_program.get_circuit(cir)) print('Batch %d/%d: %s' % (i + 1, nr_batches, 'INITIALIZING')) if i == 0: job = execute(circuit_list, backend=backendname, shots=shots) jobs.append(job) job_data.append({ 'Date': job.creation_date, 'Jobid': job.id, 'runtype': run_type, 'batchno': i }) print('Batch %d/%d: %s' % (i + 1, nr_batches, 'SENT')) else: job = execute(circuit_list, backend=backendname, shots=shots) jobs.append(job) job_data.append({ 'Date': job.creation_date, 'Jobid': job.id, 'runtype': run_type, 'batchno': i }) print('Batch %d/%d: %s' % (i + 1, nr_batches, 'SENT')) ############################################################################### store.save_jobdata(circuit_name, job_data, tomo_set, backendname, shots, nr_batches, run_type, Unitary) store.save_last(circuit_name, job_data, tomo_set, backendname, shots, nr_batches, run_type, Unitary) unregister(provider)
'Jobid': job.id, 'runtype': run_type, 'batchno': i }) print('Batch %d/%d: %s' % (i + 1, nr_batches, 'SENT') ) # This batch is done and the jobs are saved to job_data and jobs ############################################################################### store.save_jobdata( circuit_name, job_data, tomo_set, # Save the data of all jobs (in job_data) to file backendname, shots, nr_batches, run_type, Unitary) store.save_last( circuit_name, job_data, tomo_set, backendname, # Save also to 'last' file shots, nr_batches, run_type, Unitary) unregister( provider ) # Unregister to prevent conflict with other files that register again
backend = get_backend('ibmq_qasm_simulator') elif run_type == 'r': backend = get_backend('ibmqx4') #%% Load the jobdata and the jobids for the circuit_name and run_type [jobids, jobdata] = rg.get_jobids_from_file(direct, circuit_name, run_type) stati = rg.get_status_from_jobids( jobids, printing=True) # Get the stati from all different jobs and print them if 'RUNNING' not in stati: # If all jobs are done, the results are gathered results = rg.get_results_from_jobids(jobids, backend) # Gather the results calibrations = rg.get_calibration_from_jobids( jobids) # Get the calibrations to be saved rg.store.save_results( circuit_name, jobdata[ 'Experiment time'], # Save a dictionary using the save_results method jobdata['Type'], jobdata['Backend'], jobids, jobdata['Tomoset'], jobdata['Batchnumber'], jobdata['Shot number'], results, jobdata['Unitary'], calibrations, notes=None) #%% unregister(provider) # Unregister to prevent conflict