fabric/fabric — pull request #1108 by rpisarev (2014-04-10 18:32:31+00:00)
Title: Add unique identifier output.  This is necessary when a multithreaded program works with 1 srv.

Add param "run_label" for create uniqe identifier output. This is necessary when a multithreaded program works with one server. Without additional unique identifier output mixes.

Example:
Without patch
from fabric.api import run, env, settings

for server in ("linuxbox", "linuxbox"):
env.host = server
with settings(host_string=env.host, warn_only=True):
command = run("uname -s")

[linuxbox] run: uname -s
[linuxbox] run: uname -s
[linuxbox] out: Linux
[linuxbox] out: Linux

with patch:

from fabric.api import run, env, settings

k = 0
for server in ("linuxbox", "linuxbox"):
env.host = server
k += 1
with settings(host_string=env.host, warn_only=True):
command = run("uname -s", run_label=str(k))

[linuxbox, 1] run: uname -s
[linuxbox, 2] run: uname -s
[linuxbox, 2] out: Linux
[linuxbox, 1] out: Linux

In my project its fine works.