Ejemplo n.º 1
0
 def __init__(self, supvisors):
     """ Reset the state machine and the associated context """
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['context', 'failure_handler', 'starter',
                                 'stopper', 'logger'])
     self.update_instance(SupvisorsStates.INITIALIZATION)
     self.instance.enter()
Ejemplo n.º 2
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     self.supvisors = supvisors
     supvisors_short_cuts(
         self,
         ['context', 'failure_handler', 'logger', 'starter', 'stopper'])
     self.address = supvisors.address_mapper.local_address
Ejemplo n.º 3
0
 def __init__(self, supvisors):
     """ Reset the state machine and the associated context """
     self.supvisors = supvisors
     supvisors_short_cuts(
         self,
         ['context', 'failure_handler', 'starter', 'stopper', 'logger'])
     self.update_instance(SupvisorsStates.INITIALIZATION)
     self.instance.enter()
Ejemplo n.º 4
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     # keep a reference of the Supvisors data
     self.supvisors = supvisors
     # shortcuts for readability
     supvisors_short_cuts(self, ['logger'])
     #attributes
     self.planned_sequence = {} # {application_sequence: {application_name: {process_sequence: [process]}}}
     self.planned_jobs = {} # {application_name: {process_sequence: [process]}}
     self.current_jobs = {} # {application_name: [process]}
Ejemplo n.º 5
0
 def __init__(self, supvisors):
     AbstractStrategy.__init__(self, supvisors)
     supvisors_short_cuts(self, ['starter', 'stopper'])
     # the initial jobs
     self.stop_application_jobs = set()
     self.restart_application_jobs = set()
     self.restart_process_jobs = set()
     self.continue_process_jobs = set()
     # the deferred jobs
     self.start_application_jobs = set()
     self.start_process_jobs = set()
Ejemplo n.º 6
0
 def __init__(self, supvisors):
     AbstractStrategy.__init__(self, supvisors)
     supvisors_short_cuts(self, ['starter', 'stopper'])
     # the initial jobs
     self.stop_application_jobs = set()
     self.restart_application_jobs = set()
     self.restart_process_jobs = set()
     self.continue_process_jobs = set()
     # the deferred jobs
     self.start_application_jobs = set()
     self.start_process_jobs = set()
Ejemplo n.º 7
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     # keep a reference of the Supvisors data
     self.supvisors = supvisors
     # shortcuts for readability
     supvisors_short_cuts(self, ['logger'])
     #attributes
     self.planned_sequence = {
     }  # {application_sequence: {application_name: {process_sequence: [process]}}}
     self.planned_jobs = {
     }  # {application_name: {process_sequence: [process]}}
     self.current_jobs = {}  # {application_name: [process]}
Ejemplo n.º 8
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     # keep a reference of the Supvisors data
     self.supvisors = supvisors
     # shortcuts for readability
     supvisors_short_cuts(self, ['address_mapper', 'logger'])
     # attributes
     self.addresses = {address: AddressStatus(address, self.logger) for address in self.address_mapper.addresses}
     self.applications = {}
     self.processes = {}
     self._master_address = ''
     self.master = False
Ejemplo n.º 9
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     self.supvisors = supvisors
     # shortcuts for source code readability
     supvisors_short_cuts(self,
                          ['fsm', 'info_source', 'logger', 'statistician'])
     self.address = self.supvisors.address_mapper.local_address
     # subscribe to internal events
     events.subscribe(events.SupervisorRunningEvent, self.on_running)
     events.subscribe(events.SupervisorStoppingEvent, self.on_stopping)
     events.subscribe(events.ProcessStateEvent, self.on_process)
     events.subscribe(events.Tick5Event, self.on_tick)
     events.subscribe(events.RemoteCommunicationEvent, self.on_remote_event)
Ejemplo n.º 10
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     # keep a reference of the Supvisors data
     self.supvisors = supvisors
     # shortcuts for readability
     supvisors_short_cuts(self, ['address_mapper', 'logger'])
     # attributes
     self.addresses = {address: AddressStatus(address, self.logger)
                       for address in self.address_mapper.addresses}
     self.applications = {}
     self.processes = {}
     self._master_address = ''
     self.master = False
Ejemplo n.º 11
0
 def __init__(self, supvisors):
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['logger'])
     self.tree = self.parse(supvisors.options.rules_file)
     self.root = self.tree.getroot()
     # get models
     elements = self.root.findall("./model[@name]")
     self.models = {element.get('name'): element for element in elements}
     self.logger.debug(self.models)
     # get patterns
     elements = self.root.findall(".//pattern[@name]")
     self.patterns = {element.get('name'): element for element in elements}
     self.logger.debug(self.patterns)
Ejemplo n.º 12
0
 def test_shortcut(self):
     """ Test the shortcuts to supvisors data. """
     from supvisors.utils import supvisors_short_cuts
     # test with existing attributes
     supvisors_short_cuts(self, ['address_mapper', 'fsm', 'logger', 'requester', 'statistician'])
     self.assertIs(self.address_mapper, self.supvisors.address_mapper)
     self.assertIs(self.fsm, self.supvisors.fsm)
     self.assertIs(self.statistician, self.supvisors.statistician)
     self.assertIs(self.requester, self.supvisors.requester)
     self.assertIs(self.logger, self.supvisors.logger)
     # test with unknown attributes
     with self.assertRaises(AttributeError):
         supvisors_short_cuts(self, ['addresser', 'logging'])
