Thanks for the response, it gives the same response. In general what's the right way to define more than one scheduled tasks? I have tried both the following and non worked: 1- Create to models and define each function in there (and set migrate=False) 2- Define two functions in the same model (and set migrate=False)
On Thursday, 21 May 2015 02:57:53 UTC-4, Massimiliano wrote: > > Just set: > > migrate=False > > so it doesn't try to recreate the table > > from gluon.scheduler import Scheduler scheduler = > Scheduler(db,tasks=dict(our_function=f), migrate=False) > > On Wed, May 20, 2015 at 9:25 PM, Aydin S <[email protected] <javascript:>> > wrote: > >> When I try to create a new model in web2py for scheduller I get an error. >> The model is as follows >> >> `def f(): >> a = 2 >> return () >> >> from gluon.scheduler import Scheduler scheduler = >> Scheduler(db,dict(our_function=f)) >> >> I get the following error: >> >> ` >> >> Traceback (most recent call last): >> File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted >> exec ccode in environment >> File "/home/www-data/web2py/applications/Home_Lights/models/mtasks.py", >> line `42, in <module>` >> Scheduler(db,dict(our_function=f)) >> File "/home/www-data/web2py/gluon/scheduler.py", line 587, in __init__ >> self.define_tables(db, migrate=migrate) >> File "/home/www-data/web2py/gluon/scheduler.py", line 655, in define_tables >> format='%(task_name)s') >> File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 799, in >> `define_table` >> raise SyntaxError('table already defined: %s' % tablename) >> >> SyntaxError: table already defined: scheduler_task` >> >> I suspect it has to do with the execution permission of the newly created >> model. any help is appreciated...? >> >> -- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Massimiliano > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

