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

2014-12-02 Thread Roman Prykhodchenko
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


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


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

2014-12-02 Thread Vitaly Kramskikh
I don't even remember if/when autoreloading worked correctly. +1 for
disabling this feature.

2014-12-02 16:23 GMT+03:00 Roman Prykhodchenko rprikhodche...@mirantis.com
:

 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

 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




-- 
Vitaly Kramskikh,
Software Engineer,
Mirantis, Inc.
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev