Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
UNI-KLU
SMART
Commits
d032fb36
Commit
d032fb36
authored
May 12, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Executed time measurements for stage extraction
parent
a04e6d34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
run_time_slicing.py
.../community-detection-microservice/app/run_time_slicing.py
+33
-5
vis_execution_time.py
...tion-microservice/app/visualization/vis_execution_time.py
+9
-0
No files found.
src/data-hub/community-detection-microservice/app/run_time_slicing.py
View file @
d032fb36
...
@@ -5,6 +5,7 @@ if os.path.exists(modules_path):
...
@@ -5,6 +5,7 @@ if os.path.exists(modules_path):
sys
.
path
.
insert
(
1
,
modules_path
)
sys
.
path
.
insert
(
1
,
modules_path
)
import
json
import
json
import
timeit
from
datetime
import
datetime
,
date
from
datetime
import
datetime
,
date
from
db.repository
import
Repository
from
db.repository
import
Repository
from
db.entities.timeslice
import
TimeSlice
from
db.entities.timeslice
import
TimeSlice
...
@@ -53,7 +54,7 @@ def split_clusterset_by_time(layer_name: str, clusters: List[Cluster]) -> Dict[T
...
@@ -53,7 +54,7 @@ def split_clusterset_by_time(layer_name: str, clusters: List[Cluster]) -> Dict[T
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
repo
=
Repository
()
repo
=
Repository
()
repo
.
remove_all_time_slices
()
#
repo.remove_all_time_slices()
layers
=
repo
.
get_layers
()
layers
=
repo
.
get_layers
()
for
layer
in
layers
:
for
layer
in
layers
:
...
@@ -65,7 +66,34 @@ if __name__ == "__main__":
...
@@ -65,7 +66,34 @@ if __name__ == "__main__":
if
clusters_for_layer
is
None
or
len
(
clusters_for_layer
)
==
0
:
if
clusters_for_layer
is
None
or
len
(
clusters_for_layer
)
==
0
:
clusters_for_layer
=
[
Cluster
(
layer_name
,
-
1
,
repo
.
get_layer_nodes
(
layer_name
))]
clusters_for_layer
=
[
Cluster
(
layer_name
,
-
1
,
repo
.
get_layer_nodes
(
layer_name
))]
time_slices
=
split_clusterset_by_time
(
layer_name
,
clusters_for_layer
)
Ns
=
[
1000
,
5000
,
10000
,
20000
,
50000
]
Ns
.
reverse
()
for
k
,
v
in
time_slices
.
items
():
NR_EXEC
=
5
repo
.
add_time_slice
(
v
)
for
N
in
Ns
:
cur_N
=
0
cluster_subset
=
[]
for
cluster
in
clusters_for_layer
:
if
cur_N
+
len
(
cluster
.
nodes
)
<=
N
:
# add new cluster as it will be ok
cluster_subset
.
append
(
cluster
)
cur_N
+=
len
(
cluster
.
nodes
)
else
:
# add subset of that one and stop
cluster
.
nodes
=
cluster
.
nodes
[:
N
-
cur_N
]
cluster_subset
.
append
(
cluster
)
cur_N
+=
len
(
cluster
.
nodes
)
break
clusters_for_layer
=
cluster_subset
sum
=
0
for
i
in
range
(
NR_EXEC
):
start
=
timeit
.
default_timer
()
time_slices
=
split_clusterset_by_time
(
layer_name
,
clusters_for_layer
)
end
=
timeit
.
default_timer
()
sum
+=
end
-
start
print
(
f
"{layer.layer_name} needed {sum/NR_EXEC} seconds with {N}, {cur_N} elements."
)
# for k,v in time_slices.items():
# repo.add_time_slice(v)
src/data-hub/community-detection-microservice/app/visualization/vis_execution_time.py
View file @
d032fb36
...
@@ -7,6 +7,14 @@ times = [[1000,0.9823,1.0420,0.9656],
...
@@ -7,6 +7,14 @@ times = [[1000,0.9823,1.0420,0.9656],
[
20000
,
86.0519
,
104.0453
,
85.4891
],
[
20000
,
86.0519
,
104.0453
,
85.4891
],
[
50000
,
489.4964
,
574.7641
,
468.8706
]]
[
50000
,
489.4964
,
574.7641
,
468.8706
]]
# slicing
times2
=
[[
1000
,
0.010159840000000031
,
0.008385740000001363
,
0.008584839999997484
],
[
5000
,
0.044350359999999256
,
0.04146890000000099
,
0.04291390000000206
],
[
10000
,
0.07776566000000074
,
0.07954154000000102
,
0.07955803999999489
],
[
20000
,
0.15964476000000047
,
0.16679267999999894
,
0.15759418000000097
],
[
50000
,
0.4081138799999998
,
0.4278634399999987
,
0.41363941999999554
]]
n
=
[
t
[
0
]
for
t
in
times
]
n
=
[
t
[
0
]
for
t
in
times
]
finished
=
[
t
[
1
]
for
t
in
times
]
finished
=
[
t
[
1
]
for
t
in
times
]
dest
=
[
t
[
2
]
for
t
in
times
]
dest
=
[
t
[
2
]
for
t
in
times
]
...
@@ -15,6 +23,7 @@ price = [t[3] for t in times]
...
@@ -15,6 +23,7 @@ price = [t[3] for t in times]
fig
,
ax
=
plt
.
subplots
()
fig
,
ax
=
plt
.
subplots
()
ax
.
set_title
(
'Execution Time for Clustering'
)
ax
.
set_xlabel
(
'Number of Nodes'
)
ax
.
set_xlabel
(
'Number of Nodes'
)
ax
.
set_ylabel
(
'Time in Seconds'
)
ax
.
set_ylabel
(
'Time in Seconds'
)
ax
.
plot
(
n
,
dest
,
label
=
'Destination'
)
ax
.
plot
(
n
,
dest
,
label
=
'Destination'
)
...
...
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