Skip to content
Snippets Groups Projects
Commit ce192eb3 authored by Ludovic Claude's avatar Ludovic Claude
Browse files

Fix startup

parent 26b0f3b3
No related branches found
No related tags found
1 merge request!3[pull] master from LREN-CHUV:master
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>eu.hbp.mip</groupId> <groupId>eu.hbp.mip</groupId>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.7.RELEASE</version> <version>1.3.7.RELEASE</version>
<relativePath /> <relativePath/>
</parent> </parent>
<properties> <properties>
...@@ -75,7 +75,17 @@ ...@@ -75,7 +75,17 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId> <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package eu.hbp.mip; package eu.hbp.mip;
import ch.chuv.lren.mip.portal.Reporting;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
...@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class MIPApplication { public class MIPApplication {
public static void main(String[] args) { public static void main(String[] args) {
new Reporting().init();
SpringApplication.run(MIPApplication.class, args); SpringApplication.run(MIPApplication.class, args);
} }
......
...@@ -43,13 +43,14 @@ public class StartupTasks implements ApplicationListener<ApplicationReadyEvent> ...@@ -43,13 +43,14 @@ public class StartupTasks implements ApplicationListener<ApplicationReadyEvent>
// Pre-fill the local variable repository with the list of datasets, interpreted here as variables // Pre-fill the local variable repository with the list of datasets, interpreted here as variables
// (a bit like a categorical variable can be split into a set of variables (a.k.a one hot encoding in Data science) ) // (a bit like a categorical variable can be split into a set of variables (a.k.a one hot encoding in Data science) )
// Try 5 times, to be more robust in the face of cluster failures / slow startup // Try 5 times, to be more robust in the face of cluster failures / slow startup
LOGGER.info("Prefill variable repository with datasets...");
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
try { try {
for (Dataset dataset : datasetsApi.fetchDatasets()) { for (Dataset dataset : datasetsApi.fetchDatasets()) {
final String code = dataset.dataset().code(); final String code = dataset.dataset().code();
Variable v = variableRepository.findOne(code); Variable v = variableRepository.findOne(code);
if (v == null) { if (v == null) {
LOGGER.info("Store additional variable {}", v.getCode()); LOGGER.info("Store additional variable {}", code);
v = new Variable(code); v = new Variable(code);
variableRepository.save(v); variableRepository.save(v);
} }
......
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