class documentation

class WatcherState(object):

View In Hierarchy

Interface to a state file recording restart attempts.

Method __init__ Open, lock, read and parse the file.
Method Close Unlock configuration file and close it.
Method GetNodeBootID Returns the last boot ID of a node or None.
Method MaintainInstanceList Perform maintenance on the recorded instances.
Method NumberOfCleanupAttempts Returns number of previous cleanup attempts.
Method NumberOfRestartAttempts Returns number of previous restart attempts.
Method RecordCleanupAttempt Record a cleanup attempt.
Method RecordRestartAttempt Record a restart attempt.
Method RemoveInstance Update state to reflect that a machine is running.
Method Save Save state to file.
Method SetNodeBootID Sets the boot ID of a node.
Instance Variable statefile Undocumented
Static Method _RecordAttempt Record an event.
Instance Variable _data Undocumented
Instance Variable _orig_data Undocumented
def __init__(self, statefile):

Open, lock, read and parse the file.

Parameters
statefile:fileState file object
def Close(self):

Unlock configuration file and close it.

def GetNodeBootID(self, name):

Returns the last boot ID of a node or None.

def MaintainInstanceList(self, instances):

Perform maintenance on the recorded instances.

Parameters
instances:list of stringthe list of currently existing instances
def NumberOfCleanupAttempts(self, instance_name):

Returns number of previous cleanup attempts.

Parameters
instance_name:stringthe name of the instance to look up
def NumberOfRestartAttempts(self, instance_name):

Returns number of previous restart attempts.

Parameters
instance_name:stringthe name of the instance to look up
def RecordCleanupAttempt(self, instance_name):

Record a cleanup attempt.

Parameters
instance_name:stringthe name of the instance being cleaned up
def RecordRestartAttempt(self, instance_name):

Record a restart attempt.

Parameters
instance_name:stringthe name of the instance being restarted
def RemoveInstance(self, instance_name):

Update state to reflect that a machine is running.

This method removes the record for a named instance (as we only track down instances).

Parameters
instance_name:stringthe name of the instance to remove from books
def Save(self, filename):

Save state to file.

def SetNodeBootID(self, name, bootid):

Sets the boot ID of a node.

statefile =

Undocumented

@staticmethod
def _RecordAttempt(instances, instance_name, key_when, key_count):

Record an event.

Parameters
instances:dictcontains instance data indexed by instance_name
instance_name:stringname of the instance involved in the event
key_when:dict key for the information for when the event occurred
key_count:intdict key for the information for how many times the event occurred
_data: dict =

Undocumented

_orig_data =

Undocumented