def retrieve_job(self, job_id): """Attempt to get the specified job by job_id Args: job_id (str): the job id of the job to retrieve Returns: IBMQJob: class instance Raises: IBMQBackendError: if retrieval failed """ job_info = self._api.get_job(job_id) if 'error' in job_info: raise IBMQBackendError('failed to get job id "{}"'.format(job_id)) is_device = not bool(self._configuration.get('simulator')) job = IBMQJob.from_api(job_info, self._api, is_device) return job
def jobs(self, limit=50, skip=0): """Attempt to get the jobs submitted to the backend Args: limit (int): number of jobs to retrieve skip (int): starting index of retrieval Returns: list(IBMQJob): list of IBMQJob instances """ backend_name = self.configuration['name'] job_info_list = self._api.get_jobs(limit=limit, skip=skip, backend=backend_name) job_list = [] for job_info in job_info_list: is_device = not bool(self._configuration.get('simulator')) job = IBMQJob.from_api(job_info, self._api, is_device) job_list.append(job) return job_list
""" from IBMQuantumExperience import IBMQuantumExperience as IBMQ import Qconfig from qiskit.backends.ibmq.ibmqjob import IBMQJob api = IBMQ(Qconfig.APItoken, Qconfig.config) batchinfo = False jobs_last = api.get_jobs(limit=9) result_list = None for job in jobs_last: print('Time is', job['creationDate']) print('Backend is ', job['backend']) print('Status is :', job['status'], '\n') if batchinfo: batchnr = 1 for batch in jobs_last: print('\nInfo of batch nr. %d \n' % batchnr) for qasm in batch['qasms']: print('Status:', qasm['status']) if qasm['status'] == 'DONE': print('Date:', qasm['result']['date']) batchnr += 1 result = IBMQJob.from_api(jobs_last[-1], api, False).result() for i in range(7, -1, -1): result += IBMQJob.from_api(jobs_last[i], api, False).result()