<commit_before>from redis import sentinel


class Sentinel(object):

    def __init__(self, app=None):
        self.app = app
        if app is not None: # pragma: no cover
            self.init_app(app)

    def init_app(self, app):
        self.connection = sentinel.Sentinel(app.config['REDIS_SENTINEL'],
                                                  socket_timeout=0.1)
        self.master = self.connection.master_for('mymaster')
        self.slave = self.connection.slave_for('mymaster')<commit_msg>Use config redis database in sentinel connections<commit_after>from redis import sentinel


class Sentinel(object):

    def __init__(self, app=None):
        self.app = app
        if app is not None: # pragma: no cover
            self.init_app(app)

    def init_app(self, app):
        self.connection = sentinel.Sentinel(app.config['REDIS_SENTINEL'],
                                                  socket_timeout=0.1)
        redis_db = app.config['REDIS_DB'] or 0
        print "Redis db is ", redis_db
        self.master = self.connection.master_for('mymaster', db=redis_db)
        self.slave = self.connection.slave_for('mymaster', db=redis_db)
{'fraction_non_alphanumeric': 0.10034305317324185, 'fraction_numerical': 0.004288164665523156, 'mean_word_length': 2.26890756302521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4012133', 'n_tokens_mistral': 360, 'n_tokens_neox': 343, 'n_words': 76}