示例#1
0
 def status(self):
     """Return backend status"""
     return AvailableToOperationalDict({
         'name': self.name,
         'operational': True,
         'pending_jobs': 0
     })
示例#2
0
    def status(self):
        """Return the online backend status.

        Returns:
            dict: The status of the backend.

        Raises:
            LookupError: If status for the backend can't be found.
        """
        try:
            backend_name = self.configuration()['name']
            status = self._api.backend_status(backend_name)
            # FIXME a hack to rename the key. Needs to be fixed in api
            status['name'] = status['backend']
            del status['backend']
            # FIXME a hack to remove the key busy.  Needs to be fixed in api
            if 'busy' in status:
                del status['busy']
            # FIXME a hack to add available to the hpc simulator.  Needs to
            # be fixed in api
            if status['name'] == 'ibmqx_hpc_qasm_simulator':
                status['available'] = True

            # FIXME: this needs to be replaced at the API level - eventually
            # it will.
            if 'available' in status:
                status['operational'] = status['available']
                del status['available']
        except Exception as ex:
            raise LookupError(
                "Couldn't get backend status: {0}".format(ex))
        return AvailableToOperationalDict(status)