OK, have you seen this: 
http://web2py.com/book/default/chapter/04#Background-Processes-and-Task-Queues
?
 

On Monday, July 11, 2011 10:19:59 AM UTC-4, David J wrote:

> Anthony;
>
> Thanks; I wanted my object to be created on application startup; 
>
> I know that I can put objects in my model and they are available; but I 
> wanted something like application scope that has a life longer than the 
> request; 
>
> What I am trying to accomplish is an event queue type system.
>
> so when the application starts and event queue starts and as I process 
> requests; I can add events to the queue and they can run in the back ground;
>
> I thought if I started my app in models like
>
> queue = EventQueue()
>
> queue.start()
>
> seems like once the request lifecycle completes the queue is no longer 
> running as I am guessing it would probably hold up the request from 
> finishing;
>
> so I am looking for an alternative place to start the queue say when the 
> application starts and store that somewhere globally.
>
> Thanks.
>
>
> On 7/11/11 10:08 AM, Anthony wrote: 
>
> All the model files in the root /models folder are run on every request to 
> the application, so any object defined in one of those files will be 
> available application wide. Is that what you're looking for?
>  
> Note, as of version 1.96.1, there are also conditional model files that 
> execute only when a particular controller and/or function is requested. For 
> example, model files in the /models/controller1 folder will only execute 
> when the incoming request is for 'controller1', and model files in the 
> /models/controller1/func1 folder will only execute when the incoming request 
> is for 'controller1/func1'.
>  
> Anthony
>
> On Monday, July 11, 2011 9:59:06 AM UTC-4, David J wrote:
>
>> Is there place to specify a global object that runs when the application 
>> runs? 
>>
>> Like application scope? 
>>
>> Thanks.
>>
>
>

Reply via email to