예제 #1
0
def graph_test(request, test_slug, num_total=5000, div_by=50):
    ret_val = {}
    flot_val = {}
    num_split = int(num_total)/int(div_by)
    test = Test.objects.get(slug=test_slug)
    sites = set(list(test.sites.all()))
    types = test.types.all()
    for type in types:
        for site in type.sites.all():
            sites.add(site)
    for site in sites:
        flot_val[site.slug] = []
        results = get_latest_results(site)
        if ret_val.has_key(site.slug):
            ret_val[site.slug].extend(results)
        else:
            ret_val[site.slug] = results
        tests = TestResult.objects.filter(test=test, site=site)[:num_total]
        duration_tests = list(tests)
        duration_tests.reverse()
        for result_list in split_seq(duration_tests, num_split):
            time = sum([result.duration/1000 for result in result_list])/len(result_list)
            flot_val[site.slug].append([get_timestamp(result_list[0].run_date), time])
    return render_to_response('kong/graph_test.html',
                              {'sites': list(sites),
                               'flot_list': flot_val,
                                'test': test,
                              },
                              context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: jjp/django-kong
def index(request):
    ret_val = {}
    for site in Site.objects.all():
        results = get_latest_results(site)
        if ret_val.has_key(site.slug):
            ret_val[site.slug].extend(results)
        else:
            ret_val[site.slug] = results

    return render_to_response('kong/index.html',
                       {'results': ret_val},
                       context_instance=RequestContext(request))
예제 #3
0
def site_object(request, site):
    ret_val = {}
    sites = Site.objects.filter(slug=site)
    for site in sites:
        results = get_latest_results(site)
        if ret_val.has_key(site.slug):
            ret_val[site.slug].extend(results)
        else:
            ret_val[site.slug] = results

    return render_to_response('kong/index.html',
                       {'results': ret_val},
                       context_instance=RequestContext(request))
예제 #4
0
def dashboard(request):
    ret_val = {}
    flot_val = {}
    for site in Site.objects.all():
        results = get_latest_results(site)
        succ = True
        for result in results:
            if not result.succeeded:
                succ = False
                fail = result
        ret_val[site.slug] = succ
    return render_to_response('kong/dashboard.html',
                       {'results': ret_val},
                       context_instance=RequestContext(request))
예제 #5
0
def index(request):
    ret_val = {}
    flot_val = {}
    for site in Site.objects.all():
        results = get_latest_results(site)
        if ret_val.has_key(site.slug):
            ret_val[site.slug].extend(results)
        else:
            ret_val[site.slug] = results
        for result in results:
            results = list(TestResult.objects.filter(test=result.test, site=result.site)[:50])
            results.reverse()
            flot_val["%s-%s" % (result.site.slug, result.test.slug)] = [[get_timestamp(result.run_date), result.duration/1000] for result in results]
    return render_to_response('kong/index.html',
                       {'results': ret_val,
                        'flot_list': flot_val},
                       context_instance=RequestContext(request))