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
f289131a
Commit
f289131a
authored
8 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
a bit of cleaning
parent
62dbeaa7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/hbp/mip/akka/ExperimentActor.java
+12
-0
12 additions, 0 deletions
src/main/java/eu/hbp/mip/akka/ExperimentActor.java
src/main/java/eu/hbp/mip/controllers/ExperimentApi.java
+3
-14
3 additions, 14 deletions
src/main/java/eu/hbp/mip/controllers/ExperimentApi.java
with
15 additions
and
14 deletions
src/main/java/eu/hbp/mip/akka/ExperimentActor.java
+
12
−
0
View file @
f289131a
...
...
@@ -47,15 +47,26 @@ public class ExperimentActor extends UntypedActor {
QueryResult
queryResult
=
(
QueryResult
)
message
;
log
.
info
(
"received query result for : "
+
expUUID
.
toString
());
Experiment
experiment
=
experimentRepository
.
findOne
(
expUUID
);
if
(
experiment
==
null
)
{
log
.
error
(
"Experiment with UUID="
+
expUUID
+
" not found in DB"
);
return
;
}
experiment
.
setResult
(
queryResult
.
data
().
get
());
experiment
.
setFinished
(
new
Date
());
experimentRepository
.
save
(
experiment
);
log
.
info
(
"Experiment "
+
expUUID
+
" updated (finished)"
);
}
else
if
(
message
instanceof
QueryError
)
{
QueryError
queryError
=
(
QueryError
)
message
;
log
.
warning
(
"received query error"
);
Experiment
experiment
=
experimentRepository
.
findOne
(
expUUID
);
if
(
experiment
==
null
)
{
log
.
error
(
"Experiment with UUID="
+
expUUID
+
" not found in DB"
);
return
;
}
experiment
.
setHasServerError
(
true
);
experiment
.
setResult
(
queryError
.
message
());
experimentRepository
.
save
(
experiment
);
...
...
@@ -63,6 +74,7 @@ public class ExperimentActor extends UntypedActor {
experimentRepository
.
save
(
experiment
);
log
.
info
(
"Experiment "
+
expUUID
+
" updated (finished)"
);
}
else
{
unhandled
(
message
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/hbp/mip/controllers/ExperimentApi.java
+
3
−
14
View file @
f289131a
...
...
@@ -23,7 +23,6 @@ import org.apache.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -46,8 +45,6 @@ public class ExperimentApi {
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
ExperimentApi
.
class
);
private
static
final
String
EXAREME_ALGO_JSON_FILE
=
"data/exareme_algorithms.json"
;
private
static
final
Gson
gson
=
new
Gson
();
private
static
final
Gson
gsonOnlyExposed
=
new
GsonBuilder
()
...
...
@@ -56,6 +53,8 @@ public class ExperimentApi {
.
excludeFieldsWithoutExposeAnnotation
()
.
create
();
private
static
final
String
EXAREME_ALGO_JSON_FILE
=
"data/exareme_algorithms.json"
;
private
static
final
String
EXAREME_LR_ALGO
=
"WP_LINEAR_REGRESSION"
;
@Value
(
"#{'${services.woken.experimentUrl:http://dockerhost:8087/experiment}'}"
)
...
...
@@ -79,9 +78,6 @@ public class ExperimentApi {
@Autowired
private
ActorSystem
actorSystem
;
@Autowired
private
ApplicationContext
applicationContext
;
@Value
(
"#{'${akka.woken-path:akka.tcp://woken@127.0.0.1:8088/user/entrypoint}'}"
)
private
String
wokenPath
;
...
...
@@ -216,8 +212,6 @@ public class ExperimentApi {
public
ResponseEntity
listAvailableMethodsAndValidations
()
throws
IOException
{
LOGGER
.
info
(
"List available methods and validations"
);
StringBuilder
response
=
new
StringBuilder
();
ActorSelection
wokenActor
=
actorSystem
.
actorSelection
(
wokenPath
);
ActorRef
simpleActor
=
actorSystem
.
actorOf
(
Props
.
create
(
SimpleActor
.
class
));
wokenActor
.
tell
(
new
MethodsQuery
(),
simpleActor
);
...
...
@@ -292,6 +286,7 @@ public class ExperimentApi {
}
private
void
sendExaremeExperiment
(
Experiment
experiment
)
{
// TODO: integrate Exareme
// this runs in the background. For future optimization: use a thread pool
// new Thread() {
// @Override
...
...
@@ -325,12 +320,6 @@ public class ExperimentApi {
LOGGER
.
info
(
"Experiment updated (finished)"
);
}
private
static
void
setExperimentError
(
IOException
e
,
Experiment
experiment
)
{
experiment
.
setHasError
(
true
);
experiment
.
setHasServerError
(
true
);
experiment
.
setResult
(
e
.
getMessage
());
}
private
static
boolean
isExaremeAlgo
(
ExperimentQuery
expQuery
)
{
return
expQuery
.
getAlgorithms
().
size
()
>=
1
&&
"glm_exareme"
.
equals
(
expQuery
.
getAlgorithms
().
get
(
0
).
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