Reputation: 2098
I have a fabric
script to manage our deployments. I need it to run in parallel mode so it can finish in a reasonable amount of time, but I need one command to run only once, not multiple times as it would in parallel mode.
Upvotes: 1
Views: 1542
Reputation: 126
Don't specify the hosts before executing the function which you would like to execute only one time. After that function, you can set env.host variable to the machines you want to run on. For example,
def task():
init()
execute(main_job)
def init():
# do some initialization
# set host
env.host = ['192.168.5.11', '192.168.5.12']
@parallel
def main_job():
# main job code...
Upvotes: 3