umh..... current scheduling allows you to schedule a task from 8 to 10, to 
make it occur every 10 minutes but it won't start the next day.
Let me explain better:
you can do
start_time = today 8am
stop_time = today 6pm
period = 600 seconds (10 minutes)
but that single record would run only today.
So, you have 2 "paths" to follow:
- code your task to return immediatly without doing nothing if request.now 
is between 6pm and 8am
- use another task that will run at, let's say, 2am, to schedule another 
task for the following day.

the first can be something among the lines of
def mytask():
     if request.now.hour >= 18 or request.now.hour =< 8:
           return None
     ....do something


and then you can just schedule it with repeats = 0 and period = 600
or, the second one, would be something like
def schedule_a_day_task():
      start_time = request.now.replace(hour=8, minute=0, second=0)
      stop_time = request.now.replace(hour=18, minute=0, second=0)
      unique_id = 'my_task_%s' % request.now.date()
      scheduler.queue_task(the_other_task, [args], {vars}, period=600,start_time
=start_time, stop_time=stop_time, uuid=unique_id, repeats=0)
      db.commit()

in this case you'd schedule "schedule_a_day_task" as start_time = tomorrow 
at 2am, repeats=0, period = 60*60*24 and you'd be sure that it will take 
care of queueing every day a task (the_other_task) that does the work 
between 8am and 6pm.


If you have any doubts please ask.


On Friday, May 3, 2013 7:01:03 PM UTC+2, Brian M wrote:
>
> Is there any way to setup a recurring task with the built-in scheduler so 
> that it would say run every 10 minutes between just 8am and 6pm? I know 
> that it is easy enough to setup the every 10 minutes part, but it there any 
> way to restrict the time of day too?
>
> ~Brian
>

-- 

--- 
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/groups/opt_out.


Reply via email to