Ejemplo n.º 13
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     # thread attributes
     Thread.__init__(self)
     # shortcuts
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['info_source', 'logger'])
     # keep a reference of zmq sockets
     self.subscriber = supvisors.zmq.internal_subscriber
     self.puller = supvisors.zmq.puller
     # keep a reference to the environment
     self.env = self.info_source.get_env()
     # create a xml-rpc client to the local Supervisor instance
     self.proxy = getRPCInterface('localhost', self.env)
Ejemplo n.º 14
0
 def test_shortcut(self):
     """ Test the shortcuts to supvisors data. """
     from supvisors.utils import supvisors_short_cuts
     # test with existing attributes
     supvisors_short_cuts(
         self,
         ['address_mapper', 'fsm', 'logger', 'requester', 'statistician'])
     self.assertIs(self.address_mapper, self.supvisors.address_mapper)
     self.assertIs(self.fsm, self.supvisors.fsm)
     self.assertIs(self.statistician, self.supvisors.statistician)
     self.assertIs(self.requester, self.supvisors.requester)
     self.assertIs(self.logger, self.supvisors.logger)
     # test with unknown attributes
     with self.assertRaises(AttributeError):
         supvisors_short_cuts(self, ['addresser', 'logging'])
Ejemplo n.º 15
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     self.supvisors = supvisors
     # shortcuts for source code readability
     supvisors_short_cuts(self, ['fsm', 'info_source', 'logger', 'statistician'])
     # test if statistics collector can be created for local host
     try:
         from supvisors.statscollector import instant_statistics
         self.collector = instant_statistics
     except ImportError:
         self.logger.warn('psutil not installed. this Supvisors will not publish statistics')
         self.collector = None
     # other attributes
     self.address = self.supvisors.address_mapper.local_address
     self.publisher = None
     self.main_loop = None
     # subscribe to internal events
     events.subscribe(events.SupervisorRunningEvent, self.on_running)
     events.subscribe(events.SupervisorStoppingEvent, self.on_stopping)
     events.subscribe(events.ProcessStateEvent, self.on_process)
     events.subscribe(events.Tick5Event, self.on_tick)
     events.subscribe(events.RemoteCommunicationEvent, self.on_remote_event)
Ejemplo n.º 16
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     self.supvisors = supvisors
     # shortcuts for source code readability
     supvisors_short_cuts(self, ['fsm', 'info_source',
                                 'logger', 'statistician'])
     # test if statistics collector can be created for local host
     try:
         from supvisors.statscollector import instant_statistics
         self.collector = instant_statistics
     except ImportError:
         self.logger.warn('psutil not installed')
         self.logger.warn('this Supvisors will not publish statistics')
         self.collector = None
     # other attributes
     self.address = self.supvisors.address_mapper.local_address
     self.publisher = None
     self.main_loop = None
     # subscribe to internal events
     events.subscribe(events.SupervisorRunningEvent, self.on_running)
     events.subscribe(events.SupervisorStoppingEvent, self.on_stopping)
     events.subscribe(events.ProcessStateEvent, self.on_process)
     events.subscribe(events.Tick5Event, self.on_tick)
     events.subscribe(events.RemoteCommunicationEvent, self.on_remote_event)
Ejemplo n.º 17
0
 def __init__(self, context):
     """ Initialization of the attributes. """
     MeldView.__init__(self, context)
     self.supvisors = self.context.supervisord.supvisors
     supvisors_short_cuts(self, ['logger'])
Ejemplo n.º 18
0
 def __init__(self, context):
     """ Initialization of the attributes. """
     StatusView.__init__(self, context)
     self.supvisors = self.context.supervisord.supvisors
     supvisors_short_cuts(self, ['info_source', 'logger'])
     self.address = self.supvisors.address_mapper.local_address
Ejemplo n.º 19
0
 def __init__(self, supvisors):
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['context', 'logger'])
Ejemplo n.º 20
0
 def __init__(self, supervisord):
     # create a new Supvisors instance
     self.supvisors = Supvisors(supervisord)
     supvisors_short_cuts(self, ['context', 'fsm', 'info_source',
         'logger', 'starter', 'stopper'])
Ejemplo n.º 21
0
 def __init__(self, context):
     """ Initialization of the attributes. """
     MeldView.__init__(self, context)
     self.supvisors = self.context.supervisord.supvisors
     supvisors_short_cuts(self, ['logger'])
Ejemplo n.º 22
0
 def __init__(self, supvisors):
     """ Initialization of the attributes. """
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['context', 'failure_handler',
                                 'logger', 'starter', 'stopper'])
     self.address = supvisors.address_mapper.local_address
Ejemplo n.º 23
0
 def __init__(self, supervisord):
     # create a new Supvisors instance
     self.supvisors = Supvisors(supervisord)
     supvisors_short_cuts(self, ['context', 'fsm', 'info_source', 'logger', 'starter', 'stopper'])
Ejemplo n.º 24
0
 def __init__(self, supvisors):
     self.supvisors = supvisors
     supvisors_short_cuts(self, ['context', 'logger'])