<commit_before>"""Run scheduled jobs."""

import datetime
from optparse import make_option
from django.core.management.base import NoArgsCommand

from django_future import run_jobs


class Command(NoArgsCommand):
    option_list = NoArgsCommand.option_list + (
        make_option('--delete-completed', '-d', action='store_true',
                    dest='delete_completed',
                    help='Do not keep entries for completed jobs in the database.'),
        make_option('--ignore-errors', '-i', action='store_true',
                    dest='ignore_errors',
                    help='Do not abort if a job handler raises an error.'),
    )
    help = "Executes any outstanding scheduled jobs."

    def handle(self, **options):
        delete_completed = bool(options.get('delete_completed', False))
        ignore_errors = bool(options.get('ignore_errors', False))
        run_jobs(delete_completed=delete_completed,
                 ignore_errors=ignore_errors)<commit_msg>Raise a nicer CommandError instead of showing the ValueError on the command line.<commit_after>"""Run scheduled jobs."""

import datetime
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError

from django_future import run_jobs


class Command(NoArgsCommand):
    option_list = NoArgsCommand.option_list + (
        make_option('--delete-completed', '-d', action='store_true',
                    dest='delete_completed',
                    help='Do not keep entries for completed jobs in the database.'),
        make_option('--ignore-errors', '-i', action='store_true',
                    dest='ignore_errors',
                    help='Do not abort if a job handler raises an error.'),
    )
    help = "Executes any outstanding scheduled jobs."

    def handle(self, **options):
        delete_completed = bool(options.get('delete_completed', False))
        ignore_errors = bool(options.get('ignore_errors', False))
        try:
            run_jobs(delete_completed=delete_completed,
                     ignore_errors=ignore_errors)
        except ValueError, e:
            raise CommandError(e)
{'fraction_non_alphanumeric': 0.10060832943378568, 'fraction_numerical': 0.0, 'mean_word_length': 2.8661844484629295, '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': '7657306', 'n_tokens_mistral': 557, 'n_tokens_neox': 527, 'n_words': 150}