def register_and_get_operational_backends(qconfig): if qconfig is not None: hub = qconfig.config.get('hub', None) group = qconfig.config.get('group', None) project = qconfig.config.get('project', None) proxies = qconfig.config.get('proxies', None) verify = qconfig.config.get('verify', True) provider_name = qconfig.config.get('provider_name', 'ibmq') try: q_register(qconfig.APItoken, qconfig.config["url"], hub=hub, group=group, project=project, proxies=proxies, verify=verify, provider_name=provider_name) except: logger.debug( "WARNING: Can not register quantum backends. Check your Qconfig.py." ) backends = available_backends() backends = [ x for x in backends if x not in QuantumAlgorithm.UNSUPPORTED_BACKENDS ] return backends
def register_and_get_operational_backends(qconfig): if qconfig is not None: hub = qconfig.config.get('hub', None) group = qconfig.config.get('group', None) project = qconfig.config.get('project', None) proxies = qconfig.config.get('proxies', None) verify = qconfig.config.get('verify', True) provider_name = qconfig.config.get('provider_name', 'ibmq') try: q_register(qconfig.APItoken, qconfig.config["url"], hub=hub, group=group, project=project, proxies=proxies, verify=verify, provider_name=provider_name) logger.debug('Registered with QISKit successfully.') except Exception as e: logger.debug('Failed to register quantum backends: {}'.format( str(e))) backends = available_backends() backends = [ x for x in backends if x not in QuantumAlgorithm.UNSUPPORTED_BACKENDS ] return backends
def register_and_get_operational_backends(qconfig): try: for provider in q_registered_providers(): if isinstance(provider,IBMQProvider): q_unregister(provider) logger.debug("Provider 'IBMQProvider' unregistered with Qiskit successfully.") break except Exception as e: logger.debug("Failed to unregister provider 'IBMQProvider' with Qiskit: {}".format(str(e))) if qconfig is not None: hub = qconfig.config.get('hub', None) group = qconfig.config.get('group', None) project = qconfig.config.get('project', None) proxies = qconfig.config.get('proxies', None) verify = qconfig.config.get('verify', True) try: q_register(qconfig.APItoken, provider_class=IBMQProvider, url=qconfig.config["url"], hub=hub, group=group, project=project, proxies=proxies, verify=verify) logger.debug("Provider 'IBMQProvider' registered with Qiskit successfully.") except Exception as e: logger.debug("Failed to register provider 'IBMQProvider' with Qiskit: {}".format(str(e))) backends = available_backends() backends = [x for x in backends if x not in QuantumAlgorithm.UNSUPPORTED_BACKENDS] return backends