The information retrieved from the Prefect documentation does not directly address the question of removing old flow runs or cleaning up disk space for a self-hosted Prefect server. However, based on standard practices for maintaining a self-hosted server, you can consider the following general steps to clean up disk space:
1. Backup Important Data: Before you proceed with any cleanup, it's usually good practice to backup any important data. Make sure to backup any workflow definitions, results, or data that you may need later.
2. Flow Run Artifacts and Logs: Check the location where flow run logs and artifacts are stored on your server. If you are using a file system-based storage for logs and outputs, you can manually delete files that are older than a specific time period.
3. Database Cleanup: If your flow run data is stored in a database, you can perform cleanup operations by deleting entries that are older than a week. Be cautious with such operations and ensure you have necessary backups.
4. Use Prefect CLI or API: Prefect may offer CLI commands or API endpoints for managing flow runs, which may include deletion or cleanup utilities. However, I was not able to retrieve specific Prefect commands for cleanup from the current documentation.
5. Automate Cleanup Tasks: To avoid manual cleanup, consider creating a cron job or a scheduled task that automatically performs cleanup operations based on your criteria.
For Prefect-specific instructions, consider consulting the Prefect community or documentation for any built-in mechanisms or recommended practices for housekeeping of flow run data. If you need further assistance in locating Prefect-specific guidelines, I can search for related issues in the Prefect GitHub repositories. Would you like me to do that?