diff --git a/org.planqk.nisq.analyzer.core/src/main/java/org/planqk/nisq/analyzer/core/connector/qiskit/QiskitSdkConnector.java b/org.planqk.nisq.analyzer.core/src/main/java/org/planqk/nisq/analyzer/core/connector/qiskit/QiskitSdkConnector.java index 7a31ac03..325e1440 100644 --- a/org.planqk.nisq.analyzer.core/src/main/java/org/planqk/nisq/analyzer/core/connector/qiskit/QiskitSdkConnector.java +++ b/org.planqk.nisq.analyzer.core/src/main/java/org/planqk/nisq/analyzer/core/connector/qiskit/QiskitSdkConnector.java @@ -381,18 +381,28 @@ public Optional getQpuByName(String name, String provider, String token) { public Integer getQueueSizeOfQpu(String qpuName) { URI ibmqQueueSizeUrl = URI.create(String.format("https://api.quantum-computing.ibm.com/api/Backends/%s/queue/status?", qpuName)); + LOG.debug("Requesting IBMQ for queue size"); RestTemplate restTemplate = new RestTemplate(); + // fake user agent, as IBMQ blocks Java/1.8 + HttpHeaders headers = new HttpHeaders(); + headers.set("user-agent", "python-requests/2.27.1"); + + HttpEntity entity = new HttpEntity<>(headers); + try { - IbmqQpuQueue ibmqQpuQueue = restTemplate.getForObject(ibmqQueueSizeUrl, IbmqQpuQueue.class); + ResponseEntity response = + restTemplate.exchange(ibmqQueueSizeUrl, HttpMethod.GET, entity, IbmqQpuQueue.class); + + IbmqQpuQueue ibmqQpuQueue = response.getBody(); if (ibmqQpuQueue != null) { return ibmqQpuQueue.getLengthQueue(); } else { - return 0; + return 100; } } catch (RestClientException e) { - return 0; + return 100; } } }