def get_static_mapping_list(yaml_reader): static_task_list = [] app_id = 0 #walk for all apps into yaml file for app_n in yaml_reader["apps"]: app_name = app_n["name"] try: #Test if a given app have the static_mapping tag static_mapping_tasks = yaml_reader["apps"][app_id][ "static_mapping"] #In this point can be concluded that the app have some static mapping #Then, list all tasks from app_name app_task_list = get_app_task_name_list(".", app_name) task_id = 0 #Walk over all static tasks for static_task in static_mapping_tasks: if static_task in app_task_list: static_task_id = app_task_list.index(static_task) task_rel_id = app_id << 8 | static_task_id x_address = int(static_mapping_tasks[static_task] [0]) # Gets the x value y_address = int(static_mapping_tasks[static_task] [1]) # Gets the y value task_static_map = x_address << 8 | y_address static_task_list.append([task_rel_id, task_static_map]) else: print("[WARNING]: Static task name [" + static_task + "] does not belong to application [" + app_name + "], it will be ignored in static mapping\n") except: pass # This means that the application not has any task mapped statically app_id = app_id + 1 return static_task_list
def get_static_mapping_list(yaml_reader): static_task_list = [] app_id = 0 #walk for all apps into yaml file for app_n in yaml_reader["apps"]: app_name = app_n["name"] try: #Test if a given app have the static_mapping tag static_mapping_tasks = yaml_reader["apps"][app_id]["static_mapping"] #In this point can be concluded that the app have some static mapping #Then, list all tasks from app_name app_task_list = get_app_task_name_list(".", app_name) task_id = 0 #Walk over all static tasks for static_task in static_mapping_tasks: if static_task in app_task_list: static_task_id = app_task_list.index(static_task) task_rel_id = app_id << 8 | static_task_id x_address = int( static_mapping_tasks[static_task][0] ) # Gets the x value y_address = int( static_mapping_tasks[static_task][1] ) # Gets the y value task_static_map = x_address << 8 | y_address static_task_list.append([task_rel_id, task_static_map]) else: print "[WARNING]: Static task name ["+static_task+"] does not belong to application [" + app_name+ "], it will be ignored in static mapping\n" except: pass # This means that the application not has any task mapped statically app_id = app_id + 1 return static_task_list
def get_app_info_list(yaml_reader, testcase_path): #Start of processing to extracts the information of task statically mapped app_start_list = [] yaml_app_index = 0 app_id = 0 for app_reader in yaml_reader["apps"]: app_name = app_reader["name"] #Then, list all tasks from app_name app_task_list = get_app_task_name_list(testcase_path, app_name) task_number = len(app_task_list) #If the time is not configured - default is zero start_time_ms = 0 cluster = -1 try: start_time_ms = int(app_reader["start_time_ms"]) except: pass try: cluster = app_reader["cluster"] except: pass #Test if a given app have the static_mapping tag static_mapping_tasks = [] try: static_mapping_tasks = yaml_reader["apps"][app_id]["static_mapping"] except: pass # This means that the application not has any task mapped statically task_id = 0 #Checks for typing error in the task name for static_task in static_mapping_tasks: if static_task not in app_task_list: print "[WARNING]: Static task name ["+static_task+"] does not belong to application [" + app_name+ "], it will be ignored in static mapping\n" static_task_list = [] #Walk over all tasks of app for task_name in app_task_list: #Walk over all tasks signaled within static mapping flag if task_name in static_mapping_tasks: x_address = int( static_mapping_tasks[task_name][0] ) # Gets the x address value y_address = int( static_mapping_tasks[task_name][1] ) # Gets the y address value task_static_map = x_address << 8 | y_address static_task_list.append([task_id, task_static_map]) else: static_task_list.append([task_id, -1]) #Signals a dynamic mapping task_id = task_id + 1 #Create a new object of Application info gathering all information previously extracted from yaml app_start_list.append( ApplicationInfo(app_name, start_time_ms, task_number, cluster, static_task_list) ) app_id = app_id + 1 # Sort the list in place. See more in : https://wiki.python.org/moin/HowTo/Sorting app_start_list.sort(key=lambda app: app.start_time_ms) return app_start_list