Feature #133

avatar

Pre/post run hooks

Added by Jeff Forcier 201 days ago. Updated 120 days ago.

Status:Assigned Start:01/09/2010
Priority:Normal Due date:
Assigned to:avatarJeff Forcier % Done:

0%

Category:Core
Target version:1.0

Description

Might be nice to provide support for pre/post hooks, so that one can specify code to run before and/or after their tasks are executed.

E.g. for long-running tasks, users may want emails to be sent out notifying that things worked (or didn’t; which would require better user-friendly error handling) or someone may want “setup” stuff that, for whatever reason, may not make sense to put at the top of the module. (If such reasons exist…?)

History

Updated by Erich Heine 120 days ago

avatar

How about a pre-run and a post-run hook, which is good for the whole fab file, and a pre-task/post task set of hooks provided by decorators? This means that in fabfile.py a def before(): will aways run first, unless —no-before is specified (and def after()/—no-after). The @prehook(_foo) and @posthook() could have —task-hooks=[before|after|none|both] (default both).

I could prolly do this in a short amount of time, and i have a boring meeting later in the week. Comments?

Also available in: Atom