On Friday, July 21, 2017 at 6:27:50 AM UTC-7, Rudy wrote:
>
> I want to clean up a table daily using schedule at midnight, I don't want 
> scheduler to poll too often to waste unnecessary resource. how should I do 
> it?
>

I'm pretty sure Niphlod will say (and has said), "Why bother?" -- the 
scheduler resources are pretty minimal when a task isn't running.

Just about everything except the heartbeat change seems like it will 
consume as much resources.

By the way, the 2.15.x builds had the "cron-like" queue option, which I'm 
looking forward to trying.
 

> 1) give heartbeat a large number in scheduler = Scheduler(db_sch, 
> heartbeat=7200)?
> 2) if len(db_sch().select(db_sch.scheduler_task.ALL)) == 0:
>          scheduler.queue_task(clear_curr_exch_cache, period=86400, 
> repeats=0)
> 3) create a cron job in linux to start the scheduler (python web2py.py -K 
> myapp -p 8002), another cron job to kill the process after a fixed period 
> of time
> 4) create a cron job to start the scheduler, call scheduler.terminate() 
> after db.commit() before return in the task action
> 5) combination of above
>
> Another question: how to i associate tasks to a specific group? I seem to 
> miss this in the doc
>
>
I'd take a look at the scheduler tests -- Niphlod's default.py controller 
at  
<URL: https://github.com/niphlod/w2p_scheduler_tests>
seems to have the detailed explanation around lines 600ff

/dps

Thank you!
>

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