I'm using "os.system(f"START python -m prodigy sentiment {name} -F recipe.py ./data/output/measurement/{name}.jsonl")" to start a separate prodigy instance in windows from my Flask API instance. On_exit sends a post request with the data to my api. I am not yet being able to send the cntrl+c event to make a clean exit using the pid of the instance.
Do you know of any way to fix this?
Is there a way to do this when I save my annotations instead of on exit?
Hi! Internally, Prodigy calls uvicorn.run to serve the app and afterwards (e.g. if that process is terminated), it calls controller.save(), which executes the on_exit callback among other things. The app.py is included with Prodigy, so maybe you could wrap this somehow to make it easier to terminate the process remotely I'd need to look into this to see how that's normally done.
In this case, you could probably also use the update callback instead and send the answers in batches? The update function is called whenever answers are sent back to the server, either when you manually hit save, or when Prodigy auto-saves in the background.