Skip to content
Snippets Groups Projects
Commit 4813a730 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

work in progress

parent afd7cfb8
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ server:
timeout: 2592000
workflow:
miningUrl: http://mip.humanbrainproject.eu/services/mining
exaremeListAlgoUrl: http://hbps2.chuv.ch:9090/mining/algorithms
exaremeQueryUrl: http://hbps2.chuv.ch:9090/mining/query
listMethodsUrl: http://dockerhost:8087/list-methods
miningMipUrl: http://dockerhost:8087/mining
miningExaremeUrl: http://hbps2.chuv.ch:9090/mining/query
# Configuration for the portal running inside a Docker container for development
connection:
url: "jdbc:postgresql://portaldb:5432/postgres"
username: "postgres"
password: "test"
security:
enabled: false
hbp:
client:
clientId: 996f97c5-a3ca-460e-b18b-00df3e2be89a
clientSecret: aD0Tueb3KkNkcZqZgQbNyDWgnM95IfZ0xPCQ_6Z9dQNHXY00RIrnAD_m7sNJh1oofYSX8aHkl72MkwI0K626Ug
accessTokenUri: https://services.humanbrainproject.eu/oidc/token
userAuthorizationUri: https://services.humanbrainproject.eu/oidc/authorize
tokenName: oauth_token
authenticationScheme: query
clientAuthenticationScheme: form
# use-current-uri: false # For both production and HBPS1 deployments
# pre-established-redirect-uri: https://mip.humanbrainproject.eu/services/login/hbp # For production deployment
# pre-established-redirect-uri: http://hbps1.chuv.ch/services/login/hbp # For HBPS1 deployment
resource:
userInfoUri: https://services.humanbrainproject.eu/oidc/userinfo
logging:
level:
org.springframework.security: DEBUG
spring:
resources:
chain:
enabled: true
server:
contextPath: /services
port: 8080
use-forward-headers: true
session:
timeout: 2592000
workflow:
listMethodsUrl: http://dockerhost:8087/list-methods
miningMipUrl: http://dockerhost:8087/mining
miningExaremeUrl: http://hbps2.chuv.ch:9090/mining/query
......@@ -68,8 +68,10 @@
<hibernate.dialect>org.hibernate.dialect.PostgreSQL82Dialect</hibernate.dialect>
<schema.deploy>false</schema.deploy>
<frontend.redirect>http://frontend/home</frontend.redirect>
<workflow.experimentUrl>http://hbps1.chuv.ch:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://hbps1.chuv.ch:8087/list-methods</workflow.listMethodsUrl>
<workflow.experimentUrl>http://dockerhost:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://dockerhost:8087/list-methods</workflow.listMethodsUrl>
<workflow.miningMipUrl>http://dockerhost:8087/mining</workflow.miningMipUrl>
<workflow.miningExaremeUrl>http://dockerhost:8087/mining/query</workflow.miningExaremeUrl>
<flyway.url>${connection.url}</flyway.url>
<flyway.user>${connection.username}</flyway.user>
<flyway.password>${connection.password}</flyway.password>
......
......@@ -43,11 +43,11 @@ public class ExperimentApi {
.excludeFieldsWithoutExposeAnnotation()
.create();
@Value("#{'${workflow.experimentUrl:http://hbps1.chuv.ch:8087/experiment}'}")
@Value("#{'${workflow.experimentUrl:http://dockerhost:8087/experiment}'}")
private String experimentUrl;
@Value("#{'${workflow.listMethodsUrl:http://hbps1.chuv.ch:8087/list-methods}'}")
@Value("#{'${workflow.listMethodsUrl:http://dockerhost:8087/list-methods}'}")
private String listMethodsUrl;
@Autowired
......
......@@ -23,14 +23,14 @@ import java.net.UnknownHostException;
@Api(value = "/mining", description = "Forward mining API")
public class MiningApi {
@Value("#{'${workflow.miningUrl:http://localhost:8087/mining}'}")
private String miningUrl;
@Value("#{'${workflow.listMethodsUrl:http://hbps1.chuv.ch:8087/list-methods}'}")
private String listMethodsUrl;
@Value("#{'${workflow.exaremeListAlgoUrl:http://localhost:9090/mining/algorithms}'}")
private String exaremeListAlgoUrl;
@Value("#{'${workflow.miningMipUrl:http://hbps1.chuv.ch:8087/mining}'}")
private String miningMipUrl;
@Value("#{'${workflow.exaremeQueryUrl:http://localhost:9090/mining/query}'}")
private String exaremeQueryUrl;
@Value("#{'${workflow.miningExaremeUrl:http://hbps2.chuv.ch:9090/mining/query}'}")
private String miningExaremeQueryUrl;
@ApiOperation(value = "Send a request to the workflow for data mining", response = String.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success") })
......@@ -38,26 +38,22 @@ public class MiningApi {
public ResponseEntity<String> postMining(
@RequestBody @ApiParam(value = "Query for the data mining", required = true) String query
) throws Exception {
try {
StringBuilder results = new StringBuilder();
int code = sendPost(miningUrl, query, results);
// TODO : switch between sources
return new ResponseEntity<>(results.toString(), HttpStatus.valueOf(code));
}
catch(UnknownHostException uhe) {
uhe.printStackTrace();
return new ResponseEntity<>(HttpStatus.BAD_GATEWAY);
StringBuilder response = new StringBuilder();
int code = sendGet(listMethodsUrl, response);
if (code < 200 || code > 299) {
return new ResponseEntity<>(response.toString(), HttpStatus.valueOf(code));
}
return null;
}
@ApiOperation(value = "Send a request to the Exareme service to list available algorithms", response = String.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success") })
@RequestMapping(path = "/exareme/algorithms", method = RequestMethod.GET)
public ResponseEntity<String> getExaremeAlgoList(
) throws Exception {
private ResponseEntity<String> postMipMining(String query) throws Exception {
try {
StringBuilder results = new StringBuilder();
int code = sendGet(exaremeListAlgoUrl, results);
int code = sendPost(miningMipUrl, query, results);
return new ResponseEntity<>(results.toString(), HttpStatus.valueOf(code));
}
......@@ -67,18 +63,13 @@ public class MiningApi {
}
}
@ApiOperation(value = "Send a request to the Exareme service to run an algorithm", response = String.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success") })
@RequestMapping(path = "/exareme/query/{algo}", method = RequestMethod.POST)
public ResponseEntity<String> postExaremeQuery(
@ApiParam(value = "algo", required = true) @PathVariable("algo") String algo,
@RequestBody(required = false) @ApiParam(value = "Query for the data mining") String query
) throws Exception {
public ResponseEntity<String> postExaremeMining(String algo, String query) throws Exception {
try {
/* Launch computation */
String url = exaremeQueryUrl+"/"+algo+"/?format=true";
String url = miningExaremeQueryUrl +"/"+algo+"/?format=true";
StringBuilder results = new StringBuilder();
int code = sendPost(url, query, results);
if (code < 200 || code > 299)
......@@ -91,7 +82,7 @@ public class MiningApi {
/* Wait for result */
url = exaremeQueryUrl+"/"+key+"/status";
url = miningExaremeQueryUrl +"/"+key+"/status";
double progress = 0;
while (progress < 100) {
......@@ -107,7 +98,7 @@ public class MiningApi {
/* Get result */
url = exaremeQueryUrl+"/"+key+"/result";
url = miningExaremeQueryUrl +"/"+key+"/result";
results = new StringBuilder();
code = sendPost(url, query, results);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment