def handle(self, *labels, **options):
        """
        More targeted pillow checkpoint reset system - must specify the pillow class_name to reset the checkpoint
        """

        if not labels:
            pillow_names = [config.name for config in get_all_pillow_configs()]
            print "\nNo pillow specified, options are:\n\t%s\n" % ('\n\t'.join(pillow_names))
            sys.exit()

        pillow_name = labels[0]
        pillow_to_use = get_pillow_by_name(pillow_name)
        if not pillow_to_use:
            print ""
            print "\n\tPillow class [%s] not in configuration, what are you trying to do?\n" % pillow_name
            sys.exit()

        if not options.get('interactive'):
            confirm = raw_input("""
            You have requested to reset the checkpoints for the pillow [%s]. This is an irreversible
            operation, and may take a long time, and cause extraneous updates to the requisite
            consumers of the _changes feeds  Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """ % pillow_name)
        else:
            confirm = 'yes'

        if confirm != 'yes':
            print "Reset cancelled."
            return

        print "Resetting checkpoint for %s" % pillow_to_use.checkpoint.checkpoint_id
        print "\tOld checkpoint: %s" % pillow_to_use.get_checkpoint().sequence
        pillow_to_use.checkpoint.reset()
        print "\n\tNew checkpoint reset to zero"
예제 #2
0
def _get_topic_to_pillow_map():
    all_pillow_names = {config.name for config in get_all_pillow_configs()}
    return {
        topic: get_pillow_by_name(pillow_name)
        for topic, pillow_name in TOPIC_TO_PILLOW_NAME_MAP.items()
        if pillow_name in all_pillow_names
    }
    def handle(self, *labels, **options):
        """
        More targeted pillow checkpoint reset system - must specify the pillow class_name to reset the checkpoint
        """

        if not labels:
            pillow_names = [config.name for config in get_all_pillow_configs()]
            print "\nNo pillow specified, options are:\n\t%s\n" % (
                '\n\t'.join(pillow_names))
            sys.exit()

        pillow_name = labels[0]
        pillow_to_use = get_pillow_by_name(pillow_name)
        if not pillow_to_use:
            print ""
            print "\n\tPillow class [%s] not in configuration, what are you trying to do?\n" % pillow_name
            sys.exit()

        if not options.get('interactive'):
            confirm = raw_input("""
            You have requested to reset the checkpoints for the pillow [%s]. This is an irreversible
            operation, and may take a long time, and cause extraneous updates to the requisite
            consumers of the _changes feeds  Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """ % pillow_name)
        else:
            confirm = 'yes'

        if confirm != 'yes':
            print "Reset cancelled."
            return

        print "Resetting checkpoint for %s" % pillow_to_use.checkpoint.checkpoint_id
        print "\tOld checkpoint: %s" % pillow_to_use.get_checkpoint().sequence
        pillow_to_use.checkpoint.reset()
        print "\n\tNew checkpoint reset to zero"
예제 #4
0
 def test_all_pillows_handle_errors(self):
     all_pillow_configs = list(get_all_pillow_configs())
     for pillow_config in all_pillow_configs:
         self._test_error_logging_for_pillow(pillow_config)
예제 #5
0
 def test_all_pillows_handle_errors(self):
     all_pillow_configs = list(get_all_pillow_configs())
     for pillow_config in all_pillow_configs:
         self._test_error_logging_for_pillow(pillow_config)
예제 #6
0
def get_fluff_pillow_configs():
    from pillowtop import get_all_pillow_configs
    return [
        config for config in get_all_pillow_configs()
        if config.section == 'fluff'
    ]
예제 #7
0
def get_fluff_pillow_configs():
    from pillowtop import get_all_pillow_configs
    return [
        config for config in get_all_pillow_configs()
        if config.section == 'fluff'
    ]