Kay Crashing after heavy deferred task jobs

18 views
Skip to first unread message

someone1

unread,
Sep 27, 2011, 2:33:17 PM9/27/11
to kay-users
I have a site that i'm building that seems to run fine. I recently
setup a deferred task job that fan outs and aggregates a decent amount
of data (6000-10000 entries of about 2-4KB each) and writes to a
model, lets call this ModelA. On every page load on the main, I do a
lookup on the data store to a model, lets call this one ModelB.
Nothing in ModelA or ModelB references one another, they aren't
parents of one another, or anything of that sort. I can load the main
site just fine after doing an appcfg update, however, after running
that deferred task and trying to load a page again I get the following
issue:

File "[...]/kay/__init__.py", line 177, in kind
return cls._meta.db_table

AttributeError: type object 'ModelA' has no attribute '_meta'

I have to do another "update" via appcfg before my app becomes usable
again. Is this an issue with my app or within kay? Again, it used to
work fine before I implemented that deferred task.

Thanks,
Prateek

someone1

unread,
Sep 27, 2011, 2:35:54 PM9/27/11
to kay-users
I forgot to mention i have the disabled adding the application name
prefix to my models.

Thanks.

Ian Lewis

unread,
Sep 27, 2011, 8:01:36 PM9/27/11
to kay-...@googlegroups.com
Hi,

The reason for this is that kay monkey patches the db.Model class. I'm
assuming that if you are getting this
error you are running an application that is not a kay application
(i.e. not using kay's main method).e

You need to add the following code to the top of the main module of your app:

import kay
kay.setup()

After that it should patch the db.Model class and work for you.

Thanks,
Ian

> --
> You received this message because you are subscribed to the Google Groups "kay-users" group.
> To post to this group, send email to kay-...@googlegroups.com.
> To unsubscribe from this group, send email to kay-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/kay-users?hl=en.
>
>

--
Ian

http://www.ianlewis.org/

someone1

unread,
Sep 27, 2011, 11:50:23 PM9/27/11
to kay-users
Thanks for your reply, but I believe I am using a kay application. I
followed the getting started guide and everything. Like I previously
mentioned, the app works fine until I run the deferred task (which
again, doesn't write to the model I call upon in my kay application).

urls.py:
###############################
from kay.routing import (
ViewGroup, Rule
)

view_groups = [
ViewGroup(
Rule('/', endpoint='index', view='appnameremoved.views.index'),
Rule('/listings/<username>', endpoint='listing',
view='appnameremoved.listings.listings'),
)
]
###############################

listings.py:
###############################
[INCLUDES]
class ListingsHandler(kay.handlers.BaseHandler):
def get(self, username=None):
if username:
user = ModelB.all().filter("user_id", username).get()
[CODE TRUNCATED]
listings = ListingsHandler()
###############################

This little bit is where it crashes. Is this not a valid kay
application? I thought this was working through kay since before i set
ADD_APP_PREFIX_TO_KIND = False, my model names were prefixed with my
appname.

Please let me know if I'm not following this correctly!

Thank you,
Prateek
> > For more options, visit this group athttp://groups.google.com/group/kay-users?hl=en.
>
> --
> Ian
>
> http://www.ianlewis.org/

Takashi Matsuo

unread,
Sep 28, 2011, 8:22:28 AM9/28/11
to kay-...@googlegroups.com

Hi someone1,

I'll remove this harmful and unprofitable monckey-patched feature shortly, so how about just comment out the following line in kay.__init__.py?

  db.Model.kind = kind

It will definitely solve your issue.

Actually I strongly regret that I incorporated this feature. 

Hope it helps.

-- 
Takashi Matsuo
matsuo....@gmail.com
Kay's daddy
Reply all
Reply to author
Forward
0 new messages