Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
c96ef06f
Commit
c96ef06f
authored
7 years ago
by
Rowan Powell
Browse files
Options
Downloads
Patches
Plain Diff
Servers now send configure statements only one vm & server each
parent
2cf9fa36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mediaServiceSim/serviceSim.py
+24
-17
24 additions, 17 deletions
src/mediaServiceSim/serviceSim.py
with
24 additions
and
17 deletions
src/mediaServiceSim/serviceSim.py
+
24
−
17
View file @
c96ef06f
...
@@ -137,6 +137,12 @@ class DemoServer(object):
...
@@ -137,6 +137,12 @@ class DemoServer(object):
self
.
influxURL
=
db_url
# InfluxDB connection URL
self
.
influxURL
=
db_url
# InfluxDB connection URL
self
.
currentTime
=
int
(
round
(
time
.
time
()
*
1000
))
# The current time
self
.
currentTime
=
int
(
round
(
time
.
time
()
*
1000
))
# The current time
def
configure
(
self
,
server_id
,
server_location
):
print
(
"
Configuring
"
)
self
.
configure_VM
()
time
.
sleep
(
1
)
self
.
configure_server
(
server_id
,
server_location
)
def
generate_clients
(
self
):
def
generate_clients
(
self
):
self
.
clients
=
[]
self
.
clients
=
[]
for
i
in
range
(
self
.
clientCount
):
for
i
in
range
(
self
.
clientCount
):
...
@@ -146,21 +152,24 @@ class DemoServer(object):
...
@@ -146,21 +152,24 @@ class DemoServer(object):
def
reportStatus
(
self
):
def
reportStatus
(
self
):
print
(
'
Number of clients:
'
+
str
(
len
(
self
.
clients
)))
print
(
'
Number of clients:
'
+
str
(
len
(
self
.
clients
)))
def
configure_server
s
(
self
):
def
configure_server
(
self
,
server_id
,
server_location
):
print
(
"
Configuring Servers
"
)
print
(
"
Configuring Servers
"
)
server_conf_block
=
[]
server_conf_block
=
[]
ids
=
[
'
A
'
,
'
B
'
,
'
C
'
]
server_conf_block
.
append
(
lp
.
_generateServerConfig
(
server_id
,
server_location
,
8
,
'
100G
'
,
'
1T
'
,
locations
=
[
'
locA
'
,
'
locB
'
,
'
locC
'
]
self
.
_selectDelay
(
0
)))
for
i
,
id
in
enumerate
(
ids
):
server_conf_block
.
append
(
#ids = ['A', 'B', 'C']
lp
.
_generateServerConfig
(
id
,
locations
[
i
],
8
,
'
100G
'
,
'
1T
'
,
self
.
_selectDelay
(
len
(
ids
))))
#locations = ['locA', 'locB', 'locC']
#for i, id in enumerate(ids):
# server_conf_block.append(
# lp._generateServerConfig(id, locations[i], 8, '100G', '1T', self._selectDelay(len(ids))))
self
.
_sendInfluxDataBlock
(
server_conf_block
)
self
.
_sendInfluxDataBlock
(
server_conf_block
)
def
configure_VM
s
(
self
):
def
configure_VM
(
self
):
print
(
"
Configuring VM nodes
"
)
print
(
"
Configuring VM nodes
"
)
VM_conf_block
=
[]
VM_conf_block
=
[]
self
.
_generateVMS
(
'
starting
'
,
1
0
,
VM_conf_block
)
self
.
_generateVMS
(
'
starting
'
,
1
,
VM_conf_block
)
self
.
_generateVMS
(
'
running
'
,
1
0
,
VM_conf_block
)
self
.
_generateVMS
(
'
running
'
,
1
,
VM_conf_block
)
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
...
@@ -178,17 +187,12 @@ class DemoServer(object):
...
@@ -178,17 +187,12 @@ class DemoServer(object):
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
def
_generateVMS
(
self
,
state
,
amount
,
datablock
):
for
i
in
range
(
0
,
amount
):
datablock
.
append
(
lp
.
_generateVMConfig
(
state
,
1
,
'
100G
'
,
'
1T
'
,
self
.
_selectDelay
(
amount
)))
def
iterateService
(
self
):
def
iterateService
(
self
):
# The simulation will run through 'X' iterations of the simulation
# The simulation will run through 'X' iterations of the simulation
# each time this method is called. This allows request/response messages to be
# each time this method is called. This allows request/response messages to be
# batched and sent to the InfluxDB in sensible sized blocks
# batched and sent to the InfluxDB in sensible sized blocks
return
self
.
_executeServiceIteration
(
dc
.
ITERATION_STRIDE
)
return
self
.
_executeServiceIteration
(
dc
.
ITERATION_STRIDE
)
# 'Private' methods ________________________________________________________
def
_executeServiceIteration
(
self
,
count
):
def
_executeServiceIteration
(
self
,
count
):
requestBlock
=
[]
requestBlock
=
[]
...
@@ -254,6 +258,11 @@ class DemoServer(object):
...
@@ -254,6 +258,11 @@ class DemoServer(object):
return
self
.
simIterations
return
self
.
simIterations
# 'Private' methods ________________________________________________________
def
_generateVMS
(
self
,
state
,
amount
,
datablock
):
for
i
in
range
(
0
,
amount
):
datablock
.
append
(
lp
.
_generateVMConfig
(
state
,
1
,
'
100G
'
,
'
1T
'
,
self
.
_selectDelay
(
amount
)))
def
_cpuUsage
(
self
,
clientCount
):
def
_cpuUsage
(
self
,
clientCount
):
cpuUsage
=
randint
(
0
,
10
)
cpuUsage
=
randint
(
0
,
10
)
...
@@ -362,9 +371,7 @@ database_manager.database_up()
...
@@ -362,9 +371,7 @@ database_manager.database_up()
time
.
sleep
(
2
)
time
.
sleep
(
2
)
# configure servers
# configure servers
demoServer
=
DemoServer
(
clients
,
iterations
,
'
http://localhost:8186
'
,
'
testDB
'
)
demoServer
=
DemoServer
(
clients
,
iterations
,
'
http://localhost:8186
'
,
'
testDB
'
)
demoServer
.
reportStatus
()
demoServer
.
configure
(
"
Server1
"
,
"
Southampton
"
)
demoServer
.
configure_servers
()
demoServer
.
configure_VMs
()
# Start simulation
# Start simulation
print
(
"
Starting simulation
"
)
print
(
"
Starting simulation
"
)
while
True
:
while
True
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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