Package flumotion :: Package manager :: Module component :: Class ComponentAvatar
[show private | hide private]
[frames | no frames]

Class ComponentAvatar

        Loggable --+    
                   |    
  Avatar --+       |    
           |       |    
Loggable --+       |    
           |       |    
      Avatar --+   |    
               |   |    
  PingableAvatar --+    
                   |    
       ManagerAvatar --+
                       |
                      ComponentAvatar


I am a Manager-side avatar for a component. I live in the ComponentHeaven.

Each component that logs in to the manager gets an avatar created for it in the manager.
Method Summary
  __init__(self, *args, **kwargs)
  __repr__(self)
  attached(self, mind)
Tell the avatar that the given mind has been attached.
  authenticate(self, keycard)
Authenticate the given keycard.
  cleanup(self)
Clean up when detaching.
  detached(self, mind)
Tell the avatar that the peer's client referenced by the mind has detached.
  eatFrom(self, fullFeedId, host, port)
  expireKeycard(self, keycardId)
Expire a keycard issued to this component because the bouncer decided to.
  feedTo(self, componentId, feedId, host, port)
list of str getEaters(self)
Get a list of feedIds for feeds this component wants to eat from.
  getElementProperty(self, element, property)
Get a property of an element.
list of str getFeeders(self)
Get a list of feedIds that this component has feeders for.
int getFeedServerPort(self)
Returns the port on which a feed server for this component is listening on.
str getName(self)
Get the name of the component.
str getParentName(self)
Get the name of the component's parent.
int getPid(self)
Return the PID of the component.
str getRemoteManagerIP(self)
Get the IP address of the manager as seen by the component.
str getType(self)
Get the component type name of the component.
str getWorkerName(self)
Return the name of the worker.
  parseEaterConfig(self, eater_config)
  parseFeederConfig(self, feeder_config)
  perspective_cleanShutdown(self)
Called by a component to tell the manager that it's shutting down cleanly (and thus should go to sleeping, rather than lost or sad)
  perspective_error(self, element, error)
  perspective_expireKeycard(self, requesterId, keycardId)
