Yeah, that does not work because the query is not executed in the try block, 
hence it does not raise an exception. Try adding a .fetch(500) after order() 
and see if that stops the exception.

Also check out Andrew Fuller's 2010 next gen query IO talk. Once that gets 
implemented maybe you'll be able to remove this code. 

Robert



On Jul 21, 2010, at 4:40, GeekTantra <geektan...@gmail.com> wrote:

> I am trying to segregate the queries that require indexes by using a
> try except block like following
> 
>  try:
>    posts_list =
> posts.Post.objects.all().filter(post_status__in=post_status).order_by('-
> created')
>  except:
>    the_posts_list = posts.Post.objects.all()
>    posts_list = [ p for p in the_posts_list if p.post_status in
> post_status ]
> 
> I know its highly inefficient code in the except block but this should
> make the application work in case the initial indexes are not being
> served for the first deployment, but I still keep getting the
> NeedIndexError. Any Idea why this is happening?
> 
> On Jul 21, 12:35 pm, Robert Kluin <robert.kl...@gmail.com> wrote:
>> I do not know of any way to monitor index build times currently.
>> 
>> For me building new indexes is usually fast. Typically under 30 minutes.  
>> But I built one today that took 6 hours on a kind with 220 entities. :/
>> 
>> Robert
>> 
>> On Jul 21, 2010, at 3:09, GeekTantra <geektan...@gmail.com> wrote:
>> 
>> 
>> 
>>> Thanks a lot for your response.
>> 
>>> I just wanted to know whether this will be a perennial or just a
>>> temporary problem? And any way of monitoring the index servers
>>> something similar tohttp://code.google.com/status/
>> 
>>> I need to know this because I want to launch my Open Source product
>>> and don't want to launch it at a time when this problem persists.
>> 
>>> Is there by any chance I can do a work around for this problem till
>>> the indexes are ready to serve?
>> 
>>> I have some simple ancestor properties, some filtering and some order
>>> operations which require indexing.
>> 
>>> On Jul 21, 11:59 am, Robert Kluin <robert.kl...@gmail.com> wrote:
>>>> Sometimes the index servers get bogged down. When that happens, even for 
>>>> an empty datastore, you will have to wait for new indexes.
>> 
>>>> Slow initial index building is a pretty common complaint.
>> 
>>>> Robert
>> 
>>>> On Jul 20, 2010, at 20:59, GeekTantra <geektan...@gmail.com> wrote:
>> 
>>>>> I am trying to create an application on appengine. The problem is when
>>>>> I deploy it to production, even with empty datastore, it takes atleast
>>>>> 2 hours for the indexes to start serving.
>> 
>>>>> The contents of the index.yaml are:
>>>>> - kind: comments
>>>>>  properties:
>>>>>  - name: content_type_id
>>>>>  - name: is_public
>>>>>  - name: is_removed
>>>>>  - name: object_pk
>>>>>  - name: site_id
>>>>>  - name: created
>> 
>>>>> - kind: comments
>>>>>  properties:
>>>>>  - name: content_type_id
>>>>>  - name: object_pk
>>>>>  - name: user_email
>>>>>  - name: user_name
>>>>>  - name: user_url
>>>>>  - name: created
>> 
>>>>> - kind: content_type
>>>>>  properties:
>>>>>  - name: app_label
>>>>>  - name: name
>> 
>>>>> - kind: pages
>>>>>  properties:
>>>>>  - name: post_status
>>>>>  - name: created
>> 
>>>>> - kind: pages
>>>>>  properties:
>>>>>  - name: post_status
>>>>>  - name: post_title
>> 
>>>>> - kind: posts
>>>>>  properties:
>>>>>  - name: post_status
>>>>>  - name: created
>> 
>>>>> - kind: posts
>>>>>  properties:
>>>>>  - name: post_status
>>>>>  - name: created
>>>>>    direction: desc
>> 
>>>>> No since I want to make this application an opensource product its
>>>>> important that people can deploy it instantly and see the results but
>>>>> without the indexes being served instantly I start getting 500
>>>>> errors(NoIndexErrors) instantly when I deploy. Is there a work around.
>>>>> Initially the datastore would be completely empty, so I presume the
>>>>> Indexing shouldn't take so much time.
>> 
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "Google App Engine" group.
>>>>> To post to this group, send email to google-appeng...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to 
>>>>> google-appengine+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group 
>>>>> athttp://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 google-appeng...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> google-appengine+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://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 google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> 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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to