def deploy_chess_application(cls): gui = Task("GUI", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) update_chess = Task("UPDATE_CHESS", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), True) compute_move = Task("COMPUTE_MOVE", Util.generate_ci_cpu_cycles(), 2, Util.generate_ci_input_data(), Util.generate_ci_output_data(), True) output = Task("OUTPUT", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) chess_delay_dict = { gui: [(update_chess, num.randint(2, 10))], update_chess: [(compute_move, num.randint(2, 10))], compute_move: [(output, num.randint(2, 10))], output: [] } cls._mobile_app = MobileApplication(CHESS, chess_delay_dict)
def deploy_facebook_application(cls): # parameters are (name, millions of instructions, memory (Gb), input data (kb), output data (kb), offloadability) facebook_gui = Task("FACEBOOK_GUI", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) get_token = Task("GET_TOKEN", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), True) post_request = Task("POST_REQUEST", Util.generate_random_cpu_cycles(), 2, Util.generate_random_input_data(), Util.generate_random_output_data(), True) process_response = Task("PROCES_RESPONSE", Util.generate_random_cpu_cycles(), 2, Util.generate_random_input_data(), Util.generate_random_output_data(), True) file_upload = Task("FILE_UPLOAD", Util.generate_di_cpu_cycles(), 2, Util.generate_di_input_data(), Util.generate_di_output_data(), False) apply_filter = Task("APPLY_FILTER", Util.generate_di_cpu_cycles(), 2, Util.generate_di_input_data(), Util.generate_di_output_data(), True) facebook_post = Task("FACEBOOK_POST", Util.generate_di_cpu_cycles(), 2, Util.generate_di_input_data(), Util.generate_di_output_data(), False) output = Task("OUTPUT", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) # Logger.write_log("############################# APPLICATION DEPLOYMENT #########################") # facebook_gui = Task("FACEBOOK_GUI", num.exponential(400), 1, 5, 1, False) # get_token = Task("GET_TOKEN", num.exponential(400), 1, 1, 1, True) # post_request = Task("POST_REQUEST", num.exponential(550), 2, 1, 5, True) # process_response = Task("PROCES_RESPONSE", num.exponential(550), 2, 1, 1, True) # file_upload = Task("FILE_UPLOAD", num.exponential(550), 2, num.exponential(500), num.exponential(500), False) # apply_filter = Task("APPLY_FILTER", num.exponential(800), 2, num.exponential(500), num.exponential(500), True) # facebook_post = Task("FACEBOOK_POST", num.exponential(600), 2, num.exponential(500), 5, False) # output = Task("OUTPUT", num.exponential(600), 1, 5, 5, False) facebook_delay_dict = { facebook_gui: [(get_token, num.randint(2, 10)), (post_request, num.randint(2, 10))], get_token: [(post_request, num.randint(2, 10))], post_request: [(process_response, num.randint(2, 10))], process_response: [(file_upload, num.randint(2, 10))], file_upload: [(apply_filter, num.randint(2, 10))], apply_filter: [(facebook_post, num.randint(2, 10))], facebook_post: [(output, num.randint(2, 10))], output: [] } cls._mobile_app = MobileApplication(FACEBOOK, facebook_delay_dict)
def deploy_antivirus_application(cls): gui = Task("GUI", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) load_library = Task("LOAD_LIBRARY", Util.generate_di_cpu_cycles(), 1, Util.generate_di_input_data(), Util.generate_di_output_data(), True) scan_file = Task("SCAN_FILE", Util.generate_di_cpu_cycles(), 2, Util.generate_di_input_data(), Util.generate_di_output_data(), True) compare = Task("COMPARE", Util.generate_di_cpu_cycles(), 1, Util.generate_di_input_data(), Util.generate_di_output_data(), True) output = Task("OUTPUT", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) antivirus_delay_dict = { gui: [(load_library, num.randint(2, 10)), (scan_file, num.randint(2, 10))], load_library: [(compare, num.randint(2, 10))], scan_file: [(compare, num.randint(2, 10))], compare: [(output, num.randint(2, 10))], output: [] } cls._mobile_app = MobileApplication(ANTIVIRUS, antivirus_delay_dict)
def deploy_gps_navigator_application(cls): conf_panel = Task("CONF_PANEL", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) gps = Task("GPS", Util.generate_random_cpu_cycles(), 3, Util.generate_random_input_data(), Util.generate_random_output_data(), False) control = Task("CONTROL", Util.generate_ci_cpu_cycles(), 5, Util.generate_ci_input_data(), Util.generate_ci_output_data(), True) maps = Task("MAPS", Util.generate_di_cpu_cycles(), 5, Util.generate_di_input_data(), Util.generate_di_output_data(), True) path_calc = Task("PATH_CALC", Util.generate_di_cpu_cycles(), 2, Util.generate_di_input_data(), Util.generate_di_output_data(), True) traffic = Task("TRAFFIC", Util.generate_di_cpu_cycles(), 1, Util.generate_di_input_data(), Util.generate_di_output_data(), True) voice_synth = Task("VOICE_SYNTH", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) gui = Task("GUI", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) speed_trap = Task("SPEED_TRAP", Util.generate_random_cpu_cycles(), 1, Util.generate_random_input_data(), Util.generate_random_output_data(), False) gps_navigator_delay_dict = { conf_panel: [(control, num.randint(2, 10))], gps: [(control, num.randint(2, 10))], control: [(maps, num.randint(2, 10)), (path_calc, num.randint(2, 10)), (traffic, num.randint(2, 10))], maps: [(path_calc, num.randint(2, 10))], traffic: [(path_calc, num.randint(2, 10))], path_calc: [(voice_synth, num.randint(2, 10)), (gui, num.randint(2, 10)), (speed_trap, num.randint(2, 10))], voice_synth: [], gui: [], speed_trap: [] } cls._mobile_app = MobileApplication(GPS_NAVIGATOR, gps_navigator_delay_dict)