Running SQL Alchemy Play Nice using the Google App Engine

I am currently working on a Google App Engine (Python) project that mainly uses Google Cloud SQL (with SQL Alchemy) to back up data.

In most cases, everything works fine. However, from time to time, “something” leaves, and we begin to receive strange exceptions. For instance:

  • AttributeError: ColumnProperty object does not have a strategy attribute

  • AttributeError: the 'PropertyProperty' object does not have the 'strategy' attribute

We think this may be due to the rollout of a new GAE instance, but we cannot be sure.

With all that said, my question is this. What are some strategies that my team can use to track this issue?

Keep in mind that the application runs on the Google App Engine, which may slightly limit our options.

Update: Owen Nelson's comment below. We added threading.RLock , as suggested by Google. However, we still see this problem, but much less often.

I want to be clear, so far we have not been able to reproduce this problem in our local environment. We are sure that this is connected with dynamic instances, and this is not what we really can do in development.

+4
source share
1 answer

From what I can understand, your application has problems only in production mode.

Try to reproduce the error in dev mode

A better solution would be to reproduce this error in development mode. To do this, you can try running the unittest package with LOTS data. (See how to run a local appengine test ).

If this does not work ...

Enable appstats to get more information about the handler.

You can enable appstats to try to get information about which handler is currently causing the problem. Appstats usually gives you information about the data warehouse, this is not relevant in our case, but you can get information from requests in general (for example, response time)

Define a handler and wrap it in a nice catch attempt

Once you identify the source of the problem or where it came from, you can surround it with try..catch. With this, you can get more detailed information about the current execution of Trace and hopefully solve your problem.

+1
source

Source: https://habr.com/ru/post/1445903/


All Articles