learn from niphlod github about web2py scheduler test, there are some 
question about it:
1. is it neccessary to delete all data in table scheduler_worker, 
scheduler_task, scheduler_run before queue the task?
*e.g.*
def clear_all():
swstatus = db(db.scheduler_worker.id > 0).delete()
srstatus = db(db.scheduler_run.id > 0).delete()
ststatus = db(db.scheduler_task.id > 0).delete()
2. let say i have 2 or more scheduler function is it better to group all 
the 2 in 1 function or separate it? what is recommended or best practice 
for this?
*e.g. group all the 2*
def queue_task():
start_now = datetime.datetime.now()
scheduler.queue_task('task_0', prevent_drift = True, start_time = 
start_now, 
next_run_time = start_now, stop_time = (start_now + datetime.timedelta(days 
= 1) ),
repeats = 0, retry_failed = 1, period = 60, timeout = 86400
)
scheduler.queue_task('task_1', prevent_drift = True, start_time = 
start_now, 
next_run_time = start_now, stop_time = (start_now + datetime.timedelta(days 
= 1) ),
repeats = 0, retry_failed = 1, period = 86400, timeout = 86400
)
response.js = "jQuery('#scheduler_status').get(0).reload()"
response.flash = T("Task Queued")

*e.g. separate queue task*
def queue_task_0():
start_now = datetime.datetime.now()
scheduler.queue_task('task_0', prevent_drift = True, start_time = 
start_now, 
next_run_time = start_now, stop_time = (start_now + datetime.timedelta(days 
= 1) ),
repeats = 0, retry_failed = 1, period = 60, timeout = 86400
)
response.js = "jQuery('#scheduler_status').get(0).reload()"
response.flash = T("Task Queued")

def queue_task_1():
start_now = datetime.datetime.now()
scheduler.queue_task('task_1', prevent_drift = True, start_time = 
start_now, 
next_run_time = start_now, stop_time = (start_now + datetime.timedelta(days 
= 1) ),
repeats = 0, retry_failed = 1, period = 86400, timeout = 86400
)
response.js = "jQuery('#scheduler_status').get(0).reload()"
response.flash = T("Task Queued")

3. i want to have the scheduler run at the day 28 of the month, what is 
recommended to use next_run_time or period to achieve it? 
*e.g.*
start_eom = '%s-%s-28 00:00:00' % (request.now.year, request.now.month)
start_eom_date = datetime.datetime.strptime(start_eom, '%Y-%m-%d %H:%M:%S')

thanks and best regards,
stifan

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

Reply via email to