Hi Ravi,
  Responses inline.

On Sat, Apr 30, 2011 at 17:07, Ravi Sharma <[email protected]> wrote:
> Hi Robert,
> How naming the task will help me?Sorry i didnt understand it. But anyways i
> have named them now.

The purpose in naming tasks is to help prevent fork-bombs.  It helps
because otherwise if your task fails and retries after inserting the
next task, or it runs multiple times, you'll have two (or more) tasks
that are 'chaining.'  If a new task fails, you'll have more chains.
Naming tasks helps prevent this, you just need to catch and ignore
task already exists errors and tombstoned task errors.


>
> In My code i have made sure that whatever exception comes from my code will
> not be thrown out of my controller and will just print it in log. So in what
> scenerio it failed and retried and also before failing completely it added
> next task in the queue which is my last statment in my controller.(Thats how
> i got more then 1 task in my queue)

Tasks sometimes run multiple times, even if there was no exception or
they are named.  I don't see this happen a lot, but it does happen.


> And if it failed to add Task then it should retry the current task and i
> should still have 1 active task only.

It will only retry if you return a non 200 HTTP status code.  So don't
just blindly catch and ignore exceptions unless you want a task to not
retry.  Certainly you should always make sure you've inserted your
continuation, otherwise the chain will break (in other words, no more
tasks...).

>
> and today also i found that my task stopped. I dont know how can i make sure
> that i can run one task every N seconds and i dont need to monitor it
> manually.....

I totally agree with Nischal, you might want to look at cron.



>
> Thanks
> Ravi.
>
>
> On Sat, Apr 30, 2011 at 9:01 PM, Robert Kluin <[email protected]>
> wrote:
>>
>> Hi Ravi,
>>  You should name your tasks.  If one fails and retries for some
>> reason, or runs multiple times, then the tasks will start to fan-out
>> (think fork-bomb).
>>
>>  http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#taskName(java.lang.String)
>>
>>
>>  To control the delay you can set a countdown or eta.  Note that the
>> time you specify is like a request, I've not seen tasks run before
>> than time, but tasks will sometimes run later than requested.
>>
>>  http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#countdownMillis(long)
>>
>>
>> Robert
>>
>>
>>
>>
>>
>> On Sat, Apr 30, 2011 at 02:13, Ravi Sharma <[email protected]> wrote:
>> > Hi ,
>> > I have a chained task which runs every 1 second(Still wondering how can
>> > i
>> > run it every 3 seconds)
>> > Task code is something like this
>> > try{
>> >             //Do something
>> >            //read data store and update datastore
>> >         }catch(Throwable ex){
>> >             logger.log(Level.Sever,ex.getMessage(),ex);
>> >         }finally{
>> >             //add next task to queue to be run next
>> >             Queue queue = QueueFactory.getQueue("queuename");
>> >
>> >
>> > queue.add(TaskOptions.Builder.withUrl("/tasks/mytask/"+auctionId).method(Method.GET));
>> >         }
>> >
>> > Now i expect that one task will be finished and next will be added to
>> > the
>> > queue. 2 days back i found 4-5 tasks in the queue i dont know how they
>> > got
>> > there
>> >
>> > and today i found tasks queue empty. How it can be possible that queue
>> > can
>> > get more then 1 task at a time or it can get empty.I still have quota
>> > left
>> > for the day.
>> >
>> > My App Name is edurectory
>> >
>> >
>> > --
>> > 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.
>> >
>>
>> --
>> 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.
>>
>
> --
> 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.
>

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

Reply via email to