<commit_before>from django.core.management.base import BaseCommand
from ... import index


class Command(BaseCommand):

    help = "Run an indexing worker"

    def handle(self, verbosity, **options):
        index.work_loop()<commit_msg>start several worker threads<commit_after>import threading
from django.core.management.base import BaseCommand
from ... import index


class Command(BaseCommand):

    help = "Run an indexing worker"

    def add_arguments(self, parser):
        parser.add_argument('--threads', default=1, type=int)

    def handle(self, verbosity, threads, **options):
        thread_list = [
            threading.Thread(target=index.work_loop)
            for _ in range(threads)
        ]

        for thread in thread_list:
            thread.start()

        for thread in thread_list:
            thread.join()
{'fraction_non_alphanumeric': 0.09654350417163289, 'fraction_numerical': 0.0011918951132300357, 'mean_word_length': 2.853211009174312, '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': '6526122', 'n_tokens_mistral': 233, 'n_tokens_neox': 221, 'n_words': 63}