fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] How to use parallel execution via API


From: Mohamed Lrhazi
Subject: Re: [Fab-user] How to use parallel execution via API
Date: Sun, 15 Jul 2012 19:02:54 -0400

Thanks Jeff.

In my code, I iterate over my list of hosts, and call run() or sudo(),
then call disconnect_all(), because I don't want hundreds of ssh
sessions open at once.

If I enable parallel execution, would my disconnect_all() interrupt
all dispatched ssh sessions, or just the one in my iteration? Would it
just work magically, and do what I would like it to do, without
further work from my part?

Thanks,
Mohamed.

On Sun, Jul 15, 2012 at 6:42 PM, Jeff Forcier <address@hidden> wrote:
> On Sun, Jul 15, 2012 at 3:31 PM, Mohamed Lrhazi <address@hidden> wrote:
>> Is this possible? I went through the docs and it does not show any
>> examples of such usage, only via command line or a decorator.
>
> It could be more explicit, but it's in there if you read carefully :)
>
>     http://docs.fabfile.org/en/1.4.3/usage/parallel.html#command-line-flags
>
>     "One may also force all tasks to run in parallel by using the
> command-line flag -P or the env variable env.parallel."
>
> So you can tickle env.parallel directly or via 'with settings', and
> then task executions via execute() will run in parallel. E.g.:
>
>     with settings(parallel=True):
>         execute(mytaskfunction, hosts=[...])
>
> In addition, decorators are simply functions themselves and can be
> used to temporarily wrap otherwise un-decorated functions, so you
> could also:
>
>     execute(parallel(mytaskfunction), hosts=[...])
>
> Hope that helps,
> Jeff
>
>>
>> Is there a way?
>>
>> Thanks a lot,
>> Mohamed.
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>
>
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby engineer
> http://bitprophet.org



reply via email to

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