<commit_before>from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.views.decorators.csrf import csrf_exempt
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.conf import settings
import json
import logging
import time
from tasks import minesweeper_solve
from taskexec import exec_capped, ExecTimeOut

@csrf_exempt
def api_solve(request):
    payload = json.loads(request.raw_post_data)
    logging.debug('>>' + str(payload))

    start = time.time()
    try:
        result = exec_capped(minesweeper_solve, settings.CPU_QUOTA, payload)
    except ExecTimeOut:
        result = {'error': 'cpu quota exceeded'}
    logging.debug('task queue rtt %.3f' % (time.time() - start))

    logging.debug('<<' + str(result))
    return HttpResponse(json.dumps(result), 'text/json')

def template_static(request):
    url = request.path[1:-1]
    assert url.startswith(settings.BASE_STATIC_URL)
    template = url[len(settings.BASE_STATIC_URL):] + '.html'
    return render_to_response(template, {}, context_instance=RequestContext(request))<commit_msg>change log message level<commit_after>from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.views.decorators.csrf import csrf_exempt
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.conf import settings
import json
import logging
import time
from tasks import minesweeper_solve
from taskexec import exec_capped, ExecTimeOut

@csrf_exempt
def api_solve(request):
    payload = json.loads(request.raw_post_data)
    logging.debug('>>' + str(payload))

    start = time.time()
    try:
        result = exec_capped(minesweeper_solve, settings.CPU_QUOTA, payload)
    except ExecTimeOut:
        result = {'error': 'cpu quota exceeded'}
    logging.info('task queue rtt %.3f' % (time.time() - start))

    logging.debug('<<' + str(result))
    return HttpResponse(json.dumps(result), 'text/json')

def template_static(request):
    url = request.path[1:-1]
    assert url.startswith(settings.BASE_STATIC_URL)
    template = url[len(settings.BASE_STATIC_URL):] + '.html'
    return render_to_response(template, {}, context_instance=RequestContext(request))
{'fraction_non_alphanumeric': 0.10359964881474978, 'fraction_numerical': 0.0026338893766461808, 'mean_word_length': 5.093582887700535, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4865542', 'n_tokens_mistral': 702, 'n_tokens_neox': 685, 'n_words': 164}