[openstack-dev] [Fuel][Nailgun]Problems with auto-reloading

Roman Prykhodchenko rprikhodchenko at mirantis.com
Tue Dec 2 13:23:02 UTC 2014

Hi folks,

today we encountered a problem caused by auto-reload feature and our code-organisation.
The problem is that web.py tries reloading modules at some point and while it does that it expects that modules could be reloaded in any order without raising any errors.

Unfortunately for Nailgun that condition is not satisfied in at least one place. That place is SQLAlchemy models which are placed in different modules. If web.py tries to reload any model’s module, say notifications.py, before reloading base module, Notifications will try registering itself in the old Base’s MetaData which already contain info about the appropriate table and that causes errors like "Table 'notifications' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.” That problem happens on every request that touches database.

There are several possible solutions for this problem:

- Disable autoreload even in Debug mode, because tests always run in that mode and that’s the cause these failures occure
  - Someone might need that so a command line option or config parameter for autoreload
- Re-organise code to guarantee correct reloading order
- Enable extention of existing tables in metadata, but I’m not sure what will be other consequences for that.

- romcheg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141202/f98f61bb/attachment.pgp>

More information about the OpenStack-dev mailing list