Autoreload source code

Asked by turkinigor

Did anybody configure OpenERP to autoreload source code after modification and saving it?
Need to restart openerp server each time is irritable sometimes.
It will be useful a lot, but I'm not so good in Python.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
turkinigor
Solved:
Last query:
Last reply:
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#1

Hi Turkinigor,

Sorry to tell you, but its the basic need for any source code.It needs to be compiled first and then only it comes into effect.

So, If you have changed anything in .py file, you should restart the server to make those changes into act.

Thank you.

Revision history for this message
turkinigor (turkinigor) said :
#2

Hi, Jay

Thank you for answer but I'm guess it is possible.
For example, http://docs.python.org/library/functions.html#reload and here http://www.modpython.org/live/mod_python-3.2.5b/doc-html/dir-other-par.html
It is low-level feature but possible. Even in Java you can reload at runtime source codes.

So I thought somebody made this stuff, it will accelerate add-on developing. Jay, if you are interested and team will try get OpenERP to autoreload its modules, please tell. Otherwise, I will do it myself and will share my research results.

Regards, Igor

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#3

Hi Igor,

Its really a nice suggestion.

Would you please create one blueprint for the same? Link : https://blueprints.launchpad.net/openobject-server

Or if you do it in your branch, and send a merge request,we will take care of the same.

Kindly close this thread.

Many thanks,

Jay,

Revision history for this message
Nicolas DS (zyphos) said :
#4
Revision history for this message
turkinigor (turkinigor) said :
#5

Zyph0s,
are you carefully read my blueprint? https://blueprints.launchpad.net/openobject-server/+spec/auto-reload-sources
The concept is that the developer should not manualy reload a module, just to save the source file. OpenERP should automaticly compare timestamp of .py file and complled file, then recompile source if neccessary.

Please, remove your blueprint and extend my one. Or, if you disagree, tell other pros and cons.

Revision history for this message
Nicolas DS (zyphos) said :
#6

The problems with timestamp is the fact that I save very often file that I am editing. In case of power failure, os crash, ... So a saved file could be not runnable at all. You must decide when the changes are correct and ready to be commit to the running server.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) said :
#7

Guys,

I propose to clone the Ruby on Rails env dev autoreload feature, it works great and everybody acknowledge it, now one should look at how it work exactly in Rails. I can't do it right now, but could eventually over the coming days. But I guess it's timestamp based.

Revision history for this message
turkinigor (turkinigor) said :
#8

Zyph0s,
While you are editing sources, you can save it very often, but openobject server does nothing at this time ( and do not recompile code under construction. When you make needed changes and want to try it out, you go to the interface push the button (wizard, button on the form, etc) and then openerp actually see timestamp and go forward.

Raphaël Valyi, its cool, please, post here as you will move to the result.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) said :
#9

From Cédric Krier:

Tryton already have this feature implemented, changeset here: http://hg.tryton.org/hgwebdir.cgi/trytond/rev/2e4a0933e8c1

Might be worth to copy.