Ejemplo n.º 1
0
pymon Workflow

For any given workflow instance, in pymon, we will want it to be a
Singleton. The state of the system will be stored in base.State
which in turn is used in base.Workflow. The last thing we want is
multiple instances of workflow with different state information.
'''
from base import Workflow, WorkflowAware


# Instantiate and setup workflow states
appWf = Workflow()
appWf.addState(
    'Normal', 
    description='pymon is in normal operation with no alerts')
appWf.setInitState('Normal')

# Setup workflow transitions


# define a workflow-aware for mangaging state
class AppState(WorkflowAware):
    '''
    '''
    def __init__(self, workflow=None):
        self.enterWorkflow(workflow, None, "Just Created")


# this is what should get imported by the pymon application:
appState = AppState(workflow=appWf)
Ejemplo n.º 2
0
'''
pymon Workflow

For any given workflow instance, in pymon, we will want it to be a
Singleton. The state of the system will be stored in base.State
which in turn is used in base.Workflow. The last thing we want is
multiple instances of workflow with different state information.
'''
from base import Workflow, WorkflowAware

# Instantiate and setup workflow states
appWf = Workflow()
appWf.addState('Normal',
               description='pymon is in normal operation with no alerts')
appWf.setInitState('Normal')

# Setup workflow transitions


# define a workflow-aware for mangaging state
class AppState(WorkflowAware):
    '''
    '''
    def __init__(self, workflow=None):
        self.enterWorkflow(workflow, None, "Just Created")


# this is what should get imported by the pymon application:
appState = AppState(workflow=appWf)
Ejemplo n.º 3
0
    states.error,
    description='pymon has gone to state ERROR')

stateWorkflow.addTrans(
    transitionNames[states.failed],
    [states.ok, states.warn, states.error, states.unknown, states.failed],
    states.failed,
    description='pymon has gone to state FAILED')

stateWorkflow.addTrans(
    transitionNames[states.escalated],
    [states.warn, states.error, states.escalated],
    states.escalated,
    description='pymon has received too many counts of a certain kind')

stateWorkflow.setInitState(states.unknown)


# define a workflow-aware for mangaging state
class ServiceState(WorkflowAware):
    '''
    '''
    def __init__(self, workflow=stateWorkflow):
        WorkflowAware.__init__(self)
        self.enterWorkflow(workflow)
        self.legal = cfg.getStateNames()

    def __getattr__(self, attr):
        error = None
        try:
            self.__getattribute__(attr)
Ejemplo n.º 4
0
    description='pymon has gone to state ERROR')


stateWorkflow.addTrans(transitionNames[states.failed],
    [states.ok, states.warn, states.error, states.unknown, states.failed],
    states.failed,
    description='pymon has gone to state FAILED')


stateWorkflow.addTrans(transitionNames[states.escalated],
    [states.warn, states.error, states.escalated],
    states.escalated,
    description='pymon has received too many counts of a certain kind')


stateWorkflow.setInitState(states.unknown)

# define a workflow-aware for mangaging state
class ServiceState(WorkflowAware):
    '''
    '''
    def __init__(self, workflow=stateWorkflow):
        WorkflowAware.__init__(self)
        self.enterWorkflow(workflow)
        self.legal = cfg.getStateNames()

    def __getattr__(self, attr):
        error = None
        try:
            self.__getattribute__(attr)
        except AttributeError, e: