supervisor_cache

RPC extension for supervisor
Download

supervisor_cache Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Mike Naberezny
  • Publisher web site:
  • http://github.com/mnaberez/

supervisor_cache Tags


supervisor_cache Description

RPC extension for supervisor supervisor_cache is an RPC extension for the supervisor module that provides the ability to cache limited amounts of data in the supervisor instance as key/value pairs.InstallationRelease packages are available on the Python Package Index (PyPI). You can download them from there or you can use easy_install to automatically install or upgrade:$ easy_install -U supervisor_cacheAlternatively, you can download a package from GitHub in .tar.gz or .zip format. After extracting the package, use the following command to install:$ python setup.py installAfter installing the package, you must modify your supervisord.conf file to register the RPC interface and supervisorctl plugin:supervisor.rpcinterface_factory = supervisor_cache.rpcinterface:make_cache_rpcinterfacesupervisor.ctl_factory = supervisor_cache.controllerplugin:make_cache_controllerpluginAfter modifying the supervisord.conf file, both your supervisord instance and supervisorctl must be restarted for these changes to take effect.UsageThe cache functions allow key/value pairs to be stored and fetched. The following Python interpreter session demonstrates the usage.First, a ServerProxy object must be configured. If supervisord is listening on an inet socket, ServerProxy configuration is simple:>>> import xmlrpclib>>> s = xmlrpclib.ServerProxy('http://localhost:9001')If supervisord is listening on a domain socket, ServerProxy can be configured with SupervisorTransport. The URL must still be supplied and be a valid HTTP URL to appease ServerProxy, but it is superfluous.>>> import xmlrpclib>>> from supervisor.xmlrpc import SupervisorTransport>>> s = xmlrpclib.ServerProxy('http://127.0.0.1/whatever', ... SupervisorTransport('', '', 'unix:///path/to/supervisor.sock'))Once ServerProxy has been configured appropriately, we can now exercise supervisor_cache:>>> s.cache.getKeys()[]>>> s.cache.store('foo', 'bar')True>>> s.cache.fetch('foo')'bar'>>> s.cache.getKeys()The key must be a string and cannot be zero-length. The value must also be a string but is permitted to be zero-length.Please consult the inline source documentation for the specifics of each command available. Requirements: · Python


supervisor_cache Related Software