def test_StartingFailureStrategies(self): """ Test the StartingFailureStrategies enumeration. """ from supvisors.ttypes import StartingFailureStrategies self.assertEqual( 'ABORT', StartingFailureStrategies._to_string( StartingFailureStrategies.ABORT)) self.assertEqual( 'CONTINUE', StartingFailureStrategies._to_string( StartingFailureStrategies.CONTINUE))
def load_application_rules(self, application): # find application element self.logger.trace('searching application element for {}'.format(application.application_name)) application_elt = self.root.find("./application[@name='{}']".format(application.application_name)) if application_elt is not None: # get start_sequence rule value = application_elt.findtext('start_sequence') application.rules.start_sequence = int(value) if value and int(value)>0 else 0 # get stop_sequence rule value = application_elt.findtext('stop_sequence') application.rules.stop_sequence = int(value) if value and int(value)>0 else 0 # get starting_failure_strategy rule value = application_elt.findtext('starting_failure_strategy') if value: strategy = StartingFailureStrategies._from_string(value) if strategy: application.rules.starting_failure_strategy = strategy # get running_failure_strategy rule value = application_elt.findtext('running_failure_strategy') if value: strategy = RunningFailureStrategies._from_string(value) if strategy: application.rules.running_failure_strategy = strategy # final print self.logger.debug('application {} - rules {}'.format(application.application_name, application.rules))
def __str__(self): """ Contents as string. """ return 'start_sequence={} stop_sequence={} starting_failure_strategy={}'\ ' running_failure_strategy={}'.format( self.start_sequence, self.stop_sequence, StartingFailureStrategies._to_string(self.starting_failure_strategy), RunningFailureStrategies._to_string(self.running_failure_strategy))
def serial(self): """ Return a serializable form of the ApplicationRules. """ return {'start_sequence': self.start_sequence, 'stop_sequence': self.stop_sequence, 'starting_failure_strategy': StartingFailureStrategies._to_string(self.starting_failure_strategy), 'running_failure_strategy': RunningFailureStrategies._to_string(self.running_failure_strategy)}
def serial(self): """ Return a serializable form of the ApplicationRules. """ return { 'start_sequence': self.start_sequence, 'stop_sequence': self.stop_sequence, 'starting_failure_strategy': StartingFailureStrategies._to_string( self.starting_failure_strategy), 'running_failure_strategy': RunningFailureStrategies._to_string(self.running_failure_strategy) }
def test_StartingFailureStrategies(self): """ Test the StartingFailureStrategies enumeration. """ from supvisors.ttypes import StartingFailureStrategies self.assertEqual('ABORT', StartingFailureStrategies._to_string(StartingFailureStrategies.ABORT)) self.assertEqual('CONTINUE', StartingFailureStrategies._to_string(StartingFailureStrategies.CONTINUE))