Changes in OpenStack python sources do take effect only after a restart of the OS

asked 2015-07-10 11:45:14 -0600

holger-king gravatar image

Dear community,

when changing an OpenStack related Python source file (e.g. "/usr/lib/python2.7/site-packages/nova/scheduler/") the changes do take affect only after a restart of the complete host (here: the controller host).

We just wonder whether there is a caching mechanism being implemented that prevents Python source code changes from taking effect directly after the source file update and the re-execution of that code via OpenStack.

The Python runtime environment being installed on the host is: Python 2.7

Currently, we work with RDO-OpenStack and version KILO.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-10 14:42:29 -0600

holger-king gravatar image

updated 2015-07-11 01:51:46 -0600

Due to efficiency increasements Python seems to import each module only once per interpreter session. That's why the interpreter has to be restarted when changing modules.

Alternatively, when onle single module have been changed the reload functionality of the builtin modules "imp" respectively "importlib" can be used. Examples can be found on the internet. But it's clear that this has to be done within the interpreter session where the module has been loaded. More easier than restarting the complete operating system is restarting the OpenStack service (a python based one) that executes the changed python soure file.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-07-10 11:45:14 -0600

Seen: 210 times

Last updated: Jul 11 '15