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"
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"
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)
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' ]