I really like my deploys to be as fast as possible. Unfortunately, the RTT between my and my server makes this quite hard. Today, I came up with a simple optimisation, that lets you make your fabric commands faster (saving on RTT). Say you have a series of consecutive "run" calls. Each call needs to get sent, evaluated and the results need to come back. Why wait for them, when we don't want to continue after failure anyway? The simple fix is to change this:
def my_task():
run("command_1")
run("command 2")
run("command 3")
... into this:def my_task():
commands = []
_run = commands.append
_run("command_1")
_run("command 2")
_run("command 3")
run(" && ".join(commands))
This way, all your commands get called, and the execution still stops on first failure.
2 comments:
You can use a with statement: gist
@vad: Nice!
Post a Comment