Ask Your Question
1

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

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

holger-king gravatar image

Dear community,

when changing an OpenStack related Python source file (e.g. "/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py") 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
1

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

holger-king gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 135 times

Last updated: Jul 11 '15