cog icon indicating copy to clipboard operation
cog copied to clipboard

Optional Shutdown Event

Open bakermanbrian opened this issue 1 year ago • 3 comments

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 avatar Mar 21 '24 01:03 bakermanbrian

@bakermanbrian Thanks for sharing your suggestion. Do you have a specific use case in mind for a shutdown event?

mattt avatar Mar 27 '24 09:03 mattt

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 avatar Mar 27 '24 15:03 bakermanbrian

@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.

mattt avatar Apr 08 '24 13:04 mattt