def main_project(self, data): user_id = data["user_id"] project_name = data["project_name"] user_manage_id = data["user_manage_id"] user_obj = load_user(user_id) # noinspection PyTypeChecker self.show_um_status_message("creating main container", user_manage_id, None) main_id = create_container("tactic_main_image", network_mode="bridge", owner=user_id) caddress = get_address(main_id, "bridge") send_request_to_container(self.megaplex_address, "register_container", {"container_id": main_id}) global_tile_manager.add_user(user_obj.username) list_names = self.get_list_names({"user_id": user_obj.get_id()})["list_names"] class_names = self.get_class_names({"user_id": user_obj.get_id()})["class_names"] function_names = self.get_function_tags_dict({"user_id": user_obj.get_id()})["function_names"] with self.app.test_request_context(): bf_url = url_for("figure_source", tile_id="tile_id", figure_name="X")[:-1] data_dict = { "project_name": project_name, "project_collection_name": user_obj.project_collection_name, "main_id": main_id, "user_id": user_obj.get_id(), "megaplex_address": self.megaplex_address, "main_address": caddress, "loaded_user_modules": global_tile_manager.loaded_user_modules, "mongo_uri": mongo_uri, "list_names": list_names, "class_names": class_names, "function_names": function_names, "user_manage_id": user_manage_id, "base_figure_url": bf_url, "use_ssl": use_ssl, } # noinspection PyTypeChecker self.show_um_status_message("start initialize project", user_manage_id, None) result = send_request_to_container(caddress, "initialize_project_mainwindow", data_dict).json() if not result["success"]: destroy_container(main_id) raise Exception(result["message_string"]) return None
def delete_container_list(self, data): container_list = data["container_list"] for container_id in container_list: destroy_container(container_id) return {"success": True}
def clear_stale_containers(self): res = send_request_to_container(megaplex_address, "get_old_inactive_stalled_containers").json() cont_list = res["old_inactive_stalled_containers"] for cont_id in cont_list: destroy_container(cont_id)
def delete_container(self, data): container_id = data["container_id"] destroy_container(container_id) return {"success": True}