Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions codespeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@
from django.urls import reverse
from django.conf import settings
from django.db import models
try:
from django.utils.encoding import python_2_unicode_compatible
except ImportError:
def python_2_unicode_compatible(arg):
return arg

from .commits.github import GITHUB_URL_RE

logger = logging.getLogger(__name__)


@python_2_unicode_compatible
class Project(models.Model):
NO_LOGS = 'N'
GIT = 'G'
Expand Down Expand Up @@ -106,7 +100,6 @@ def is_less_important_than(self, val, color):
return False


@python_2_unicode_compatible
class Branch(models.Model):
name = models.CharField(max_length=32)
project = models.ForeignKey(
Expand All @@ -123,7 +116,6 @@ class Meta:
verbose_name_plural = "branches"


@python_2_unicode_compatible
class Revision(models.Model):
# git and mercurial's SHA-1 length is 40
commitid = models.CharField(max_length=42)
Expand Down Expand Up @@ -166,7 +158,6 @@ def clean(self):
raise ValidationError("Invalid SVN commit id %s" % self.commitid)


@python_2_unicode_compatible
class Executable(models.Model):
name = models.CharField(max_length=30)
description = models.CharField(max_length=200, blank=True)
Expand All @@ -180,7 +171,6 @@ def __str__(self):
return self.name


@python_2_unicode_compatible
class Benchmark(models.Model):
B_TYPES = (
('C', 'Cross-project'),
Expand Down Expand Up @@ -215,7 +205,6 @@ def clean(self):
"'default_on_comparison' first.")


@python_2_unicode_compatible
class Environment(models.Model):
name = models.CharField(unique=True, max_length=100)
cpu = models.CharField(max_length=100, blank=True)
Expand All @@ -227,7 +216,6 @@ def __str__(self):
return self.name


@python_2_unicode_compatible
class Result(models.Model):
value = models.FloatField()
std_dev = models.FloatField(blank=True, null=True)
Expand All @@ -252,7 +240,6 @@ class Meta:
unique_together = ("revision", "executable", "benchmark", "environment")


@python_2_unicode_compatible
class Report(models.Model):
revision = models.ForeignKey(
Revision, on_delete=models.CASCADE, related_name="reports")
Expand Down
8 changes: 4 additions & 4 deletions codespeed/templates/codespeed/changes_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<td>{% if rev.get_browsing_url %}<a href="{{ rev.get_browsing_url }}">{{ rev.commitid }}</a>{% else %}{{ rev.commitid }}{% endif %}</td>
</tr>
<tr class="date"><th class="infofirst">Date</td><td>{{ rev.date }}</td></tr>
{% ifnotequal rev.branch.project.repo_type "N" %}
{% if rev.branch.project.repo_type != "N" %}
<tr class="repo-path"><th class="infofirst">Repo</th><td>{{ rev.branch.project.repo_path }}</td></tr>
{% endifnotequal %}
{% endif %}
</tbody>
</table>

{% ifnotequal exe.project.repo_type 'N' %}
{% if exe.project.repo_type != 'N' %}
<table class="revision">
<col/>
<col/>
Expand All @@ -40,5 +40,5 @@
el.load("logs/", "revisionid=" + el.data("commitid"));
</script>
</table>
{% endifnotequal %}
{% endif %}
</div>
4 changes: 2 additions & 2 deletions codespeed/templates/codespeed/changes_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% endif%}{% if units.has_stddev %}<td>{{ units.totals.min }}</td>
{% endif%}{% if units.hasmax %}<td>{{ units.totals.max }}</td>
{% endif%}<td>{{ units.totals.change|percentage }}</td>
<td>{% ifnotequal units.totals.trend "-" %}{{ units.totals.trend|floatformat:2 }}%{% else %}{{ units.totals.trend }}{% endifnotequal %}</td>
<td>{% if units.totals.trend != "-" %}{{ units.totals.trend|floatformat:2 }}%{% else %}{{ units.totals.trend }}{% endif %}</td>
</tr>
</tfoot>
<tbody>
Expand All @@ -38,7 +38,7 @@
{% endif%}{% if units.hasmin %}<td>{{ row.val_min|floatformat:units.precission }}</td>
{% endif%}{% if units.hasmax %}<td>{{ row.val_max|floatformat:units.precission }}</td>
{% endif%}<td>{{ row.change|percentage }}</td>
<td>{% ifequal row.trend "-" %}-{% else %}{{ row.trend|floatformat:2 }}%{% endifequal %}</td>
<td>{% if row.trend == "-" %}-{% else %}{{ row.trend|floatformat:2 }}%{% endif %}</td>
</tr>{% endfor %}
</tbody>
</table>{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions codespeed/templates/codespeed/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
<div id="benchmark" class="sidebox">
<div class="boxhead"><h2>Benchmark</h2></div>
<div class="boxbody">{% ifnotequal benchmarks|length 1 %}
<div class="boxbody">{% if benchmarks|length != 1 %}
<ul>
<li>
<input id="benchmarkgrid" type="radio" name="benchmark" value="grid" />
Expand All @@ -64,7 +64,7 @@
<input id="b_show_none" type="radio" name="benchmark" value="show_none" />
<label for="b_show_none">Display none</label>
</li>
</ul>{% endifnotequal %}
</ul>{% endif %}
<ul>{% for bench in benchmarks|dictsort:"name" %}
<li title="{{ bench.description }}">
<input id="benchmark_{{ bench.id }}" type="radio" name="benchmark" value="{{ bench.name }}" />
Expand Down
34 changes: 17 additions & 17 deletions codespeed/urls.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.urls import re_path
from django.views.generic import TemplateView

from codespeed import views
from codespeed.feeds import LatestEntries, LatestSignificantEntries

urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^about/$',
re_path(r'^$', views.HomeView.as_view(), name='home'),
re_path(r'^about/$',
TemplateView.as_view(template_name='about.html'), name='about'),
# RSS for reports
url(r'^feeds/latest/$', LatestEntries(), name='latest-results'),
url(r'^feeds/latest_significant/$', LatestSignificantEntries(),
re_path(r'^feeds/latest/$', LatestEntries(), name='latest-results'),
re_path(r'^feeds/latest_significant/$', LatestSignificantEntries(),
name='latest-significant-results'),
]

urlpatterns += [
url(r'^historical/json/$', views.gethistoricaldata, name='gethistoricaldata'),
url(r'^reports/$', views.reports, name='reports'),
url(r'^changes/$', views.changes, name='changes'),
url(r'^changes/table/$', views.getchangestable, name='getchangestable'),
url(r'^changes/logs/$', views.displaylogs, name='displaylogs'),
url(r'^timeline/$', views.timeline, name='timeline'),
url(r'^timeline/json/$', views.gettimelinedata, name='gettimelinedata'),
url(r'^comparison/$', views.comparison, name='comparison'),
url(r'^comparison/json/$', views.getcomparisondata, name='getcomparisondata'),
url(r'^makeimage/$', views.makeimage, name='makeimage'),
re_path(r'^historical/json/$', views.gethistoricaldata, name='gethistoricaldata'),
re_path(r'^reports/$', views.reports, name='reports'),
re_path(r'^changes/$', views.changes, name='changes'),
re_path(r'^changes/table/$', views.getchangestable, name='getchangestable'),
re_path(r'^changes/logs/$', views.displaylogs, name='displaylogs'),
re_path(r'^timeline/$', views.timeline, name='timeline'),
re_path(r'^timeline/json/$', views.gettimelinedata, name='gettimelinedata'),
re_path(r'^comparison/$', views.comparison, name='comparison'),
re_path(r'^comparison/json/$', views.getcomparisondata, name='getcomparisondata'),
re_path(r'^makeimage/$', views.makeimage, name='makeimage'),
]

urlpatterns += [
# URLs for adding results
url(r'^result/add/json/$', views.add_json_results, name='add-json-results'),
url(r'^result/add/$', views.add_result, name='add-result'),
re_path(r'^result/add/json/$', views.add_json_results, name='add-json-results'),
re_path(r'^result/add/$', views.add_result, name='add-result'),
]
23 changes: 12 additions & 11 deletions codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.http import HttpResponse, Http404, HttpResponseBadRequest, \
HttpResponseNotFound, StreamingHttpResponse
from django.db.models import F
from django.shortcuts import get_object_or_404, render_to_response
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_GET, require_POST
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.base import TemplateView
Expand All @@ -33,7 +33,7 @@

def no_environment_error(request):
admin_url = reverse('admin:codespeed_environment_changelist')
return render_to_response('codespeed/nodata.html', {
return render(request, 'codespeed/nodata.html', {
'message': ('You need to configure at least one Environment. '
'Please go to the '
'<a href="%s">admin interface</a>' % admin_url)
Expand All @@ -42,7 +42,7 @@ def no_environment_error(request):

def no_default_project_error(request):
admin_url = reverse('admin:codespeed_project_changelist')
return render_to_response('codespeed/nodata.html', {
return render(request, 'codespeed/nodata.html', {
'message': ('You need to configure at least one one Project as '
'default (checked "Track changes" field).<br />'
'Please go to the '
Expand All @@ -51,13 +51,13 @@ def no_default_project_error(request):


def no_executables_error(request):
return render_to_response('codespeed/nodata.html', {
return render(request, 'codespeed/nodata.html', {
'message': 'There needs to be at least one executable'
})


def no_data_found(request):
return render_to_response('codespeed/nodata.html', {
return render(request, 'codespeed/nodata.html', {
'message': 'No data found'
})

Expand Down Expand Up @@ -319,7 +319,7 @@ def comparison(request):
settings.CHART_ORIENTATION == 'horizontal'):
selecteddirection = True

return render_to_response('codespeed/comparison.html', {
return render(request, 'codespeed/comparison.html', {
'checkedexecutables': checkedexecutables,
'checkedbenchmarks': checkedbenchmarks,
'checkedenviros': checkedenviros,
Expand Down Expand Up @@ -633,7 +633,7 @@ def timeline(request):
for proj in Project.objects.filter(track=True):
executables[proj] = Executable.objects.filter(project=proj)
use_median_bands = hasattr(settings, 'USE_MEDIAN_BANDS') and settings.USE_MEDIAN_BANDS
return render_to_response('codespeed/timeline.html', {
return render(request, 'codespeed/timeline.html', {
'pagedesc': pagedesc,
'checkedexecutables': checkedexecutables,
'defaultbaseline': defaultbaseline,
Expand Down Expand Up @@ -717,7 +717,7 @@ def getchangestable(request):
'<p class="errormessage">No results for this '
'parameters</p>')

return render_to_response('codespeed/changes_data.html', {
return render(request, 'codespeed/changes_data.html', {
'tablelist': tablelist,
'trendconfig': trendconfig,
'rev': selectedrev,
Expand Down Expand Up @@ -823,7 +823,7 @@ def changes(request):

pagedesc = "Report of %s performance changes for commit %s on branch %s" % \
(defaultexecutable, selectedrevision.commitid, selectedrevision.branch)
return render_to_response('codespeed/changes.html', {
return render(request, 'codespeed/changes.html', {
'pagedesc': pagedesc,
'defaultenvironment': defaultenv,
'defaultexecutable': defaultexecutable,
Expand All @@ -850,7 +850,7 @@ def reports(request):
colorcode__in=('red', 'green')
).order_by('-revision__date')[:10]

return render_to_response('codespeed/reports.html', context)
return render(request, 'codespeed/reports.html', context)


@require_GET
Expand Down Expand Up @@ -895,7 +895,8 @@ def displaylogs(request):
for log in logs:
log['commit_browse_url'] = project.commit_browsing_url.format(**log)

return render_to_response(
return render(
request,
'codespeed/changes_logs.html',
{
'error': error, 'logs': logs,
Expand Down
4 changes: 2 additions & 2 deletions deploy-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-r requirements.txt
psycopg2==2.9.3
gunicorn==20.1.0
psycopg-binary==3.1.17
gunicorn==21.2.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Django>=1.11,<2.2
django<4
isodate==0.6.1
matplotlib<3.8
2 changes: 2 additions & 0 deletions speed_pypy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
}
}

DEFAULT_AUTO_FIELD='django.db.models.AutoField'

TIME_ZONE = 'America/Chicago'

LANGUAGE_CODE = 'en-us'
Expand Down
12 changes: 6 additions & 6 deletions speed_pypy/templates/feeds/latest_description.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% ifequal obj.colorcode "red" %}Performance regressed: {% else %}
{% ifequal obj.colorcode "green" %}Performance improved: {% else %}
{% ifequal obj.colorcode "yellow" %}Trend regressed: {% else %}
{% if obj.colorcode == "red" %}Performance regressed: {% else %}
{% if obj.colorcode == "green" %}Performance improved: {% else %}
{% if obj.colorcode == "yellow" %}Trend regressed: {% else %}
No significant changes.
{% endifequal %}
{% endifequal %}
{% endifequal %}
{% endif %}
{% endif %}
{% endif %}
{{ obj.summary }}
6 changes: 3 additions & 3 deletions speed_pypy/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

from django.conf import settings
from django.conf.urls import include, url
from django.urls import include, re_path
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('codespeed.urls'))
re_path(r'^admin/', admin.site.urls),
re_path(r'^', include('codespeed.urls'))
]

if settings.DEBUG:
Expand Down