Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
aeb05b06
Commit
aeb05b06
authored
Apr 24, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse sysbench results
parent
7ebd6258
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
405 additions
and
234 deletions
+405
-234
AnsibleOutputService.java
...ava/nl/uva/sne/drip/api/service/AnsibleOutputService.java
+34
-11
BenchmarkResultService.java
...a/nl/uva/sne/drip/api/service/BenchmarkResultService.java
+46
-2
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+116
-9
AnsibleOutputController.java
.../nl/uva/sne/drip/api/v1/rest/AnsibleOutputController.java
+2
-2
BenchmarkController.java
...java/nl/uva/sne/drip/api/v1/rest/BenchmarkController.java
+99
-0
MessageGenerator.java
.../java/nl/uva/sne/drip/commons/utils/MessageGenerator.java
+9
-22
AnsibleOutput.java
.../uva/sne/drip/data/v1/external/ansible/AnsibleOutput.java
+1
-2
AnsibleResult.java
.../uva/sne/drip/data/v1/external/ansible/AnsibleResult.java
+23
-28
AnsibleResult_.java
...uva/sne/drip/data/v1/external/ansible/AnsibleResult_.java
+0
-142
BenchmarkResult.java
...va/sne/drip/data/v1/external/ansible/BenchmarkResult.java
+1
-3
SysbenchCPUBenchmark.java
...e/drip/data/v1/external/ansible/SysbenchCPUBenchmark.java
+74
-13
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/AnsibleOutputService.java
View file @
aeb05b06
...
...
@@ -23,6 +23,7 @@ import nl.uva.sne.drip.api.dao.AnsibleOutputDao;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.data.v1.external.User
;
import
nl.uva.sne.drip.data.v1.external.ansible.AnsibleOutput
;
import
nl.uva.sne.drip.data.v1.external.ansible.AnsibleResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
org.springframework.security.access.prepost.PostFilter
;
...
...
@@ -43,11 +44,11 @@ public class AnsibleOutputService {
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
AnsibleOutput
findOne
(
String
id
)
{
AnsibleOutput
creds
=
ansibleOutputDao
.
findOne
(
id
);
if
(
creds
==
null
)
{
AnsibleOutput
ansibleOut
=
ansibleOutputDao
.
findOne
(
id
);
if
(
ansibleOut
==
null
)
{
throw
new
NotFoundException
();
}
return
creds
;
return
ansibleOut
;
}
@PostFilter
(
"(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
...
...
@@ -57,19 +58,19 @@ public class AnsibleOutputService {
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
AnsibleOutput
delete
(
String
id
)
{
AnsibleOutput
creds
=
ansibleOutputDao
.
findOne
(
id
);
if
(
creds
==
null
)
{
AnsibleOutput
ansibleOut
=
ansibleOutputDao
.
findOne
(
id
);
if
(
ansibleOut
==
null
)
{
throw
new
NotFoundException
();
}
ansibleOutputDao
.
delete
(
creds
);
return
creds
;
ansibleOutputDao
.
delete
(
ansibleOut
);
return
ansibleOut
;
}
public
AnsibleOutput
save
(
AnsibleOutput
clusterCred
)
{
public
AnsibleOutput
save
(
AnsibleOutput
ansibleOut
)
{
User
user
=
(
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
String
owner
=
user
.
getUsername
();
clusterCred
.
setOwner
(
owner
);
return
ansibleOutputDao
.
save
(
clusterCred
);
ansibleOut
.
setOwner
(
owner
);
return
ansibleOutputDao
.
save
(
ansibleOut
);
}
@PostAuthorize
(
"(hasRole('ROLE_ADMIN'))"
)
...
...
@@ -81,9 +82,31 @@ public class AnsibleOutputService {
List
<
AnsibleOutput
>
all
=
findAll
();
Set
<
String
>
hashset
=
new
HashSet
<>();
for
(
AnsibleOutput
ans
:
all
)
{
hashset
.
add
(
ans
.
getAnsiibleResult
().
getCmd
().
get
(
0
));
AnsibleResult
res
=
ans
.
getAnsibleResult
();
if
(
res
!=
null
)
{
List
<
String
>
commandList
=
res
.
getCmd
();
if
(
commandList
!=
null
)
{
hashset
.
add
(
commandList
.
get
(
0
));
}
}
}
return
new
ArrayList
<>(
hashset
);
}
public
List
<
AnsibleOutput
>
findByCommand
(
String
command
)
{
List
<
AnsibleOutput
>
all
=
findAll
();
List
<
AnsibleOutput
>
filtered
=
new
ArrayList
<>();
for
(
AnsibleOutput
ans
:
all
)
{
AnsibleResult
res
=
ans
.
getAnsibleResult
();
if
(
res
!=
null
)
{
List
<
String
>
commandList
=
res
.
getCmd
();
if
(
commandList
!=
null
&&
commandList
.
get
(
0
).
equals
(
command
))
{
filtered
.
add
(
ans
);
}
}
}
return
filtered
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/BenchmarkResultService.java
View file @
aeb05b06
...
...
@@ -15,9 +15,16 @@
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
service
;
import
java.util.List
;
import
nl.uva.sne.drip.api.dao.BenchmarkResultDao
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.data.v1.external.User
;
import
nl.uva.sne.drip.data.v1.external.ansible.BenchmarkResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
org.springframework.security.access.prepost.PostFilter
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.stereotype.Service
;
/**
...
...
@@ -31,6 +38,43 @@ public class BenchmarkResultService {
@Autowired
private
BenchmarkResultDao
benchmarkResultDao
;
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
BenchmarkResult
findOne
(
String
id
)
{
BenchmarkResult
benchmarkResult
=
benchmarkResultDao
.
findOne
(
id
);
if
(
benchmarkResult
==
null
)
{
throw
new
NotFoundException
();
}
return
benchmarkResult
;
}
@PostFilter
(
"(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
List
<
BenchmarkResult
>
findAll
()
{
return
benchmarkResultDao
.
findAll
();
}
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
BenchmarkResult
delete
(
String
id
)
{
BenchmarkResult
benchmarkResult
=
benchmarkResultDao
.
findOne
(
id
);
if
(
benchmarkResult
==
null
)
{
throw
new
NotFoundException
();
}
benchmarkResultDao
.
delete
(
benchmarkResult
);
return
benchmarkResult
;
}
public
BenchmarkResult
save
(
BenchmarkResult
benchmarkResult
)
{
User
user
=
(
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
String
owner
=
user
.
getUsername
();
benchmarkResult
.
setOwner
(
owner
);
return
benchmarkResultDao
.
save
(
benchmarkResult
);
}
@PostAuthorize
(
"(hasRole('ROLE_ADMIN'))"
)
public
void
deleteAll
()
{
benchmarkResultDao
.
deleteAll
();
}
public
List
<
BenchmarkResult
>
findBySysbench
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.s
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
aeb05b06
...
...
@@ -18,6 +18,7 @@ package nl.uva.sne.drip.api.service;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -26,7 +27,6 @@ import java.util.Map;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.api.dao.AnsibleOutputDao
;
import
nl.uva.sne.drip.api.dao.DeployDao
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.rpc.DRIPCaller
;
...
...
@@ -51,8 +51,12 @@ import org.springframework.security.core.context.SecurityContextHolder;
import
org.springframework.stereotype.Service
;
import
nl.uva.sne.drip.api.dao.KeyPairDao
;
import
nl.uva.sne.drip.api.exception.KeyException
;
import
nl.uva.sne.drip.commons.utils.MessageGenerator
;
import
nl.uva.sne.drip.data.v1.external.KeyPair
;
import
nl.uva.sne.drip.data.v1.external.ansible.AnsibleOutput
;
import
nl.uva.sne.drip.data.v1.external.ansible.AnsibleResult
;
import
nl.uva.sne.drip.data.v1.external.ansible.BenchmarkResult
;
import
nl.uva.sne.drip.data.v1.external.ansible.SysbenchCPUBenchmark
;
/**
*
...
...
@@ -83,6 +87,9 @@ public class DeployService {
@Autowired
private
PlaybookService
playbookService
;
@Autowired
private
BenchmarkResultService
benchmarkResultService
;
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
DeployResponse
findOne
(
String
id
)
{
DeployResponse
creds
=
deployDao
.
findOne
(
id
);
...
...
@@ -121,11 +128,12 @@ public class DeployService {
deployInfo
.
getManagerType
().
toLowerCase
(),
deployInfo
.
getConfigurationID
());
// Message response = MessageGenerator.generateArtificialMessage(System.getProperty("user.home")
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "deployer_ansible_response_benchmark.json");
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
Message
response
=
MessageGenerator
.
generateArtificialMessage
(
System
.
getProperty
(
"user.home"
)
+
File
.
separator
+
"workspace"
+
File
.
separator
+
"DRIP"
+
File
.
separator
+
"docs"
+
File
.
separator
+
"json_samples"
+
File
.
separator
+
"deployer_ansible_response_benchmark.json"
);
// Message response = (deployer.call(deployerInvokationMessage));
List
<
MessageParameter
>
params
=
response
.
getParameters
();
DeployResponse
deploy
=
handleResponse
(
params
,
deployInfo
);
deploy
.
setProvisionID
(
deployInfo
.
getProvisionID
());
...
...
@@ -252,12 +260,10 @@ public class DeployService {
for
(
AnsibleOutput
ansOut
:
outputList
)
{
Map
<
String
,
Object
>
map
=
provisionService
.
findOne
(
deployInfo
.
getProvisionID
()).
getKeyValue
();
String
nodeType
=
nodeTypeCahche
.
get
(
ansOut
.
getHost
());
String
domain
=
domainCahche
.
get
(
ansOut
.
getHost
());
if
(
nodeType
==
null
)
{
List
<
Map
<
String
,
Object
>>
components
=
(
List
<
Map
<
String
,
Object
>>)
map
.
get
(
"components"
);
for
(
Map
<
String
,
Object
>
component
:
components
)
{
String
publicAddress
=
(
String
)
component
.
get
(
"public_address"
);
if
(
publicAddress
.
equals
(
ansOut
.
getHost
()))
{
...
...
@@ -266,7 +272,7 @@ public class DeployService {
domain
=
(
String
)
component
.
get
(
"domain"
);
nodeTypeCahche
.
put
(
ansOut
.
getHost
(),
nodeType
);
domainCahche
.
put
(
ansOut
.
getHost
(),
value
);
domainCahche
.
put
(
ansOut
.
getHost
(),
domain
);
// ansOut.setCloudProviderName("");
break
;
}
...
...
@@ -276,6 +282,9 @@ public class DeployService {
ansOut
.
setCloudDeploymentDomain
(
domain
);
ansOut
.
setProvisionID
(
deployInfo
.
getProvisionID
());
ansOut
=
ansibleOutputService
.
save
(
ansOut
);
BenchmarkResult
benchmarkResult
=
parseToBenchmarkResult
(
ansOut
);
benchmarkResultService
.
save
(
benchmarkResult
);
outputListIds
.
add
(
ansOut
.
getId
());
}
deployResponse
.
setAnsibleOutputList
(
outputListIds
);
...
...
@@ -283,4 +292,102 @@ public class DeployService {
}
return
deployResponse
;
}
private
BenchmarkResult
parseToBenchmarkResult
(
AnsibleOutput
ansOut
)
{
AnsibleResult
res
=
ansOut
.
getAnsibleResult
();
if
(
res
!=
null
)
{
List
<
String
>
cmdList
=
res
.
getCmd
();
if
(
cmdList
!=
null
)
{
switch
(
cmdList
.
get
(
0
))
{
case
"sysbench"
:
String
[]
out
=
res
.
getStdout
().
split
(
"\n"
);
String
version
=
getSysbeanchVersion
(
out
[
0
]);
int
numOfThreads
=
getNumberOfThreads
(
out
[
3
]);
Double
executionTime
=
getExecutionTime
(
out
[
14
]);
int
totalNumberOfEvents
=
getTotalNumberOfEvents
(
out
[
15
]);
long
minExecutionTimePerRequest
=
getMinExecutionTimePerRequest
(
out
[
18
]);
long
avgExecutionTimePerRequest
=
getAvgExecutionTimePerRequest
(
out
[
19
]);
long
maxExecutionTimePerRequest
=
getMaxExecutionTimePerRequest
(
out
[
20
]);
long
approx95Percentile
=
getApprox95Percentile
(
out
[
21
]);
double
avgEventsPerThread
=
getAvgEventsPerThread
(
out
[
24
]);
double
stddevEventsPerThread
=
getStddevEventsPerThread
(
out
[
24
]);
double
avgExecTimePerThread
=
getAvgExecTimePerThread
(
out
[
24
]);
double
stddevExecTimePerThread
=
getStddevExecTimePerThread
(
out
[
24
]);
SysbenchCPUBenchmark
b
=
new
SysbenchCPUBenchmark
();
b
.
setSysbenchVersion
(
version
);
b
.
setNumberOfThreads
(
numOfThreads
);
b
.
setExecutionTime
(
executionTime
*
1000
);
b
.
setTotalNumberOfEvents
(
totalNumberOfEvents
);
b
.
setAvgEventsPerThread
(
avgEventsPerThread
);
b
.
setStddevEventsPerThread
(
stddevEventsPerThread
);
b
.
setAvgExecTimePerThread
(
avgExecTimePerThread
*
1000
);
b
.
setStddevExecTimePerThread
(
stddevExecTimePerThread
);
b
.
setApprox95Percentile
(
approx95Percentile
);
b
.
setMinExecutionTimePerRequest
(
minExecutionTimePerRequest
);
b
.
setAvgExecTimePerThread
(
avgExecutionTimePerRequest
);
b
.
setMaxExecutionTimePerRequest
(
maxExecutionTimePerRequest
);
return
b
;
default
:
return
null
;
}
}
}
return
null
;
}
private
String
getSysbeanchVersion
(
String
string
)
{
return
string
.
replaceAll
(
"sysbench"
,
""
).
replaceAll
(
": multi-threaded system evaluation benchmark"
,
""
);
}
private
int
getNumberOfThreads
(
String
string
)
{
return
Integer
.
valueOf
(
string
.
replaceAll
(
"Number of threads: "
,
""
));
}
private
Double
getExecutionTime
(
String
string
)
{
return
Double
.
valueOf
(
string
.
replaceAll
(
"total time:"
,
""
).
replaceAll
(
"s"
,
""
).
trim
());
}
private
int
getTotalNumberOfEvents
(
String
string
)
{
return
Integer
.
valueOf
(
string
.
replaceAll
(
"total number of events:"
,
""
).
replaceAll
(
"s"
,
""
).
trim
());
}
private
Double
getAvgEventsPerThread
(
String
string
)
{
return
Double
.
valueOf
(
string
.
replaceAll
(
"events (avg/stddev):"
,
""
).
replaceAll
(
"s"
,
""
).
trim
().
split
(
"/"
)[
0
]);
}
private
Double
getStddevEventsPerThread
(
String
string
)
{
return
Double
.
valueOf
(
string
.
replaceAll
(
"events (avg/stddev):"
,
""
).
replaceAll
(
"s"
,
""
).
trim
().
split
(
"/"
)[
1
]);
}
private
Double
getAvgExecTimePerThread
(
String
string
)
{
return
Double
.
valueOf
(
string
.
replaceAll
(
"execution time (avg/stddev):"
,
""
).
replaceAll
(
"s"
,
""
).
trim
().
split
(
"/"
)[
0
]);
}
private
Double
getStddevExecTimePerThread
(
String
string
)
{
return
Double
.
valueOf
(
string
.
replaceAll
(
"execution time (avg/stddev):"
,
""
).
replaceAll
(
"s"
,
""
).
trim
().
split
(
"/"
)[
0
]);
}
private
long
getMinExecutionTimePerRequest
(
String
string
)
{
return
Long
.
valueOf
(
string
.
replaceAll
(
"min:"
,
""
).
replaceAll
(
"ms"
,
""
).
trim
());
}
private
long
getAvgExecutionTimePerRequest
(
String
string
)
{
return
Long
.
valueOf
(
string
.
replaceAll
(
"avg:"
,
""
).
replaceAll
(
"ms"
,
""
).
trim
());
}
private
long
getMaxExecutionTimePerRequest
(
String
string
)
{
return
Long
.
valueOf
(
string
.
replaceAll
(
"max:"
,
""
).
replaceAll
(
"ms"
,
""
).
trim
());
}
private
long
getApprox95Percentile
(
String
string
)
{
return
Long
.
valueOf
(
string
.
replaceAll
(
"approx. 95 percentile::"
,
""
).
replaceAll
(
"ms"
,
""
).
trim
());
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/AnsibleOutputController.java
View file @
aeb05b06
...
...
@@ -58,8 +58,8 @@ public class AnsibleOutputController {
@RequestMapping
(
method
=
RequestMethod
.
GET
,
params
=
{
"command"
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
AnsibleOutput
getByCommand
(
@RequestParam
(
value
=
"command"
)
String
command
)
{
return
null
;
List
<
AnsibleOutput
>
getByCommand
(
@RequestParam
(
value
=
"command"
)
String
command
)
{
return
ansibleOutputService
.
findByCommand
(
command
)
;
}
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/Benchmark.java
→
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/Benchmark
Controller
.java
View file @
aeb05b06
...
...
@@ -17,14 +17,23 @@ package nl.uva.sne.drip.api.v1.rest;
import
com.webcohesion.enunciate.metadata.rs.ResponseCode
;
import
com.webcohesion.enunciate.metadata.rs.StatusCodes
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.security.RolesAllowed
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.service.BenchmarkResultService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.data.v1.external.ansible.BenchmarkResult
;
import
nl.uva.sne.drip.data.v1.external.ansible.BenchmarkResult
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* This controller is responsible for deploying a cluster on provisoned
* resources.
*
* @author S. Koulouzis
*/
...
...
@@ -34,7 +43,57 @@ import org.springframework.stereotype.Controller;
@StatusCodes
({
@ResponseCode
(
code
=
401
,
condition
=
"Bad credentials"
)
})
public
class
Benchmark
{
public
class
Benchmark
Controller
{
private
BenchmarkResultService
benchmarkResultService
;
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
BenchmarkResult
get
(
@PathVariable
(
"id"
)
String
id
)
{
BenchmarkResult
resp
=
benchmarkResultService
.
findOne
(
id
);
if
(
resp
==
null
)
{
throw
new
NotFoundException
();
}
return
resp
;
}
@RequestMapping
(
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
List
<
BenchmarkResult
>
getBySysbench
()
{
return
benchmarkResultService
.
findBySysbench
();
}
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
List
<
String
>
getIds
()
{
List
<
BenchmarkResult
>
all
=
benchmarkResultService
.
findAll
();
List
<
String
>
ids
=
new
ArrayList
<>(
all
.
size
());
for
(
BenchmarkResult
pi
:
all
)
{
ids
.
add
(
pi
.
getId
());
}
return
ids
;
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
BenchmarkResult
Key
=
benchmarkResultService
.
findOne
(
id
);
if
(
Key
!=
null
)
{
benchmarkResultService
.
delete
(
id
);
return
"Deleted : "
+
id
;
}
throw
new
NotFoundException
();
}
@RequestMapping
(
value
=
"/all"
,
method
=
RequestMethod
.
DELETE
)
@RolesAllowed
({
UserService
.
ADMIN
})
public
@ResponseBody
String
deleteAll
()
{
benchmarkResultService
.
deleteAll
();
return
"Done"
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/utils/MessageGenerator.java
View file @
aeb05b06
...
...
@@ -31,35 +31,22 @@ import org.json.JSONException;
public
class
MessageGenerator
{
public
static
Message
generateArtificialMessage
(
String
path
)
throws
IOException
,
TimeoutException
,
InterruptedException
,
JSONException
{
// String strResponse = "{\"creationDate\":1488368936945,\"parameters\":["
// + "{\"name\":\"f293ff03-4b82-49e2-871a-899aadf821ce\","
// + "\"encoding\":\"UTF-8\",\"value\":"
// + "\"publicKeyPath: /tmp/Input-4007028381500/user.pem\\nuserName: "
// + "zh9314\\nsubnets:\\n- {name: s1, subnet: 192.168.10.0, "
// + "netmask: 255.255.255.0}\\ncomponents:\\n- "
// + "name: faab6756-61b6-4800-bffa-ae9d859a9d6c\\n "
// + "type: Switch.nodes.Compute\\n nodetype: t2.medium\\n "
// + "OStype: Ubuntu 16.04\\n domain: ec2.us-east-1.amazonaws.com\\n "
// + "script: /tmp/Input-4007028381500/guiscipt.sh\\n "
// + "installation: null\\n role: master\\n "
// + "dockers: mogswitch/InputDistributor\\n "
// + "public_address: 54.144.0.91\\n instanceId: i-0e78cbf853328b820\\n "
// + "ethernet_port:\\n - {name: p1, subnet_name: s1, "
// + "address: 192.168.10.10}\\n- name: 1c75eedf-8497-46fe-aeb8-dab6a62154cb\\n "
// + "type: Switch.nodes.Compute\\n nodetype: t2.medium\\n OStype: Ubuntu 16.04\\n domain: ec2.us-east-1.amazonaws.com\\n script: /tmp/Input-4007028381500/guiscipt.sh\\n installation: null\\n role: slave\\n dockers: mogswitch/ProxyTranscoder\\n public_address: 34.207.254.160\\n instanceId: i-0a99ea18fcc77ed7a\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"54.144.0.91 ubuntu /tmp/Input-4007028381500/Virginia.pem master\\n34.207.254.160 ubuntu /tmp/Input-4007028381500/Virginia.pem slave\\n\"}]}";
// String strResponse = "{\"creationDate\":1488805337447,\"parameters\":[{\"name\":\"2e5dafb6-5a1c-4a66-9dca-5841f99ea735\",\"encoding\":\"UTF-8\",\"value\":\"publicKeyPath: /tmp/Input-11594765342486/user.pem\\nuserName: zh9314\\nsubnets:\\n- {name: s1, subnet: 192.168.10.0, netmask: 255.255.255.0}\\ncomponents:\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: master\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.10}\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: slave\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem master\\n34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem slave\\n\"}]}";
String
strResponse
=
FileUtils
.
readFileToString
(
new
File
(
path
));
String
clean
=
strResponse
;
if
(
strResponse
.
contains
(
"'null'"
))
{
strResponse
=
strResponse
.
replaceAll
(
"'null'"
,
"null"
).
replaceAll
(
"\'"
,
"\""
).
replaceAll
(
" "
,
""
);
clean
=
strResponse
.
replaceAll
(
"'null'"
,
"null"
).
replaceAll
(
"\'"
,
"\""
).
replaceAll
(
" "
,
""
);
}
if
(
strResponse
.
contains
(
"\"value\":{\""
))
{
return
Converter
.
string2Message
(
strResponse
);
if
(
clean
.
contains
(
"\"value\":{\""
))
{
return
Converter
.
string2Message
(
clean
);
}
if
(
clean
.
contains
(
"\"null\""
))
{
clean
=
clean
.
replaceAll
(
"\"null\""
,
"null"
);
}
ObjectMapper
mapper
=
new
ObjectMapper
();
mapper
.
configure
(
JsonParser
.
Feature
.
ALLOW_SINGLE_QUOTES
,
true
);
return
mapper
.
readValue
(
strResponse
,
Message
.
class
);
return
mapper
.
readValue
(
clean
,
Message
.
class
);
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/AnsibleOutput.java
View file @
aeb05b06
...
...
@@ -49,7 +49,6 @@ public class AnsibleOutput extends OwnedObject {
@JsonProperty
(
"result"
)
private
AnsibleResult
result
;
@Indexed
@JsonProperty
(
"provisionID"
)
private
String
provisionID
;
...
...
@@ -64,7 +63,7 @@ public class AnsibleOutput extends OwnedObject {
}
@JsonProperty
(
"result"
)
public
AnsibleResult
getAnsi
i
bleResult
()
{
public
AnsibleResult
getAnsibleResult
()
{
return
result
;
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/AnsibleResult.java
View file @
aeb05b06
...
...
@@ -25,7 +25,6 @@ import java.util.List;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Date
;
import
org.springframework.data.mongodb.core.index.Indexed
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
...
...
@@ -33,20 +32,18 @@ public class AnsibleResult {
@JsonProperty
(
"msg"
)
private
String
msg
;
@JsonProperty
(
"changed"
)
private
Boolean
changed
;
@Indexed
@JsonProperty
(
"end"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss.SSSSSS"
)
private
Date
end
;
@Indexed
@JsonProperty
(
"start"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss.SSSSSS"
)
private
Date
start
;
@Indexed
@JsonProperty
(
"delta"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"HH:mm:ss.SSSSSS"
)
private
Date
delta
;
...
...
@@ -60,12 +57,11 @@ public class AnsibleResult {
@JsonProperty
(
"cmd"
)
private
List
<
String
>
cmd
;
@JsonProperty
(
"stdout_lines"
)
private
List
<
String
>
stdout_lines
;
@JsonProperty
(
"results"
)
private
List
<
AnsibleResult_
>
results
=
null
;
// @JsonProperty("stdout_lines")
// private List<String> stdout_lines;
// @JsonProperty("results")
// private List<AnsibleResult_> results = null;
@JsonProperty
(
"msg"
)
public
String
getMsg
()
{
return
msg
;
...
...
@@ -86,16 +82,15 @@ public class AnsibleResult {
this
.
changed
=
changed
;
}
@JsonProperty
(
"results"
)
public
List
<
AnsibleResult_
>
getAnsibleResults
()
{
return
results
;
}
@JsonProperty
(
"results"
)
public
void
setAnsibleResults
(
List
<
AnsibleResult_
>
results
)
{
this
.
results
=
results
;
}
// @JsonProperty("results")
// public List<AnsibleResult_> getAnsibleResults() {
// return results;
// }
//
// @JsonProperty("results")
// public void setAnsibleResults(List<AnsibleResult_> results) {
// this.results = results;
// }
@JsonProperty
(
"end"
)
public
Date
getEnd
()
{
return
end
;
...
...
@@ -156,14 +151,14 @@ public class AnsibleResult {
this
.
delta
=
delta
;
}
@JsonProperty
(
"stdout_lines"
)
public
List
<
String
>
getStdout_lines
()
{
return
stdout_lines
;
}
@JsonProperty
(
"stdout_lines"
)
public
void
setStdout_lines
(
List
<
String
>
stdout_lines
)
{
this
.
stdout_lines
=
stdout_lines
;
}
//
@JsonProperty("stdout_lines")
//
public List<String> getStdout_lines() {
//
return stdout_lines;
//
}
//
//
@JsonProperty("stdout_lines")
//
public void setStdout_lines(List<String> stdout_lines) {
//
this.stdout_lines = stdout_lines;
//
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/AnsibleResult_.java
deleted
100644 → 0
View file @
7ebd6258
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
.
ansible
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.fasterxml.jackson.annotation.JsonAnyGetter
;
import
com.fasterxml.jackson.annotation.JsonAnySetter
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonPropertyOrder
;
/**
*
* @author S. Koulouzis
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonPropertyOrder
({
"_ansible_parsed"
,
"changed"
,
"_ansible_no_log"
,
"cache_updated"
,
"_ansible_item_result"
,
"item"
,
"invocation"
,
"cache_update_time"
})
public
class
AnsibleResult_
{
@JsonProperty
(
"_ansible_parsed"
)
private
Boolean
ansibleParsed
;
@JsonProperty
(
"changed"
)
private
Boolean
changed
;
@JsonProperty
(
"_ansible_no_log"
)
private
Boolean
ansibleNoLog
;
@JsonProperty
(
"cache_updated"
)
private
Boolean
cacheUpdated
;
@JsonProperty
(
"_ansible_item_result"
)
private
Boolean
ansibleItemAnsibleResult
;
@JsonProperty
(
"item"
)
private
List
<
String
>
item
=
null
;
@JsonProperty
(
"invocation"
)
private
Invocation
invocation
;
@JsonProperty
(
"cache_update_time"
)
private
Integer
cacheUpdateTime
;
@JsonProperty
(
"_ansible_parsed"
)
public
Boolean
getAnsibleParsed
()
{
return
ansibleParsed
;
}
@JsonProperty
(
"_ansible_parsed"
)
public
void
setAnsibleParsed
(
Boolean
ansibleParsed
)
{
this
.
ansibleParsed
=
ansibleParsed
;
}
@JsonProperty
(
"changed"
)
public
Boolean
getChanged
()
{
return
changed
;
}
@JsonProperty
(
"changed"
)
public
void
setChanged
(
Boolean
changed
)
{
this
.
changed
=
changed
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
Boolean
getAnsibleNoLog
()
{
return
ansibleNoLog
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
void
setAnsibleNoLog
(
Boolean
ansibleNoLog
)
{
this
.
ansibleNoLog
=
ansibleNoLog
;
}
@JsonProperty
(
"cache_updated"
)
public
Boolean
getCacheUpdated
()
{
return
cacheUpdated
;
}
@JsonProperty
(
"cache_updated"
)
public
void
setCacheUpdated
(
Boolean
cacheUpdated
)
{
this
.
cacheUpdated
=
cacheUpdated
;
}
@JsonProperty
(
"_ansible_item_result"
)
public
Boolean
getAnsibleItemAnsibleResult
()
{
return
ansibleItemAnsibleResult
;
}
@JsonProperty
(
"_ansible_item_result"
)
public
void
setAnsibleItemAnsibleResult
(
Boolean
ansibleItemAnsibleResult
)
{
this
.
ansibleItemAnsibleResult
=
ansibleItemAnsibleResult
;
}
@JsonProperty
(
"item"
)
public
List
<
String
>
getItem
()
{
return
item
;
}
@JsonProperty
(
"item"
)
public
void
setItem
(
List
<
String
>
item
)
{
this
.
item
=
item
;
}
@JsonProperty
(
"invocation"
)
public
Invocation
getInvocation
()
{
return
invocation
;
}
@JsonProperty
(
"invocation"
)
public
void
setInvocation
(
Invocation
invocation
)
{
this
.
invocation
=
invocation
;
}
@JsonProperty
(
"cache_update_time"
)
public
Integer
getCacheUpdateTime
()
{
return
cacheUpdateTime
;
}
@JsonProperty
(
"cache_update_time"
)
public
void
setCacheUpdateTime
(
Integer
cacheUpdateTime
)
{
this
.
cacheUpdateTime
=
cacheUpdateTime
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/BenchmarkResult.java
View file @
aeb05b06
...
...
@@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Date
;
import
nl.uva.sne.drip.data.v1.external.OwnedObject
;
import
org.springframework.data.mongodb.core.index.Indexed
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
...
...
@@ -29,9 +28,8 @@ import org.springframework.data.mongodb.core.mapping.Document;
@Document
public
class
BenchmarkResult
extends
OwnedObject
{
@Indexed
private
String
host
;
@Indexed
private
String
cloudProvider
;
@JsonProperty
(
"end"
)
...
...
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/SysbenchCPUBenchmark.java
View file @
aeb05b06
...
...
@@ -26,13 +26,18 @@ public class SysbenchCPUBenchmark extends BenchmarkResult {
private
String
sysbenchVersion
;
private
int
numberOfThreads
;
private
int
totalNumberOfEvents
;
private
double
executionTime
;
private
int
avgEventsPerThread
;
private
int
stddevEventsPerThread
;
private
int
totalNumberOfEvents
;
private
double
avgEventsPerThread
;
private
double
stddevEventsPerThread
;
private
double
avgExecTimePerThread
;
private
double
stddevExecTimePerThread
;
private
int
avgExecTimePerThread
;
private
int
stddevExecTimePerThread
;
private
double
minExecutionTimePerRequest
;
private
double
avgExecutionTimePerRequest
;
private
double
maxExecutionTimePerRequest
;
private
double
approx95Percentile
;
/**
* @return the sysbenchVersion
...
...
@@ -93,57 +98,113 @@ public class SysbenchCPUBenchmark extends BenchmarkResult {
/**
* @return the avgEventsPerThread
*/
public
int
getAvgEventsPerThread
()
{
public
double
getAvgEventsPerThread
()
{
return
avgEventsPerThread
;
}
/**
* @param avgEventsPerThread the avgEventsPerThread to set
*/
public
void
setAvgEventsPerThread
(
int
avgEventsPerThread
)
{
public
void
setAvgEventsPerThread
(
double
avgEventsPerThread
)
{
this
.
avgEventsPerThread
=
avgEventsPerThread
;
}
/**
* @return the stddevEventsPerThread
*/
public
int
getStddevEventsPerThread
()
{
public
double
getStddevEventsPerThread
()
{
return
stddevEventsPerThread
;
}
/**
* @param stddevEventsPerThread the stddevEventsPerThread to set
*/
public
void
setStddevEventsPerThread
(
int
stddevEventsPerThread
)
{
public
void
setStddevEventsPerThread
(
double
stddevEventsPerThread
)
{
this
.
stddevEventsPerThread
=
stddevEventsPerThread
;
}
/**
* @return the avgExecTimePerThread
*/
public
int
getAvgExecTimePerThread
()
{
public
double
getAvgExecTimePerThread
()
{
return
avgExecTimePerThread
;
}
/**
* @param avgExecTimePerThread the avgExecTimePerThread to set
*/
public
void
setAvgExecTimePerThread
(
int
avgExecTimePerThread
)
{
public
void
setAvgExecTimePerThread
(
double
avgExecTimePerThread
)
{
this
.
avgExecTimePerThread
=
avgExecTimePerThread
;
}
/**
* @return the stddevExecTimePerThread
*/
public
int
getStddevExecTimePerThread
()
{
public
double
getStddevExecTimePerThread
()
{
return
stddevExecTimePerThread
;
}
/**
* @param stddevExecTimePerThread the stddevExecTimePerThread to set
*/
public
void
setStddevExecTimePerThread
(
int
stddevExecTimePerThread
)
{
public
void
setStddevExecTimePerThread
(
double
stddevExecTimePerThread
)
{
this
.
stddevExecTimePerThread
=
stddevExecTimePerThread
;
}
/**
* @return the minExecutionTimePerRequest
*/
public
double
getMinExecutionTimePerRequest
()
{
return
minExecutionTimePerRequest
;
}
/**
* @param minExecutionTimePerRequest the minExecutionTimePerRequest to set
*/
public
void
setMinExecutionTimePerRequest
(
double
minExecutionTimePerRequest
)
{
this
.
minExecutionTimePerRequest
=
minExecutionTimePerRequest
;
}
/**
* @return the avgExecutionTimePerRequest
*/
public
double
getAvgExecutionTimePerRequest
()
{
return
avgExecutionTimePerRequest
;
}
/**
* @param avgExecutionTimePerRequest the avgExecutionTimePerRequest to set
*/
public
void
setAvgExecutionTimePerRequest
(
double
avgExecutionTimePerRequest
)
{
this
.
avgExecutionTimePerRequest
=
avgExecutionTimePerRequest
;
}
/**
* @return the maxExecutionTimePerRequest
*/
public
double
getMaxExecutionTimePerRequest
()
{
return
maxExecutionTimePerRequest
;
}
/**
* @param maxExecutionTimePerRequest the maxExecutionTimePerRequest to set
*/
public
void
setMaxExecutionTimePerRequest
(
double
maxExecutionTimePerRequest
)
{
this
.
maxExecutionTimePerRequest
=
maxExecutionTimePerRequest
;
}
/**
* @return the approx95Percentile
*/
public
double
getApprox95Percentile
()
{
return
approx95Percentile
;
}
/**
* @param approx95Percentile the approx95Percentile to set
*/
public
void
setApprox95Percentile
(
double
approx95Percentile
)
{
this
.
approx95Percentile
=
approx95Percentile
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment