I had this use case where I needed to retrieve the output of a command on multiple servers as part of a python library.

At first, I did it with paramiko and it worked well but as the amount of servers grew, it took too much time to run.

I knew about fabric and read the docs in hope of finding a solution

which I did: the @parallel decorator.

I didn’t want to deal with a fabfile and the fab binary, I wanted to include this in my library - fabric can be used as a library but it’s not extremely well documented.

Here’s how I ended up doing it: