Hi,

I'm trying to set up the web2py scheduler to run an hourly task and put the 
following code as scheduler.py in the models directory:

from gluon.scheduler import Scheduler


def log():
    
    logging.warning('is when this event was logged.')


import logging


logger = logging.getLogger("web2py.app.welcome")

logger.setLevel(logging.DEBUG)
    
    myscheduler = Scheduler(db,tasks=dict(log=log))

myscheduler.queue_task('log',period=3600,repeats=0,immediate=True)

However I find that each time I visit the website, it schedules a new task, 
resulting in multiple tasks of the same nature (i.e. period=3600, 
repeats=0).

How do I run the set up once so that I will only get a single repeating 
task queued in the web2py scheduler.

Thanks in advance for any help!

Cheers,
Kenneth
 


-- 
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.

Reply via email to