Package flumotion :: Package component :: Module component :: Class BaseComponent
[hide private]

Class BaseComponent

source code

             object --+    
                      |    
common.common.InitMixin --+
                          |
    common.log.Loggable --+
                          |
             object --+   |
                      |   |
        gobject.GObject --+
                          |
                         BaseComponent
Known Subclasses:

I am the base class for all Flumotion components.

Nested Classes [hide private]
child class of BaseComponentMedium componentMediumClass
the medium class to use for this component
Instance Methods [hide private]
 
__init__(self)
Subclasses should not override __init__ at all.
source code
 
init(self)
A subclass should do as little as possible in its init method.
source code
 
do_check(self)
Subclasses can implement me to run any checks before the component performs setup.
source code
 
do_setup(self)
Subclasses can implement me to set up the component before it is started.
source code
 
do_start(self, *args, **kwargs)
BaseComponent vmethod for starting up.
source code
 
do_stop(self)
BaseComponent vmethod for stopping.
source code
 
setup(self, config, *args, **kwargs)
Sets up the component with the given config.
source code
 
start(self, *args, **kwargs)
Tell the component to start.
source code
 
setShutdownHook(self, shutdownHook)
Set the shutdown hook for this component (replacing any previous hook).
source code
 
stop(self)
Tell the component to stop.
source code
 
emit(self, name, *args) source code
 
getName(self) source code
 
setWorkerName(self, workerName) source code
 
getWorkerName(self) source code
 
setMedium(self, medium) source code
 
setMood(self, mood)
Set the given mood on the component if it's different from the current one.
source code
int
getMood(self)
Gets the mood on the component.
source code
 
addMessage(self, message)
Add a message to the component.
source code
 
fixRenamedProperties(self, properties, list)
Fix properties that have been renamed from a previous version, and add a warning for them.
source code
 
adminCallRemote(self, methodName, *args, **kwargs)
Call a remote method on all admin client views on this component.
source code
 
_setConfig(self, config) source code
 
_updateCPUUsage(self) source code

Inherited from common.log.Loggable: __providedBy__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from gobject.GObject: __cmp__, __delattr__, __gdoc__, __gobject_init__, __hash__, __new__, __repr__, __setattr__, chain, connect, connect_after, connect_object, connect_object_after, disconnect, disconnect_by_func, emit_stop_by_name, freeze_notify, get_data, get_properties, get_property, handler_block, handler_block_by_func, handler_disconnect, handler_is_connected, handler_unblock, handler_unblock_by_func, notify, props, set_data, set_properties, set_property, stop_emission, thaw_notify, weak_ref

Inherited from object: __getattribute__, __reduce__, __reduce_ex__, __str__

Class Variables [hide private]
  logCategory = 'basecomp'
Implementors can provide a category to log their messages under.
  __gtype__ = <GType flumotion+component+component+BaseComponent...

Inherited from common.log.Loggable: __implemented__, __provides__

Instance Variables [hide private]
BaseComponentMedium medium
the component's medium
string name
the name of the component
Properties [hide private]

Inherited from gobject.GObject: __grefcount__

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Subclasses should not override __init__ at all.

Instead, they should implement init(), which will be called by this implementation automatically.

See flumotion.common.common.InitMixin for more details.

Overrides: object.__init__

init(self)

source code 

A subclass should do as little as possible in its init method. In particular, it should not try to access resources.

Failures during init are marshalled back to the manager through the worker's remote_create method, since there is no component state proxied to the manager yet at the time of init.

do_check(self)

source code 

Subclasses can implement me to run any checks before the component performs setup.

Messages can be added to the component state's 'messages' list key. Any error messages added will trigger the component going to sad an flumotion.common.errors.ComponentSetupError being raised; do_setup() will not be called.

In the event of a fatal problem that can't be expressed through an error message, this method should set the mood to sad and raise the error on its own.

self.config will be set before this is called.

Returns:
twisted.internet.defer.Deferred

do_setup(self)

source code 

Subclasses can implement me to set up the component before it is started. It should set up the component, possibly opening files and resources. Non-programming errors should not be raised, but returned as a failing deferred.

self.config will be set before this is called.

Returns:
twisted.internet.defer.Deferred

do_start(self, *args, **kwargs)

source code 

BaseComponent vmethod for starting up. If you override this method, you are responsible for arranging that the component becomes happy.

Returns:
twisted.internet.defer.Deferred

do_stop(self)

source code 

BaseComponent vmethod for stopping. The component should do any cleanup it needs, but must not set the component's mood to sleeping.

Returns:
twisted.internet.defer.Deferred

setup(self, config, *args, **kwargs)

source code 

Sets up the component with the given config. Called by the manager through the medium.

Returns:
twisted.internet.defer.Deferred
Raises:

start(self, *args, **kwargs)

source code 

Tell the component to start. This is called when all its dependencies are already started.

To hook onto this method, implement your own do_start method. See BaseComponent.do_start() for what your do_start method is responsible for doing.

Again, don't override this method. Thanks.

setShutdownHook(self, shutdownHook)

source code 

Set the shutdown hook for this component (replacing any previous hook). When a component is stopped, then this hook will be fired.

stop(self)

source code 

Tell the component to stop. The connection to the manager will be closed. The job process will also finish.

emit(self, name, *args)

source code 
Overrides: gobject.GObject.emit

addMessage(self, message)

source code 

Add a message to the component. If any of the messages is an error, the component will turn sad.

Parameters:

fixRenamedProperties(self, properties, list)

source code 

Fix properties that have been renamed from a previous version, and add a warning for them.

Parameters:
  • properties (dict) - properties; will be modified as a result.
  • list (list of tuple of (str, str)) - list of (old, new) tuples of property names.

adminCallRemote(self, methodName, *args, **kwargs)

source code 

Call a remote method on all admin client views on this component.

This gets serialized through the manager and multiplexed to all admin clients, and from there on to all views connected to each admin client model.

Because there can be any number of admin clients that this call will go out do, it does not make sense to have one return value. This function will return None always.


Class Variable Details [hide private]

__gtype__

Value:
<GType flumotion+component+component+BaseComponent (149397616)>