Terminating prodigy processes one by one

I have assigned 40 annotation tasks to 40 students as a lecture assignment. Each task includes 1500 images to be annotated in prodigy through running them in my college's server. Now I want to create a python script that terminates one of the annotation tasks for a student in server once annotating of 1500 images of this task is done by a student in order to prevent a blocking memory usage in the server. So what way should I follow to do that?
Thank you,

1 Like

Hi! How are you serving Prodigy, are you starting multiple instances on separate hosts/ports? Or is everyone connecting to the same instance?

If you have multiple instances on different ports and your students are saving their annotations to different datasets, one solution could be to have a script that periodically checks the number of annotations in the given datasets. You can use the db.count_dataset method, which is more efficient than actually querying the annotations in a set. If the count is >= 1500, you can kill the process running on the host/port assigned to this student/dataset. For example, like this:

You could then run that script periodically as a cronjob, or manually whenever you want to free up unused processes.

1 Like