Package flumotion :: Package manager :: Module depgraph :: Class DepGraph
[show private | hide private]
[frames | no frames]

Class DepGraph

Loggable --+
           |
          DepGraph


I am a dependency graph for components. I also maintain boolean state for each of the nodes.

I contain a DAG to help with resolving dependencies.
Method Summary
  __init__(self)
  addClockMaster(self, component)
I set a component to be the clock master in the dependency graph.
  addComponent(self, component)
I add a component to the dependency graph.
  addWorker(self, worker)
I add a worker to the dependency graph.
  isAClockMaster(self, component)
Checks if component has a CLOCKMASTER node
  mapEatersToFeeders(self)
I am called once a piece of configuration has been added, so I can add edges to the DAG for each feed from the feeding component to the eating component.
  removeComponent(self, component)
I remove a component in the dependency graph, this includes removing the JOB, COMPONENTSETUP, COMPONENTSTART, CLOCKMASTER.
  removeWorker(self, worker)
I remove a worker from the dependency graph.
  setClockMasterStarted(self, component)
Set a CLOCKMASTER node to have state of True
  setClockMasterStopped(self, component)
Set a CLOCKMASTER node to have state of False
  setComponentNotSetup(self, component)
Set a COMPONENTSETUP node to have state of False
  setComponentNotStarted(self, component)
Set a COMPONENTSTART node to have state of False
  setComponentSetup(self, component)
Set a COMPONENTSETUP node to have state of True
  setComponentStarted(self, component)
Set a COMPONENTSTART node to have state of True
  setComponentWorker(self, component, worker)
I assign a component to a specific worker.
  setJobStarted(self, component)
Set a JOB node to have state of True
  setJobStopped(self, component)
Set a JOB node to have state of False
  setWorkerStarted(self, worker)
Set a WORKER node to have state of True
  setWorkerStopped(self, worker)
Set a WORKER node to have state of False
list of (object, str) whatShouldBeStarted(self)
I return a list of things that can and should be started now.
  _addEdge(self, parent, child, parentType, childType)
  _addNode(self, component, type)
  _removeEdge(self, parent, child, parentType, childType)
  _removeNode(self, component, type)
  _setState(self, object, type, value)
    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.

Class Variable Summary
str logCategory: Implementors can provide a category to log their messages under.
tuple typeNames = ('WORKER', 'JOB', 'COMPONENTSETUP', 'CLOCKMA...
    Inherited from Loggable
Implements __implemented__ = <implementedBy flumotion.common.log.Lo...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Method Details

addClockMaster(self, component)

I set a component to be the clock master in the dependency graph. This component must have already been added to the dependency graph.
Parameters:
component - the component to set as the clock master
           (type=flumotion.manager.component.ComponentAvatar)

addComponent(self, component)

I add a component to the dependency graph. This includes adding the worker (if not already added), the job, the feeders and the eaters.

Requirement: worker must already be assigned to component
Parameters:
component - component object to add
           (type=flumotion.common.planet.ManagerComponentState)

addWorker(self, worker)

I add a worker to the dependency graph.
Parameters:
worker - the worker to add
           (type=str)

isAClockMaster(self, component)

Checks if component has a CLOCKMASTER node
Parameters:
component - the component to check if CLOCKMASTER node exists
           (type={flumotion.common.planet.ManagerComponentState})

mapEatersToFeeders(self)

I am called once a piece of configuration has been added, so I can add edges to the DAG for each feed from the feeding component to the eating component.
Raises:
errors.ComponentConfigError - if a component is misconfigured and eats from a non-existant component

removeComponent(self, component)

I remove a component in the dependency graph, this includes removing the JOB, COMPONENTSETUP, COMPONENTSTART, CLOCKMASTER.
Parameters:
component - the component to remove
           (type=flumotion.manager.component.ComponentAvatar)

removeWorker(self, worker)

I remove a worker from the dependency graph.
Parameters:
worker - the worker to remove
           (type=str)

setClockMasterStarted(self, component)

Set a CLOCKMASTER node to have state of True
Parameters:
component - the component to set CLOCKMASTER to True for
           (type={flumotion.common.planet.ManagerComponentState})

setClockMasterStopped(self, component)

Set a CLOCKMASTER node to have state of False
Parameters:
component - the component to set CLOCKMASTER to True for
           (type={flumotion.common.planet.ManagerComponentState})

setComponentNotSetup(self, component)

Set a COMPONENTSETUP node to have state of False
Parameters:
component - the component to set COMPONENTSETUP to True for
           (type=flumotion.common.planet.ManagerComponentState)

setComponentNotStarted(self, component)

Set a COMPONENTSTART node to have state of False
Parameters:
component - the component to set COMPONENTSTART to False for
           (type=flumotion.common.planet.ManagerComponentState)

setComponentSetup(self, component)

Set a COMPONENTSETUP node to have state of True
Parameters:
component - the component to set COMPONENTSETUP to True for
           (type=flumotion.common.planet.ManagerComponentState)

setComponentStarted(self, component)

Set a COMPONENTSTART node to have state of True
Parameters:
component - the component to set COMPONENTSTART to True for
           (type=flumotion.common.planet.ManagerComponentState)

setComponentWorker(self, component, worker)

I assign a component to a specific worker.
Parameters:
component - the component
           (type=flumotion.common.planet.ManagerComponentState)
worker - the worker to set it to
           (type=str)

setJobStarted(self, component)

Set a JOB node to have state of True
Parameters:
component - the component to set JOB to True for
           (type=flumotion.common.planet.ManagerComponentState)

setJobStopped(self, component)

Set a JOB node to have state of False
Parameters:
component - the component to set JOB to False for
           (type=flumotion.common.planet.ManagerComponentState)

setWorkerStarted(self, worker)

Set a WORKER node to have state of True
Parameters:
worker - the component to set WORKER to True for
           (type=str)

setWorkerStopped(self, worker)

Set a WORKER node to have state of False
Parameters:
worker - the component to set WORKER to False for
           (type=str)

whatShouldBeStarted(self)

I return a list of things that can and should be started now.
Returns:
a list of nodes that should be started, in order
           (type=list of (object, str))

Class Variable Details

logCategory

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

typeNames

Type:
tuple
Value:
('WORKER', 'JOB', 'COMPONENTSETUP', 'CLOCKMASTER', 'COMPONENTSTART')   

Generated by Epydoc 2.1 on Fri Apr 6 10:10:23 2007 http://epydoc.sf.net