fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Parallel Tasks With Different Parameters


From: Brandon Whaley
Subject: Re: [Fab-user] Parallel Tasks With Different Parameters
Date: Thu, 08 Dec 2016 23:46:28 +0000

That functionality is not built in to fabric.  Either have your task query for what param it should use based on the value of env.host_string or abuse host strings to pass the arguments like so:

@parallel
def task():
    #naturally requires that param not contain '_', use another non-valid host character if it needs to
    host_string, param = env.host_string.split('_')
    with settings(host_string=host_string):
        run("command with {}".format(param))

def launcher():
    execute(task, hosts=['192.168.1.100_param1', '192.168.1.200_param2'])

On Thu, Dec 8, 2016 at 6:05 PM Erikton Konomi <address@hidden> wrote:
Hello,

How would you go about running multiple tasks on multiple hosts but with different parameter for each host? For example a fabfile with:

@parallel
def task(param):
    run("some command that takes <param> as argument")

def launcher():
    execute(task, param_1, hosts=['192.168.1.100', '192.168.1.200'])
    # The above will run the task on 2 hosts but with the same value for <param>
    # I would like to run both hosts but specifying different value for <param> for each host, like:
    # execute(task, args=[param_1, param_2], hosts=['192.168.1.100', '192.168.1.200'])

Is this functionality there? I couldn't find something on the documents.

Thanks,
Erik

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user

reply via email to

[Prev in Thread] Current Thread [Next in Thread]