<commit_before># -*- coding: utf-8 -*-

from blackgate.executor import QueueExecutor
from tornado.ioloop import IOLoop


class ExecutorPools(object):

    def __init__(self):
        self.pools = {}

    def register_pool(self, group_key, max_size=10, max_workers=10):
        executor = QueueExecutor(pool_key=group_key, max_size=max_size, max_workers=max_workers)
        IOLoop.current().spawn_callback(executor.consume)
        self.pools[group_key] = executor

    def get_executor(self, group_key):
        if group_key not in self.pools:
            raise Exception("Pool not registerd")
        return self.pools[group_key]<commit_msg>register ioloop.<commit_after># -*- coding: utf-8 -*-

from blackgate.executor import QueueExecutor
from tornado.ioloop import IOLoop


class ExecutorPools(object):

    def __init__(self):
        self.pools = {}

    def register_pool(self, group_key, max_size=10, max_workers=10, ioloop=None):
        executor = QueueExecutor(pool_key=group_key, max_size=max_size, max_workers=max_workers)
        ioloop = ioloop or IOLoop.current()
        ioloop.spawn_callback(executor.consume)
        self.pools[group_key] = executor

    def get_executor(self, group_key):
        if group_key not in self.pools:
            raise Exception("Pool not registerd")
        return self.pools[group_key]
{'fraction_non_alphanumeric': 0.09880239520958084, 'fraction_numerical': 0.0074850299401197605, 'mean_word_length': 3.5322033898305083, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419686', 'n_tokens_mistral': 447, 'n_tokens_neox': 428, 'n_words': 89}