cog
cog copied to clipboard
Optional Shutdown Event
It would be great if a Cog also had shutdown event in the BasePredictor to be able to handle the full setup, predict, and shutdown lifecycle.
@bakermanbrian Thanks for sharing your suggestion. Do you have a specific use case in mind for a shutdown event?
The primary use case is to keep track of the total runtime for my servers. In Replicate, for example, I don't have access to raw usage data programmatically and this would unlock that ability for me to timestamp when a server stops.
@bakermanbrian Ah, thanks for clarifying. This sounds like a task best solved at the orchestration layer. For example, if running a Cog container in a Kubernetes cluster, you could use container events or log statements to determine when a pod starts and finishes. That way, you'll get consistent statistics even if Cog terminates unexpectedly, without executing a hypothetical shutdown handler.