fab-user
[Top][All Lists]
Advanced

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

RE: [Fab-user] order control


From: Jeff Honey
Subject: RE: [Fab-user] order control
Date: Thu, 14 Oct 2010 11:50:27 -0400

Thanks to both yourself and Morgan for the assist. I wasn't clued in to how 
set() worked. For my particular environment, I'm going to have to go the route 
of nesting my own for loop in the function.

I did my best to pore through the execution model the past two days but my 
inexperience shows. Every little success helps, though. There are likely to be 
more questions as I progress...I hope you won't get annoyed with me too 
quickly.  ;-)

Thanks!!

--
 ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤ kyoboku kazeoshi ¤
 ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
________________________________________
From: address@hidden address@hidden On Behalf Of Jeff Forcier address@hidden
Sent: Thursday, October 14, 2010 10:08
To: Jeff Honey
Cc: address@hidden
Subject: Re: [Fab-user] order control

Hi Jeff,

Morgan is right, the merging process roles/hosts go through, dedupes
them via set() which is an unordered collection data type. Thus, order
is not always preserved.

This has come up once or twice before but there didn't seem to be any
record of it, so I just jotted down the problems here:

    http://code.fabfile.org/issues/show/243

The tl;dr is that because the host list a task runs on is drawn from
many different sources, there may be no way to have a truly intuitive
ordering that isn't going to trip up users.

If order really matters, you can avoid Fabric's built-in (and right
now, simplistic) task runner by dropping the @roles and iterating over
the role definition inside your task instead, setting the host_string
setting:

    def putfile():
        for host in env.roledefs['servers']:
            with settings(host_string=host):
                put(blah)
                run(blah)
                [...]

See this link for a more in depth explanation of how all this stuff works:

    http://docs.fabfile.org/0.9.2/usage/execution.html#connections

(See the rest of that document for even more details, if you want.)

This particular approach will be made easier in the near future,
something like execute(task_function, host_list) so you won't even
need to do your own for/with combo.

Best,
Jeff


reply via email to

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