Skip to content

Commit

Permalink
Feature/qasm string (#57)
Browse files Browse the repository at this point in the history
* add the option to pass the QASM code as a string instead of an URL

* move compilers from queryparams to body

---------

Co-authored-by: Philipp Wundrack <philipp.wundrack@live.de>
  • Loading branch information
mbeisel and PhilWun authored Oct 31, 2023
1 parent a9df74a commit 39e7228
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LABEL maintainer = "Benjamin Weder <benjamin.weder@iaas.uni-stuttgart.de>"

ARG DOCKERIZE_VERSION=v0.6.1
ARG TOMCAT_VERSION=9.0.8
ARG NISQ_ANALYZER_PORT=5010

ENV POSTGRES_HOSTNAME localhost
ENV POSTGRES_PORT 5060
Expand All @@ -29,7 +30,7 @@ RUN wget --quiet --no-cookies https://archive.apache.org/dist/tomcat/tomcat-9/v$
tar xzvf /tmp/tomcat.tgz -C /opt && \
mv /opt/apache-tomcat-${TOMCAT_VERSION} /opt/tomcat && \
rm /tmp/tomcat.tgz && \
sed -i 's/port="8080"/port="5010"/g' /opt/tomcat/conf/server.xml
sed -i 's/port="8080"/port="'${NISQ_ANALYZER_PORT}'"/g' /opt/tomcat/conf/server.xml
ENV CATALINA_HOME /opt/tomcat
ENV PATH $PATH:$CATALINA_HOME/bin

Expand All @@ -54,7 +55,7 @@ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSI
RUN rm -rf ${CATALINA_HOME}/webapps/*
COPY --from=builder /build/nisq-analyzer ${CATALINA_HOME}/webapps/nisq-analyzer

EXPOSE 5010
EXPOSE ${NISQ_ANALYZER_PORT}

# configure application with template and docker environment variables
ADD .docker/application.properties.tpl ${CATALINA_HOME}/webapps/application.properties.tpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public List<Provider> getProviders() {

try {
ProviderListDto result = restTemplate.getForObject(providerAPIEnpoint, ProviderListDto.class);

if (result != null) {
return ProviderListDto.Converter.convert(result);
} else {
return new ArrayList<>();
}
} catch (RestClientException e) {
LOG.error("Error while connecting to QPROV: " + e.getMessage());
return new ArrayList<>();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private File createQasmFileFromUrlOrString(URL url, String qasm, String refreshT
@Operation(responses = {@ApiResponse(responseCode = "200"), @ApiResponse(responseCode = "400", content = @Content),
@ApiResponse(responseCode = "500", content = @Content)}, description = "Select the most suitable quantum computer for a quantum circuit loaded from the given URL")
@PostMapping(value = "/" + Constants.QPU_SELECTION, consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE})
public HttpEntity<QpuSelectionJobDto> selectQpuForCircuitUrl(@RequestParam List<String> compilers, @RequestBody QpuSelectionDto params) {
public HttpEntity<QpuSelectionJobDto> selectQpuForCircuitUrl(@RequestBody QpuSelectionDto params) {
LOG.debug("Post to select QPU for quantum circuit at URL '{}', with language '{}', and allowed providers '{}'!", params.getCircuitUrl(), params.getCircuitLanguage(), params.getAllowedProviders());

File circuitFile;
Expand All @@ -284,7 +284,7 @@ public HttpEntity<QpuSelectionJobDto> selectQpuForCircuitUrl(@RequestParam List<
new Thread(() -> {
nisqAnalyzerService
.performQpuSelectionForCircuit(job, params.getAllowedProviders(), params.getCircuitLanguage(), circuitFile,
params.getTokens(), params.getCircuitName(), compilers, params.isPreciseResultsPreference(),
params.getTokens(), params.getCircuitName(), params.getCompilers(), params.isPreciseResultsPreference(),
params.isShortWaitingTimesPreference(), params.getQueueImportanceRatio(), params.getMaxNumberOfCompiledCircuits(),
params.getPredictionAlgorithm(), params.getMetaOptimizer());
}).start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ public class QpuSelectionDto {
String metaOptimizer;

String userId;

List<String> compilers;
}

0 comments on commit 39e7228

Please sign in to comment.