fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] awk's BEGIN/END in Fabric?


From: Jeff Forcier
Subject: Re: [Fab-user] awk's BEGIN/END in Fabric?
Date: Mon, 15 Oct 2012 14:25:32 -0700

Hi Dmitry,

On Mon, Oct 15, 2012 at 1:46 PM, Dmitry Makovey <address@hidden> wrote:
>
> Hi,
>
> Is there a way to code certain tasks in Fabric to be executed **always** at
> the start (prior to all tasks) and then certain other tasks **always** in the
> end (after all tasks finished).

Right now, no -- this is a weak spot in Fabric's current design. One
of the major tickets about it is here:

    https://github.com/fabric/fabric/issues/452

Though that's specifically for hooking things before/after individual
tasks -- not globally -- though I agree that what you describe is very
similar & would be useful as well.

I am rethinking Fabric's task mechanisms for 2.0 (when much of this
will be part of a standalone library) and will definitely be
implementing some version of the functionality then. No specific ETA
but I've been actively hacking on said standalone library and I'll be
announcing here when it's ready for more folks to start poking at it.

Best,
Jeff

>
> One of the usecases would be timing of entire chain of executed tasks.
> Consider this:
>
> $ fab task1 task2 task3
> ...
> Total Time: 1m13s
>
> $ fab task3 task1 task4
> ...
> Total Time: 1m20s
>
> I know I can just use:
>
> $ time fab ...
>
> Or wrap each task with a timing decorator, but then how do I print summary?
> How do I make sure all operations have been timed? etc.
>
> but for that I have to remember to type that in every time, I can also do an
> alias "fab=time fab" but that's again something else.
>
> Something like a global context manager... but I can't find any reference to
> such machinery either in Fabric or in generic Python docs. Did anybody ever
> have to solve this kind of problem? How did you solve it?
>
> --
> Dmitry Makovey
> Web Systems Administrator
> Athabasca University
> (780) 675-6245
> ---
> Confidence is what you have before you understand the problem
>     Woody Allen
>
> When in trouble when in doubt run in circles scream and shout
>      http://www.wordwizard.com/phpbb3/viewtopic.php?f=16&t=19330
>
>
> --
>     This communication is intended for the use of the recipient to whom it
>     is addressed, and may contain confidential, personal, and or privileged
>     information. Please contact us immediately if you are not the intended
>     recipient of this communication, and do not copy, distribute, or take
>     action relying on it. Any communications received in error, or
>     subsequent reply, should be deleted or destroyed.
> ---
>
> _______________________________________________
> 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]