Commit 7d9cc389 authored by Felix Seibert's avatar Felix Seibert
Browse files

more general approach for time measurement of layout creation

parent b76224c4
......@@ -132,6 +132,8 @@ class OSDManager(object):
def create_distribution_from_existing_files(self, fix_layout_internally=True, apply_layout=True,
environment='LOCAL'):
start_time = time.time()
if self.debug:
print("creating distribution from existing files. osd manager: " + str(self))
......@@ -157,13 +159,19 @@ class OSDManager(object):
self.apply_osd_assignments(new_assignments)
elif self.debug:
print("NOT applying data layout!")
self.__write_configuration()
if apply_layout:
self.__write_configuration()
if self.debug:
print("osd manager after new folders have been added to data distribution:")
print(str(self))
if self.debug:
total_time = round(time.time() - start_time)
print("calculated distribution on existing files in secs: " + str(total_time))
start_time = time.time()
if fix_layout_internally:
self.fix_physical_layout_internally()
else:
......@@ -184,23 +192,24 @@ class OSDManager(object):
else:
self.fix_physical_layout_externally()
if self.debug:
total_time = round(time.time() - start_time)
print("fixed physical layout of existing files in secs: " + str(total_time))
'''
fixes the physical layout, such that it matches the data distribution described in self.distribution.
this is realized by calling move_folder_to_osd on all folders managed by this distribution.
'''
def fix_physical_layout_externally(self):
start_time = time.time()
if self.debug:
print("fixing physical layout externally...")
managed_folders = self.get_assigned_folders()
for managed_folder in managed_folders:
folder_id = self.path_on_volume(managed_folder)
osd_for_folder = self.distribution.get_containing_osd(folder_id)
self.move_folder_to_osd(folder_id, osd_for_folder.uuid)
total_time = time.time() - start_time
if self.debug:
print("externally fixed physical data layout in secs: " + str(round(total_time)))
'''
fixes the physical layout, such that it matches the data distribution described in self.distribution
we use the following strategy: first, determine which files needs to be moved to another OSD, and create three lists.
......@@ -217,12 +226,7 @@ class OSDManager(object):
'''
def fix_physical_layout_internally(self, repeat_delete_interval_secs=15, iteration=0, start_time=None):
if start_time is None:
fix_start_time = time.time()
else:
fix_start_time = start_time
def fix_physical_layout_internally(self, repeat_delete_interval_secs=15, iteration=0):
if self.debug:
print("starting to fix physical layout...this is fix-iteration " + str(iteration))
# list 1
......@@ -267,10 +271,6 @@ class OSDManager(object):
# end of recursion condition
if len(create_replica_command_list) == 0 and len(delete_replica_command_list) == 0:
if self.debug:
fix_total_time = round(time.time() - fix_start_time)
print("internally fixed physical layout in " + str(iteration) + " fix-iterations, "
"took secs: " + str(fix_total_time))
return
# run commands
......@@ -350,7 +350,7 @@ class OSDManager(object):
end_time = time.time()
print("deleting replicas done in in " + str(round(end_time - start_time)) + " sec.")
self.fix_physical_layout_internally(iteration=iteration + 1, start_time=fix_start_time)
self.fix_physical_layout_internally(iteration=iteration + 1)
'''
create empty folders and assign OSDs.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment