On Friday, March 4, 2016 at 11:01:50 AM UTC-8, Dave S wrote: > > > > On Friday, March 4, 2016 at 3:25:50 AM UTC-8, Niphlod wrote: >> >> never ever ever call a queue_task() in a model. models gets executed at >> every request. just queue the task in a "protectedinitialsetup()" >> controller and use it. >> > > Well, that's why I have the status check, but I like your way of doing it. > > > > >> >> I have a similar approach for >> rebuilding/reinitializing/requeueing/rechecking all tasks >> >> in a controller (e.g. default.py) >> >> def reinit_sched(protect=None): >> delete.... bla bla ..... do stuff ... bla bla >> sched.queue_task(foo) >> sched.queue_task(bar) >> etc etc etc >> >> >> you can then easily call it with web2py.py -M -S >> appname/default/reinit_sched >> >> BTW: it's a little easy trick: every function with arguments can't be >> called from any request coming in (so it's secured) .. and the -S parameter >> can take not only the app name, but also the controller and the function to >> execute... >> >> > I finally got my code caught up to this. Took me a couple of tries before I realized that I needed the db.commit() after the queue_task() ... duh, this is a shell, not a web request.
/dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.