Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Seibert
xtreemfs_client
Commits
12b3ccb0
Commit
12b3ccb0
authored
Aug 03, 2018
by
Felix Seibert
Browse files
add computation of a lower bound for the optimal makespan
parent
a41b8e99
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/test_dataDistribution.py
View file @
12b3ccb0
...
@@ -285,6 +285,33 @@ class TestDataDistribution(unittest.TestCase):
...
@@ -285,6 +285,33 @@ class TestDataDistribution(unittest.TestCase):
self
.
assertEqual
(
9
,
max
(
total_folder_sizes
))
self
.
assertEqual
(
9
,
max
(
total_folder_sizes
))
self
.
assertEqual
(
36
,
sum
(
total_folder_sizes
))
self
.
assertEqual
(
36
,
sum
(
total_folder_sizes
))
def
test_get_lower_bound_on_makespan
(
self
):
folder_sizes
=
[
1
]
num_folders
=
5
osd_bandwidths
=
[
1
]
num_osds
=
4
distribution
=
dataDistribution
.
DataDistribution
()
distribution
.
add_osd_list
(
create_test_osd_list
(
num_osds
,
osd_bandwidths
))
distribution
.
add_folders
(
create_test_folder_list
(
num_folders
,
folder_sizes
),
random_osd_assignment
=
True
)
self
.
assertEqual
(
5
/
4
,
distribution
.
get_lower_bound_on_makespan
())
folder_sizes
=
[
1
]
num_folders
=
60
osd_bandwidths
=
[
3
,
2
,
1
]
osd_capacities
=
[
2
,
5
,
100
]
num_osds
=
4
distribution
=
dataDistribution
.
DataDistribution
()
distribution
.
add_osd_list
(
create_test_osd_list
(
num_osds
,
osd_bandwidths
))
distribution
.
set_osd_bandwidths
(
create_osd_information
(
num_osds
,
osd_bandwidths
))
distribution
.
set_osd_capacities
(
create_osd_information
(
num_osds
,
osd_capacities
))
distribution
.
add_folders
(
create_test_folder_list
(
num_folders
,
folder_sizes
))
self
.
assertEqual
(
8
,
distribution
.
get_maximum_processing_time
()[
1
])
def
create_test_osd_list
(
num_osds
,
osd_capacities
):
def
create_test_osd_list
(
num_osds
,
osd_capacities
):
test_osds
=
[]
test_osds
=
[]
...
...
xtreemfs_client/dataDistribution.py
View file @
12b3ccb0
...
@@ -184,6 +184,26 @@ class DataDistribution(object):
...
@@ -184,6 +184,26 @@ class DataDistribution(object):
maximum_osd
=
osd
maximum_osd
=
osd
return
maximum_osd
,
maximum_processing_time
return
maximum_osd
,
maximum_processing_time
def
get_lower_bound_on_makespan
(
self
):
total_remaining_file_size
=
self
.
get_total_folder_size
()
artificial_data_distribution
=
copy
.
deepcopy
(
self
)
for
tmp_osd
in
artificial_data_distribution
.
OSDs
.
values
():
for
a_folder
in
list
(
tmp_osd
.
folders
.
keys
()):
tmp_osd
.
remove_folder
(
a_folder
)
while
total_remaining_file_size
>
0
:
free_OSDs
=
list
(
filter
(
lambda
x
:
x
.
get_free_capacity
()
>
0
,
artificial_data_distribution
.
OSDs
.
values
()))
total_bandwidth
=
sum
(
list
(
map
(
lambda
x
:
x
.
bandwidth
,
free_OSDs
)))
assigned_file_size
=
0
for
free_OSD
in
free_OSDs
:
optimal_share
=
(
free_OSD
.
bandwidth
/
total_bandwidth
)
*
total_remaining_file_size
assignable_share
=
min
(
optimal_share
,
free_OSD
.
get_free_capacity
())
free_OSD
.
add_folder
(
"dummy_id"
,
assignable_share
)
assigned_file_size
+=
assignable_share
total_remaining_file_size
-=
assigned_file_size
return
artificial_data_distribution
.
get_maximum_processing_time
()[
1
]
def
add_folders
(
self
,
folders
,
def
add_folders
(
self
,
folders
,
ignore_osd_capacities
=
True
,
ignore_osd_capacities
=
True
,
random_osd_assignment
=
False
,
random_osd_assignment
=
False
,
...
...
xtreemfs_client/osd.py
View file @
12b3ccb0
...
@@ -50,6 +50,9 @@ class OSD(object):
...
@@ -50,6 +50,9 @@ class OSD(object):
def
get_load
(
self
):
def
get_load
(
self
):
return
self
.
total_folder_size
return
self
.
total_folder_size
def
get_free_capacity
(
self
):
return
self
.
capacity
-
self
.
total_folder_size
def
get_processing_time
(
self
):
def
get_processing_time
(
self
):
return
self
.
total_folder_size
/
self
.
bandwidth
return
self
.
total_folder_size
/
self
.
bandwidth
...
...
Write
Preview
Supports
Markdown
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