Brandon is correct (thanks Brandon!), Fabric attempts to cache open connections whenever possible. So you should ideally only be seeing the bare minimum of network traffic/sessions required. You can inspect that connections cache Brandon mentioned to see what their current state is at any time.
On Fri, Mar 21, 2014 at 4:12 PM, Brandon Whaley <[email protected]> wrote: > Hey Jon, > > Fabric doesn't actually make multiple connections, it reuses them: > > http://docs.fabfile.org/en/1.8/usage/execution.html?highlight=cache#connections > > The live connections are stored in fabric.state.connections for the life of > your program run (I believe, feel free to correct me if I'm wrong there). > > > On Fri, Mar 21, 2014 at 7:07 PM, Jon Mansey <[email protected]> wrote: >> >> Hello, my application requries opening ssh connections to a list of hosts >> (typically less than 10), then performing different commands on each and >> parsing the output. So I need a way to programatically address the ssh >> commands sent to the correct host. eg execute command x on host y. However I >> dont want to open a new connection and log in each time a command is needed, >> I want it to log in when first needed and keep the session open for future >> use. >> >> it seems fabric's execute command should be able to do this but perhaps im >> just missing that there is a far simpler way of making an ssh class that can >> be called with a command and an index for host? >> >> so id like to do something like this >> >> env.hosts = [host1, host2, host3] >> >> execute(command1, host1) >> >> execute(commandm, hostn) >> >> >> Am I on the right track here? Are there any code examples available for >> this use-case? >> >> Thanks >> >> Jon >> _______________________________________________ >> Fab-user mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/fab-user > > > > _______________________________________________ > Fab-user mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/fab-user > -- Jeff Forcier Unix sysadmin; Python/Ruby engineer http://bitprophet.org _______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
