Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
portal-backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
portal-backend
Commits
26b0f3b3
Commit
26b0f3b3
authored
6 years ago
by
Ludovic Claude
Browse files
Options
Downloads
Patches
Plain Diff
Fail to start if additional variables cannot be created from datasets
parent
fe5cc972
No related branches found
No related tags found
1 merge request
!3
[pull] master from LREN-CHUV:master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/eu/hbp/mip/StartupTasks.java
+9
-2
9 additions, 2 deletions
src/main/java/eu/hbp/mip/StartupTasks.java
with
9 additions
and
2 deletions
src/main/java/eu/hbp/mip/StartupTasks.java
+
9
−
2
View file @
26b0f3b3
package
eu.hbp.mip
;
import
akka.actor.ActorRef
;
import
akka.cluster.Cluster
;
import
ch.chuv.lren.woken.messages.datasets.Dataset
;
import
com.google.gson.Gson
;
import
eu.hbp.mip.controllers.DatasetsApi
;
...
...
@@ -40,6 +38,8 @@ public class StartupTasks implements ApplicationListener<ApplicationReadyEvent>
@Override
public
void
onApplicationEvent
(
ApplicationReadyEvent
event
)
{
boolean
variablesRepositoryOk
=
false
;
// 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) )
// Try 5 times, to be more robust in the face of cluster failures / slow startup
...
...
@@ -49,17 +49,24 @@ public class StartupTasks implements ApplicationListener<ApplicationReadyEvent>
final
String
code
=
dataset
.
dataset
().
code
();
Variable
v
=
variableRepository
.
findOne
(
code
);
if
(
v
==
null
)
{
LOGGER
.
info
(
"Store additional variable {}"
,
v
.
getCode
());
v
=
new
Variable
(
code
);
variableRepository
.
save
(
v
);
}
}
LOGGER
.
info
(
"Datasets fetched from Woken"
);
variablesRepositoryOk
=
true
;
break
;
}
catch
(
Exception
e
)
{
variablesRepositoryOk
=
false
;
LOGGER
.
error
(
"Cannot initialise the variable repository. Is the connection to Woken working?"
,
e
);
}
}
if
(!
variablesRepositoryOk
)
{
System
.
exit
(
1
);
}
/*
for (String variableJson: variablesApi.loadVariables()) {
String code = gson.fromJson(variableJson, Variable.class).getCode();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment