cancel
Showing results for 
Search instead for 
Did you mean: 

Python Script Snap still running sub process on stop

jamesv
New Contributor II

Hi -

I’m using the script snap to execute some external code on a server and running subprocess.check_output to execute it leaves the script running if I stop the pipeline.

Is there a way to guarantee the script gets halted when I stop my pipeline? Not sure what’s going on under the hood.

Thanks,

-James

2 REPLIES 2

jamesv
New Contributor II

Dug into this again today and found an answer in a Stack Overflow post: linux - How to terminate a python subprocess launched with shell=True - Stack Overflow

Would having a “clean up” method call be useful for the script snap? That is, a function that gets called before the pipeline goes into a finished state.

In your case, when it gets invoked, the script could terminate the subprocess and clean up any other things that might be lingering during the execution.