def component_dashboard(page): #try: component_registry = Registry() print("COMPONENTS AVAILABLE") print(component_registry) print(component_registry.agent_list()) return render_template('developer_base.html', registry=component_registry)
def display_mes_run_sequence_diagram(): system_run_log_dir = request.args.get('system_run_log_dir') component_registry = Registry() system_run_output = component_registry.get_system_run_output(system_run_log_dir) sequence_file = component_registry.read_mes_run_sequence_file(system_run_log_dir) return render_template('display_mes_run_sequence_diagram.html', system_run_output=system_run_output, sequence_file=sequence_file)
def view_system_run_output(): system_run_log_dir = request.args.get('system_run_log_dir') run_code = request.args.get("run_code") component_registry = Registry() if system_run_log_dir is not None: system_run_output = component_registry.get_system_run_output(system_run_log_dir) else: system_run_output = component_registry.get_system_run_output_by_run_code(run_code) return render_template('view_system_run_output.html', system_run_output=system_run_output)
def component_view(): #try: mes_directory = request.args.get('mes_directory') component_registry = Registry() component_type = request.args.get('component_type') component_name = request.args.get('component_name') component_details = component_registry.get_mes_component_details(component_name) component_source = component_registry.get_component_source_file(component_name) property_list = component_registry.get_mes_component_properties(component_name) return render_template('component_view.html', component_details=component_details, component_name=component_name, component_type=component_type, component_source=component_source, property_list=property_list)
def show(page): if 'admin-user' not in session.keys(): return render_template('admin_login.html') else: working_dir = os.getcwd() mes_folders = [ f for f in os.scandir(working_dir) if f.is_dir() and f.name[0] != "."] component_registry = Registry() return render_template('mes_library.html', mes_folders=mes_folders, registry=component_registry)
def mes_components(): #try: mes_directory = request.args.get('mes_directory') title = mes_directory + " - Components" working_dir = os.path.join(os.getcwd(), mes_directory) component_registry = Registry() component_registry.clear_contents() component_registry.examine_directory(working_dir) return render_template('mes_components.html', title=title, mes_directory=mes_directory, registry=component_registry)
def admin_json(json): print("Received a json message to admin...") command = json["command"] payload = json["payload"] if command == "register_admin": join_room("admin") if command == "start_subject_experiment": subject_directory = SubjectDirectory() if not subject_directory.experiment_status(): emit('experiment_status_message', {'response': 'status', 'payload': {'status': 'Started'}}) subject_directory.start_experiment() configuration = payload["configuration"] component_registry = Registry() working_dir = os.path.join(os.getcwd()) simulation_library = MESSimulationLibrary() simulation_library.list_human_subject_files_directory(working_dir) simulation = simulation_library.get_simulation_by_filename(configuration) actor_system = ActorSystemConnector() working_dir = os.path.join(os.getcwd()) actor_system.run_human_subject_experiment(working_dir, configuration, simulation["description"].to_hash(), subject_directory.get_subjects())
def mes_run_simulation(): mes_directory = request.args.get('mes_directory') configuration = request.args.get('configuration') component_registry = Registry() title = mes_directory + " - " + configuration + " - Configuration" working_dir = os.path.join(os.getcwd(), mes_directory) simulation_library = MESSimulationLibrary() simulation_library.list_simulation_files_directory(working_dir) simulation = simulation_library.get_simulation_by_filename(configuration) actor_system = ActorSystemConnector() working_dir = os.path.join(os.getcwd(), mes_directory) #actor_system.send_message() #actor_system.run_simulation(working_dir, simulation["description"].to_hash()) actor_system.run_simulation(working_dir, configuration, simulation["description"].to_hash()) # sim_controller = SimulationController() # sim_controller.process_configuration(simulation["source_file"]) return redirect("/status")
def agent_type_list(): component_registry = Registry() agent_types = [agent_type for agent_type in component_registry.agent_list()] return jsonify(agent_types=agent_types)
def test_runner(): component_registry = Registry() return render_template('test_runner.html', registry=component_registry)
def simulation_builder(): component_registry = Registry() return render_template('simulation_builder.html', registry=component_registry)
def mes_results(): mes_directory = request.args.get('mes_directory') component_registry = Registry() system_runs = component_registry.get_system_runs() return render_template('system_runs.html', system_runs=system_runs)
def display_mes_run_data(): system_run_log_dir = request.args.get('system_run_log_dir') component_registry = Registry() mes_data_log = component_registry.get_system_data_log(system_run_log_dir) json_data_log = json.dumps(mes_data_log) return render_template('display_mes_run_data.html', mes_data_log=json_data_log)
def display_mes_run_configuration(): system_run_log_dir = request.args.get('system_run_log_dir') component_registry = Registry() mes_configuration = component_registry.get_system_run_configuration(system_run_log_dir) return render_template('display_mes_run_configuration.html', simulation=mes_configuration)
def system_runs(): component_registry = Registry() system_runs = component_registry.get_system_runs() return render_template('system_runs.html', system_runs=system_runs)