Auto-Save on exit?

When running prodigy in the command line, ctrl-c will cause prodigy to exit, but will save all the annotations I have done.

However, when using prodigy in docker, the SIGTERM sent by docker stop doesn’t seem to save my annotations. I’m trying to figure out where the disconnect is, and how I might be able to resolve it.

Annotations are saved to the database every time a full batch is sent back to the server (i.e. when a request to /give_answers is made). So the good news is, even if the server is killed in a way that doesn’t display the “Saved X annotations” message, your annotations should still be saved :smiley:

Are you able to send a keyboard interrupt before running docker stop? (SIGINT I think? See here.) This should terminate Prodigy just like when you press ctrl+c.

In this specific case, I don’t think I can send a SIGINT. We’re running this on AWS ECS, and short of ssh’ing to the box everytime, I don’t think I can trigger a SIGINT thru the aws ecs stop-task command.

Also, I definitely know that my annotations are not being saved if I stop the ECS task. What constitutes a “full batch”? The current workaround I’m doing is just manually saving every so often, but that is easily forgotten at times.

Prodigy sends the answered questions back in batches – usually the same as the stream batch size, which defaults to 10. To allow being able to quickly undo answers (without having to reconcile existing annotations), the latest 10 answers are also kept in the app. As soon as there’s a full batch of answers minus the undo history, the app will send those answers back to the server. This also makes it easy to update a model in the loop with batches of answers.

The saving happens automatically in the background – but before exiting, you usually always want to hit “save”, to explicitly tell Prodigy you’re done and send everything that’s there back to the server at once.