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()
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
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()
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]}
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()
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()
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]}
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
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)
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
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)
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'])
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)
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'])
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)
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)
def __init__(self, context): """ Initialization of the attributes. """ MeldView.__init__(self, context) self.supvisors = self.context.supervisord.supvisors supvisors_short_cuts(self, ['logger'])
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
def __init__(self, supvisors): self.supvisors = supvisors supvisors_short_cuts(self, ['context', 'logger'])
def __init__(self, supervisord): # create a new Supvisors instance self.supvisors = Supvisors(supervisord) supvisors_short_cuts(self, ['context', 'fsm', 'info_source', 'logger', 'starter', 'stopper'])
def __init__(self, context): """ Initialization of the attributes. """ MeldView.__init__(self, context) self.supvisors = self.context.supervisord.supvisors supvisors_short_cuts(self, ['logger'])
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
def __init__(self, supervisord): # create a new Supvisors instance self.supvisors = Supvisors(supervisord) supvisors_short_cuts(self, ['context', 'fsm', 'info_source', 'logger', 'starter', 'stopper'])
def __init__(self, supvisors): self.supvisors = supvisors supvisors_short_cuts(self, ['context', 'logger'])