fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Wait for parallel task to complete


From: Jeff Forcier
Subject: Re: [Fab-user] Wait for parallel task to complete
Date: Sat, 21 Apr 2012 09:51:46 -0700

Hi Anatoly,

On Fri, Apr 20, 2012 at 5:31 AM, anatoly techtonik <address@hidden> wrote:
> Hi,
>
> Is it possible in fabric to wait until a subtask completes on all
> servers successfully before moving to next step?

You need to use execute() to treat subroutines as if they were full
fledged tasks. execute() is the machinery that says "take this
function and run it once per host in this list of hosts." Right now
that machinery is just applying implicitly to your deploy() task and
you're probably using env.hosts to set your host list.

Remove env.hosts and maybe make that host list a role in env.roledefs.
Then you can do this:

    env.roledefs = {'myrole': ['a', 'b', 'c']}

    def test(): ...
    def update(): ...

    def deploy():
        execute(test, role='myrole')
        execute(update, role='myrole')

That should have the effect you want: "fab deploy" => first test()
runs once per host, and when it's all done, update() will run once per
host. deploy() itself will end up running only one time total -- it's
just a "meta" task now.

Hope that helps,
Jeff

-- 
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org



reply via email to

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