fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Task.run() and task decorators


From: Rich Andrews
Subject: Re: [Fab-user] Task.run() and task decorators
Date: Tue, 17 Dec 2013 10:13:01 -0500

Michael,

Wrapping TaskSubclass.run() with runs_once works well.

Best,
Rich





On Tue, Dec 17, 2013 at 6:29 AM, Michael Gliwinski <address@hidden> wrote:
On Monday 16 Dec 2013 13:28:50 Rich Andrews wrote:
...
> We might be closer to answering question with this example. It appears both
> WrappedCallableTask and the Task subclass are run() for each host present
> in the fab role being treated, though the @runs_once decorator is present.
>
> So then a more articulate question may be, "How does a Task subclass know
> the intentions of the decorators following its @task(task_class=)
> declaration?"

Well, what I was going by is that runs_once is implemented as a memoizing
function, i.e. it just saves result of the wrapped callable in an attribute of
that callable, and avoids calling it when that attribute is already present.

So the Task subclass doesn't need to know anything, it's just if you wanted
the run() method to execute only once, *it* would have to be the callable
wrapped in runs_once (or be implemented in a similar way).


**********************************************************************************************
The information in this email is confidential and may be legally privileged.  It is intended solely for the addressee and access to the email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed  in the governing client engagement leter or contract.
If you have received this email in error please notify address@hidden

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************



reply via email to

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