Expire a keycard (and thus the requester's connection) issued to the given requester.
  perspective_feedReady(self, feedName, isReady)
Called by the component to tell the manager that a given feed is ready or not.
  perspective_removeKeycardId(self, bouncerName, keycardId)
Remove a keycard on the given bouncer on behalf of a component's medium.
  perspective_reservePortsOnWorker(self, workerName, numberOfPorts)
Request reservation a number of ports on a particular worker.
twisted.internet.defer.Deferred reloadComponent(self)
Tell the component to reload itself.
  removeKeycardId(self, keycardId)
Remove a keycard managed by this bouncer because the requester has gone.
  setElementProperty(self, element, property, value)
Set a property on an element.
  setup(self, conf)
Set up the component with the given config.
  start(self, *args, **kwargs)
  stateSet(self, state, key, value)
  stop(self)
Tell the avatar to stop the component.
  _addMessage(self, message)
  _getMoodValue(self)
  _mindErrback(self, failure, *ignores)
  _mindPropertyErrback(self, failure)
  _setMood(self, mood)
  _setMoodValue(self, moodValue)
    Inherited from ManagerAvatar
  disconnect(self)
Disconnect the remote PB client.
str or None getClientAddress(self)
Get the IPv4 address of the machine the PB client is connecting from, as seen from the avatar.
bool hasRemoteReference(self)
Check if the avatar has a remote reference to the peer.
  mindCallRemote(self, name, *args, **kwargs)
Call the given remote method, and log calling and returning nicely.
  perspective_authenticate(self, bouncerName, keycard)
Authenticate the given keycard.
list of (str, str) tuples of (bundleName, md5sum) perspective_getBundleSums(self, bundleName, fileName, moduleName)
Get a list of (bundleName, md5sum) of all dependency bundles, starting with this bundle, in the correct order.
list of (str, str) tuples perspective_getBundleSumsByFile(self, filename)
Get a list of (bundleName, md5sum) of all dependency bundles, starting with this bundle, in the correct order.
dict of str -> str perspective_getBundleZips(self, bundles)
Get the zip files for the given list of bundles.
twisted.internet.defer.Deferred firing list of str perspective_getKeycardClasses(self)
Get the keycard classes the manager's bouncer can authenticate.
  timeoutDisconnect(self)
  _mindCallRemoteErrback(self, f, name)
    Inherited from PingableAvatar
  perspective_ping(self)
  setMind(self, mind)
Tell the avatar that the given mind has been attached.
  startPingChecking(self, disconnect)
  stopPingChecking(self)
  _pingCheck(self)
    Inherited from Avatar
  mindCallRemoteLogging(self, level, stackDepth, name, *args, **kwargs)
Call the given remote method, and log calling and returning nicely.
  perspectiveMessageReceived(self, broker, message, args, kwargs)
    Inherited from Loggable
  debug(self, *args)
Log a debug message.
dict doLog(self, level, where, format, *args, **kwargs)
Log a message at the given level, with the possibility of going higher up in the stack.
  error(self, *args)
Log an error.
  info(self, *args)
Log an informational message.
  log(self, *args)
Log a log message.
  logFunction(self, *args)
Overridable log function.
  logObjectName(self)
Overridable object name function.
  warning(self, *args)
Log a warning.
  warningFailure(self, failure, swallow)
Log a warning about a Failure.

Instance Variable Summary
    Inherited from ManagerAvatar
flumotion.manager.base.ManagerHeaven heaven: the heaven this avatar is part of
twisted.spread.pb.RemoteReference mind: a remote reference to the client-side Medium
flumotion.manager.manager.Vishnu vishnu: the vishnu that manages this avatar's heaven

Class Variable Summary
str avatarId: the componentId
flumotion.common.planet.ManagerComponentState componentState: component state of this avatar's component
flumotion.common.planet.ManagerJobState jobState: job state of this avatar's component
str logCategory: Implementors can provide a category to log their messages under.
    Inherited from ManagerAvatar
str remoteLogName: name to use to log the other side of the connection
    Inherited from PingableAvatar
float _pingCheckInterval = 12.5                                                                  
    Inherited from Avatar
Implements __implemented__ = <implementedBy twisted.spread.pb.Avata...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Method Details

attached(self, mind)

Tell the avatar that the given mind has been attached. This gives the avatar a way to call remotely to the client that requested this avatar. This is scheduled by the portal after the client has logged in.
Parameters:
mind
           (type=twisted.spread.pb.RemoteReference)
Overrides:
flumotion.manager.base.ManagerAvatar.attached (inherited documentation)

authenticate(self, keycard)

Authenticate the given keycard. Gets proxied to flumotion.component.bouncers.bouncer.BouncerMedium.remote_authenticate The component should be a subclass of flumotion.component.bouncers.bouncer.Bouncer
Parameters:
keycard
           (type=flumotion.common.keycards.Keycard)

cleanup(self)

Clean up when detaching.

detached(self, mind)

Tell the avatar that the peer's client referenced by the mind has detached.

Called through the manager's PB logout trigger calling flumotion.manager.manager.Dispatcher.removeAvatar
Parameters:
mind
           (type=twisted.spread.pb.RemoteReference)
Overrides:
flumotion.manager.base.ManagerAvatar.detached (inherited documentation)

expireKeycard(self, keycardId)

Expire a keycard issued to this component because the bouncer decided to.
Parameters:
keycardId
           (type=str)

getEaters(self)

Get a list of feedIds for feeds this component wants to eat from.
Returns:
a list of feedId's, or the empty list
           (type=list of str)

getElementProperty(self, element, property)

Get a property of an element.
Parameters:
element - the element to get the property of
           (type=str)
property - the property to get
           (type=str)

getFeeders(self)

Get a list of feedIds that this component has feeders for.

Obviously, the componentName part will be the same for all of them, since it's the name of this component, but we return the feedId to be similar to getEaters.
Returns:
a list of feedId's, or the empty list
           (type=list of str)

getFeedServerPort(self)

Returns the port on which a feed server for this component is listening on.
Returns:
int

getName(self)

Get the name of the component.
Returns:
str

getParentName(self)

Get the name of the component's parent.
Returns:
str

getPid(self)

Return the PID of the component.
Returns:
int

getRemoteManagerIP(self)

Get the IP address of the manager as seen by the component.
Returns:
str

getType(self)

Get the component type name of the component.
Returns:
str

getWorkerName(self)

Return the name of the worker.
Returns:
str

perspective_cleanShutdown(self)

Called by a component to tell the manager that it's shutting down cleanly (and thus should go to sleeping, rather than lost or sad)

perspective_expireKeycard(self, requesterId, keycardId)

Expire a keycard (and thus the requester's connection) issued to the given requester.

This is called by the bouncer component that authenticated the keycard.
Parameters:
requesterId - name (avatarId) of the component that originally requested authentication for the given keycardId
           (type=str)
keycardId - id of keycard to expire
           (type=str)

perspective_feedReady(self, feedName, isReady)

Called by the component to tell the manager that a given feed is ready or not. Will notify other components depending on this feeder, starting them if all of their dependencies are ready.
Parameters:
feedName - name of the feeder, e.g. "default".
           (type=str)
isReady - True if the feed is now ready, False otherwise.
           (type=bool @deprecated Don't call this!)

perspective_removeKeycardId(self, bouncerName, keycardId)

Remove a keycard on the given bouncer on behalf of a component's medium.

This is requested by a component that created the keycard.
Parameters:
bouncerName
           (type=str)
keycardId - id of keycard to remove
           (type=str)

perspective_reservePortsOnWorker(self, workerName, numberOfPorts)

Request reservation a number of ports on a particular worker. This can be called from a job if it needs some ports itself.
Parameters:
workerName - name of the worker to reserve ports on
           (type=str)
numberOfPorts - the number of ports to reserve
           (type=int)

reloadComponent(self)

Tell the component to reload itself.
Returns:
twisted.internet.defer.Deferred

removeKeycardId(self, keycardId)

Remove a keycard managed by this bouncer because the requester has gone.
Parameters:
keycardId
           (type=str)

setElementProperty(self, element, property, value)

Set a property on an element.
Parameters:
element - the element to set the property on
           (type=str)
property - the property to set
           (type=str)
value - the value to set the property to
           (type=mixed)

setup(self, conf)

Set up the component with the given config. Proxies to flumotion.component.component.BaseComponentMedium.remote_setup
Parameters:
conf
           (type=dict)

stop(self)

Tell the avatar to stop the component.

Class Variable Details

avatarId

the componentId
Type:
str

componentState

component state of this avatar's component
Type:
flumotion.common.planet.ManagerComponentState

jobState

job state of this avatar's component
Type:
flumotion.common.planet.ManagerJobState

logCategory

Implementors can provide a category to log their messages under.
Type:
str
Value:
'comp-avatar'                                                          

Generated by Epydoc 2.1 on Sat Apr 14 13:16:07 2007 http://epydoc.sf.net