I use TaskQueue for stuff like this (I have a task that needs to run at
every 5 minute mark [1:05, 1:10, 1:15, etc]).
Schedule a daily cron (or maybe just a one time cron) that kicks of the
first task.. and then write the task so that it schedules the next run after
it finishes it's current run (and either have it keep track of how many
times it has run so that it finishes up for the day.. or try to have it run
forever).
The details are, of course, you must calculate your countdown (some people
use eta..) to tell it when to have the next task start up. I prefer to use
countdown and just use modulus to get the number of seconds until my next
target time (details left to the reader.) Also, you must be able to accept
that a task may re-run from time to time due to unexpected errors that you
do not handle.
Here is the taskAdd() function that I use.. it handles weird issues like..
the Task was successfully added.. but some error made the current task try
again.. so.. you need to name the tasks so you can except the errors you'll
get for a task that has already been added to the queue. It also retries
the task add if it gets any other exception:
def taskAdd(name,delay,counter,step,wait=.5):
try:
taskqueue.add(url = '/myTaskQueue/myTaskHandler', countdown = delay,
name = name,
params = {'counter' : counter,
'step' : step} )
except (taskqueue.TaskAlreadyExistsError, taskqueue.TombstonedTaskError),e
:
pass
except:
from time import sleep
sleep(wait)
taskAdd(delay,name,counter,step,2*wait)
On Thu, Mar 25, 2010 at 8:38 PM, prgmratlarge <[email protected]> wrote:
> How can I run a cron job at the 30 minute point on every hour. I don't
> want it to go every half hour -- i want it to go on every half hour of
> the hour. So it should specifically run at:
>
> 1:30,2:30,3:30,etc...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.