| from backend.are import kill_are_process | |
| from backend.session import UserSession | |
| def cleanup(user_session: UserSession) -> None: | |
| """Logs the user interaction. | |
| Stops ARE, queries GraphQL to grab the traces, saves them locally, pushes everything to the hub, | |
| then kills the ARE processes. | |
| Args: | |
| request (gr.Request): Automatically accessed | |
| user_session (gr.State): Storage for user-specific session variables, contains a UserSession | |
| """ | |
| # The user did not interact with are agent | |
| if user_session is None: | |
| return | |
| # Kill the user are processes | |
| kill_are_process(user_session) | |