Exemple #1
0
def create_error_report(env, exc_info, **kwargs):
    """Builds a :class:`oioioi.contests.models.SubmissionReport` for
       an evaulation which have failed.

       USES
           * `env['submission_id']`
    """

    logger.error("System Error evaluating submission #%s:\n%s",
            env.get('submission_id', '???'),
            pprint.pformat(env, indent=4), exc_info=exc_info)

    if 'submission_id' not in env:
        return env

    try:
        submission = Submission.objects.get(id=env['submission_id'])
    except Submission.DoesNotExist:
        return env

    submission_report = SubmissionReport(submission=submission)
    submission_report.kind = 'FAILURE'
    submission_report.save()

    failure_report = FailureReport(submission_report=submission_report)
    failure_report.json_environ = json.dumps(env)
    failure_report.message = traceback.format_exc(exc_info)
    failure_report.save()

    return env
Exemple #2
0
def create_error_report(env, submission, exc_info, **kwargs):
    """Builds a :class:`oioioi.contests.models.SubmissionReport` for
    an evaulation which have failed.

    USES
        * `env['submission_id']`
    """

    logger.error(
        "System Error evaluating submission #%s:\n%s",
        env.get('submission_id', '???'),
        pprint.pformat(env, indent=4),
        exc_info=exc_info,
    )

    submission_report = SubmissionReport(submission=submission)
    submission_report.kind = 'FAILURE'
    submission_report.save()

    failure_report = FailureReport(submission_report=submission_report)
    failure_report.json_environ = json.dumps(env)
    failure_report.message = u''.join(traceback.format_exception(*exc_info))
    failure_report.save()

    return env
Exemple #3
0
def create_error_report(env, exc_info, **kwargs):
    """Builds a :class:`oioioi.contests.models.SubmissionReport` for
       an evaulation which have failed.

       USES
           * `env['submission_id']`
    """

    logger.error("System Error evaluating submission #%s:\n%s",
                 env.get('submission_id', '???'),
                 pprint.pformat(env, indent=4),
                 exc_info=exc_info)

    if 'submission_id' not in env:
        return env

    try:
        submission = Submission.objects.get(id=env['submission_id'])
    except Submission.DoesNotExist:
        return env

    submission_report = SubmissionReport(submission=submission)
    submission_report.kind = 'FAILURE'
    submission_report.save()

    failure_report = FailureReport(submission_report=submission_report)
    failure_report.json_environ = json.dumps(env)
    failure_report.message = traceback.format_exc(exc_info)
    failure_report.save()

    return env