python-shell
python-shell copied to clipboard
How to handle when a python process is killed by the system?
Hi!
we are launching several python processes using the python-shell module and we have been noticing that in some cases the processes do not finish properly (the expected output is never generated) but there is no exception being caught by python shell.
I have been researching this and it seems that it is possible that the system kills the processes (sometimes memory consumptions becomes to big) and this case there is no error raised by the module. I have tried this with python-shell 1.0.8 by launching a long running python process and then just kill it myself from outside node. The process finishes and the close event is triggered but the exit code is null. Given that, as far as I understand, python-shell looks at the exit code to know whether it needs to raise an error or not, it makes sense that it does not raise one buecase apparently exitcode is not set.
Is there anything I could do to catch these cases? I am tempted to just check if exit code is null because in any other successful (or not) case, exist code should not be null. Nonetheless, I am not sure if this would work or if there are other cases where exit code could be set to null as well.
Hi @AAraKKe , we are facing the same issue, I wonder if you found a solution for this. Thanks. Melisa