I've been adding some form of SSH pipelining to Exosphere, my patch reporting program for remote unix systems.
The idea was that I could just remove connection lifecycle handling entirely from package manager providers and setup/discovery code, and manage that from within the task runners.
So I added an opt in config toggle that will leave connections open and reap them via a background thread if they have been idling for more than X amount of time. That way chaining operations takes significantly less time, since the connection gets reused.
This is basic, a bit naive, but it works without issues in my weeks spent using that code myself on 21 hosts with no ill effects.
I'm just at the stage where I have to convince myself it's Good Enough, Actually(tm) because it's making my Race Condition sense tingle (even though there's really no risk in context) and I'm this close to wrapping connection semantics in RLocks for no reason other than to make the feeling go away.
#python #exosphere