On Monday, May 6, 2013 6:51:47 AM UTC+2, Simon Ashley wrote:
>
> Extending on from my earlier reply, (which hasn't shown up yet), I think 
> what you're suggesting is to store the code as a module, and import it as 
> required from a model. Am I correct in assuming that this would have less 
> performance impact than storing the code in a model?


I think you replied directly to my email and not the group's one...
for the sake of completeness

More or less. The FUNCTION calls various* sub functions* that include 
retrieving xml data from external sites, parsing and inserting into 
intermediate holding tables, using that data in transforms with modified 
data inserted into another set of tables to be queried by analysts. While 
the *sub functions* can be called independently, the FUNCTION is normally 
executed as a routine job.

Scheduler's approach ATM can't schedule a controller function as a task 
(hey are meant to be executed in a real "request/response" environment and 
to return a serializable .xml() result). 
A nifty trick could be to define a function in a model that does
def queue_me():
       LOAD('controller', 'yourfunction')
       return 1 
but I'm unsure about side-effects (read, I don't know if it works).
Usually either you put those long function in a module or you use 
conditional models to avoid loading them at every request.....
In each case the current execution environment of the scheduler doesn't 
"load and cache" any module or function: every task recreates a fresh 
environment (so you can change your code without restarting the scheduler).
Things in this regard can change but you'll lose your requirement as you 
said that you put those in controllers because *(some calculations/ 
transforms may change regularly)*

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to