-
Notifications
You must be signed in to change notification settings - Fork 128
Graceful Shutdown #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graceful Shutdown #359
Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
|
Hey @Anthony-Sarkis! This PR should now be ready to go. Please let me know if you find any issues with it or if there's something you think we need to change before meging |
anthony-chaudhary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!! Looks really good. 🎉
Main Changes
GracefulKillerclass to catch SIGINT AND SIGTERM signals.main.py, this prevents threads from being recreated on every import of process_media.pyProcessMediaQueueManagerclass to manages all the queues of the worker and centralize the queue management actions.Gracefull Kill Algorithm Overview:
We will check the length of the
FRAME_QUEUE,VIDEO_QUEUEandPROCESSING_INPUT_LISTand wait for a max of 2 hours until they are empty. If they all get empty, we kill the walrus. We also set the flagSTOP_PROCESSING_DATA=Trueto avoid processing new messages on the current worker.If more than 2 hours pass and all the messages are not handled, we set the messages status to
failed.Notes:
This PR should be deployed alongside with this: diffgram/diffgram-helm#5 to allow kubernetes to give a grace period for shutfdown on new deploys
There's still an issue when killing the walrus and a video file is getting written using moviepy. I've created an issue on their repo to ask about ways to gor around this: Zulko/moviepy#1672