oms Package

oms Package

OpenNode Management Service.

config Module

class opennode.oms.config.OMSRequiredConfigurationFiles(context)[source]

Bases: grokcore.component.components.Subscription

config_file_names()[source]
class opennode.oms.config.OmsBaseConfig(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False)[source]

Bases: ConfigParser.ConfigParser

NO_DEFAULT = <object object at 0x23b8ff0>
get_base_dir()[source]
getboolean(section, option, default=<object object at 0x23b8ff0>)[source]
getfloat(section, option, default=<object object at 0x23b8ff0>)[source]
getint(section, option, default=<object object at 0x23b8ff0>)[source]
getstring(section, option, default=<object object at 0x23b8ff0>)[source]
class opennode.oms.config.OmsConfig(config_filenames=<object object at 0x23b8fe0>)[source]

Bases: opennode.oms.config.OmsBaseConfig

NO_DEFAULT = <object object at 0x23b8fe0>
update(config_filenames=<object object at 0x23b8fe0>)[source]
opennode.oms.config.gen_config_file_names(module, name)[source]

Generate a list of standard configuration files for a given software package: defaults contained in egg, configuration file in current directory (usually installation dir), and user override

opennode.oms.config.get_config()[source]
opennode.oms.config.get_config_cmdline()[source]

Special config parser for options overridden from command line

opennode.oms.config.update()[source]

Update a config file reload

core Module

OpenNode Management Service.

class opennode.oms.core.AfterApplicationInitalizedEvent(test=False)[source]

Bases: object

class opennode.oms.core.ApplicationInitalizedEvent(test=False)[source]

Bases: object

class opennode.oms.core.BeforeApplicationInitalizedEvent(test=False)[source]

Bases: object

opennode.oms.core.deferred_call(self, fun)[source]
opennode.oms.core.grok_all()[source]
opennode.oms.core.load_zcml(*args)[source]

We rely on grok to load the configuration for our modules, but we depend on some libraries which have only zcml based configuration, thus we need to load only those we need.

opennode.oms.core.setup_environ(test=False)[source]

daemon Module

opennode.oms.daemon.ensure_zeo_is_running(event)[source]

We start zeo after the application has performed the basic initialization because we cannot import opennode.oms.zodb.db until all grokkers are run in the correct order.

opennode.oms.daemon.get_base_dir()[source]

Locates the base directory containing opennode/oms.tac

opennode.oms.daemon.run()[source]

Starts the child zeo process and then starts the twisted reactor running OMS

opennode.oms.daemon.run_app()[source]

Runs the application using opennode/oms.tac

opennode.oms.daemon.run_debugger(args)[source]
opennode.oms.daemon.run_zeo(db)[source]

Spawns a zeo daemon and restart it if it crashes

logging Module

class opennode.oms.logging.FilteredFileLogObserver(f)[source]

Bases: twisted.python.log.FileLogObserver

Filter out unwanted log messages, especially during development.

emit(eventDict)[source]
ignored_messages = ['.*keepalive@openssh.com', '.*POST .*/webterm', '.*GET /favicon.ico', '.*POST /+stream', '.*OPTIONS /', '.*GET /plugins/onc/root/', 'got channel session request', 'channel open', 'remote close', 'sending close 0', 'disabling diffie-hellman-group-exchange because we cannot find moduli file']
ignored_systems = ['SSHServerTransport', 'SSHService']
opennode.oms.logging.setup_logging()[source]

plugin Module

pyshell Module

opennode.oms.pyshell.run()[source]

util Module

class opennode.oms.util.Singleton(name, bases, dict)[source]

Bases: type

Singleton metaclass.

exception opennode.oms.util.TimeoutException[source]

Bases: exceptions.Exception

Raised when time expires in timeout decorator

opennode.oms.util.adapter_value(value)[source]

Utility which allows to to quickly register a subscription adapter as a value instead of

>>> provideSubscriptionAdapter(adapter_value(['useful', 'stuff']), adapts=(Compute,), provides=ISomething)
opennode.oms.util.async_sleep(secs)[source]

Util which helps writing synchronous looking code with defer.inlineCallbacks.

Returns a deferred which is triggered after secs seconds.

class opennode.oms.util.benchmark(name)[source]

Bases: object

Can be used either as decorator: >>> class Foo(object): ... @benchmark(“some description”) ... def doit(self, args): ... # your code

or as context manager: >>> with benchmark(“some description”): >>> # your code

and it will print out the time spent in the function or block.

opennode.oms.util.blocking_yield(deferred, timeout=None)[source]

This utility is part of the HDK (hack development toolkit) use with care and remove its usage asap.

Sometimes we have to synchronously wait for a deferred to complete, for example when executing inside db.transact code, which cannot ‘yield’ because currently db.transact doesn’t handle returning a deferred.

Or because we are running code inside a handler which cannot return a deferred otherwise we cannot block the caller or rollback the transaction in case of async code throwing exception (scenario: we want to prevent deletion of node)

Use this utility only until you refactor the upstream code in order to use pure async code.

opennode.oms.util.exception_logger(fun)[source]
opennode.oms.util.find_nth(haystack, needle, n, start_boundary=None)[source]
opennode.oms.util.get_direct_interface(obj)[source]
opennode.oms.util.get_direct_interfaces(obj)[source]

Returns the interfaces that the parent class of obj implements, exluding any that any of its ancestor classes implement.

>>> from zope.interface import Interface, implements, implementedBy
>>> class IA(Interface): pass
>>> class IB(Interface): pass
>>> class A: implements(IA)
>>> class B(A): implements(IB)
>>> b = B()
>>> [i.__name__ for i in list(implementedBy(B).interfaces())]
['IB', 'IA']
>>> [i.__name__ for i in get_direct_interfaces(b)]
['IB']
opennode.oms.util.get_f(obj, key)[source]
opennode.oms.util.get_i(obj, key)[source]
opennode.oms.util.get_u(obj, key)[source]
opennode.oms.util.query_adapter_for_class(cls, interface)[source]
opennode.oms.util.subscription_factory(cls, *args, **kwargs)[source]

Utility which allows to to quickly register a subscription adapters which returns new instantiated objects of a given class

>>> provideSubscriptionAdapter(subscription_factory(MetricsDaemonProcess), adapts=(IProc,))
opennode.oms.util.threaded(fun)[source]

Helper decorator to quickly turn a function in a threaded function using a newly allocated thread, mostly useful during debugging/profiling in order to see if there are any queuing issues in the threadpools.

opennode.oms.util.timeout(secs)[source]

Decorator to add timeout to Deferred calls

opennode.oms.util.trace(fun)[source]
opennode.oms.util.trace_methods(cls)[source]

Table Of Contents

Previous topic

opennode Package

Next topic

backend Package

This Page