|
From: | Brandon Whaley |
Subject: | Re: [Fab-user] Parallel Tasks With Different Parameters |
Date: | Fri, 09 Dec 2016 21:41:42 +0000 |
I like Brandon's first notion: "have your task query for what param it should use based on the value of env.host_string", which seems like a much better idea than the second that he gave an example for. I might be barking up the wrong tree, but would something like the following work?@paralleldef task(param_table):param = param_table[env.host_string]run("command with {}".format(param))def launcher():param_table = {'192.168.1.100': 'param1','192.168.1.200': 'param2',}execute(task, param_table, hosts=list(param_table))On Fri, Dec 9, 2016 at 1:05 PM, Brandon Whaley <address@hidden> wrote:Glad to help!
On Fri, Dec 9, 2016, 14:04 Erikton Konomi <address@hidden> wrote:Thanks Brandon! This is very helpful.On Thu, Dec 8, 2016 at 3:46 PM, Brandon Whaley <address@hidden> wrote: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:@paralleldef task():#naturally requires that param not contain '_', use another non-valid host character if it needs tohost_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:@paralleldef 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
_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
[Prev in Thread] | Current Thread | [Next in Thread] |