Overall, I want to implement a graceful shutdown for proper process handling, at least to send what's already been processed and set statuses so it doesn't have to be reprocessed on subsequent restarts. Ideally, this shouldn't take more than 5 seconds. I'm also just wondering what the best way to do this is. Many people simply use asyncio.all_tasks and cancel them, but that's fine if you don't have other libraries and only work with the tasks you're currently running.
I work within K8s, so I don't think there will be any SIGKILLs (they usually give 30 seconds for a graceful shutdown) or power outages.