<commit_before>import time
import docker.errors
from django.core.management.base import BaseCommand, CommandError
from ...models import Paper
from .update_render_state import update_render_state


class Command(BaseCommand):
    help = 'Rerender all papers'

    def handle(self, *args, **options):
        print("Rendering papers", end='')
        for i, paper in enumerate(Paper.objects.all()):
            paper.render()
            print('.', end='', flush=True)

            # Update render state periodically so we don't create too many
            # containers
            if i % 100 == 100:
                print()
                print("Updating render state...")
                update_render_state()
                print("Rendering papers", end='')
        print()
        time.sleep(10)
        print("Updating render state...")
        update_render_state()<commit_msg>Fix off by one error in rerendering<commit_after>import time
import docker.errors
from django.core.management.base import BaseCommand, CommandError
from ...models import Paper
from .update_render_state import update_render_state


class Command(BaseCommand):
    help = 'Rerender all papers'

    def handle(self, *args, **options):
        print("Rendering papers", end='')
        for i, paper in enumerate(Paper.objects.all()):
            paper.render()
            print('.', end='', flush=True)

            # Update render state periodically so we don't create too many
            # containers
            if i % 100 == 99:
                print()
                print("Updating render state...")
                update_render_state()
                print("Rendering papers", end='')
        print()
        time.sleep(10)
        print("Updating render state...")
        update_render_state()
{'fraction_non_alphanumeric': 0.10744264129826525, 'fraction_numerical': 0.008393956351426972, 'mean_word_length': 2.2100538599640935, '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': '662123', 'n_tokens_mistral': 477, 'n_tokens_neox': 440, 'n_words': 141}