On_exit not called

solved
enhancement
api
(Akshita Sood) #1

Hi @ines @honnibal ,
Whenever I exit prodigy, my on_exit function is not called, whereas on_load gets called whenever I start prodigy.
The way I exit is by killing each of the individual process running on different ports. Is there anything wrong with my method of exit? If not , what can be the possible reasons?

0 Likes

(Ines Montani) #2

I think this might be the problem. The server currently kinda assumes you’re terminating it from the command line and only then calls the on_exit method.

But if I remember correctly, you’re calling your recipes from within Python, right? If you’re also terminating the process from a Python script, you could just execute your on_exit code then (depending on what you’re trying to do). You can still connect to the database etc. outside of a recipe.

0 Likes

(Akshita Sood) #3

I tried killing the processes using os.kill by sending a KeyboardInterrupt signal. It is working fine now. Thanks a lot. :slight_smile: :smile:

1 Like