good code working ... to be deployed now.. drop db when deploying this

This commit is contained in:
2010-05-13 16:56:49 -07:00
parent 27e3468ab6
commit eb60c4d5b0
9 changed files with 178 additions and 53 deletions

View File

@@ -352,17 +352,25 @@ if createdb:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
try:
connection = MySQLdb.connect (host = options.dbhost,
port = int(options.dbport),
db = options.db,
user = options.dbuser,
passwd = options.dbpasswd)
connection = MySQLdb.connect(host=options.dbhost,
port=int(options.dbport),
db=options.db,
user=options.dbuser,
passwd=options.dbpasswd)
conn=connection.cursor()
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit(1)
CreateDBSchema(conn)
# if the database doesn't exist, create the schema using django by
# running models.py syncdb
# set the dbuser and dbpasswd environment vsariables for settings.py
# to work properly
os.environ['dbuser'] = options.dbuser
os.environ['dbpasswd'] = options.dbpasswd
from django.core.management import execute_manager
import settings
execute_manager(settings, ['manage.py','syncdb'])
treeid = GetOrInsertTree(conn, options.tree)
@@ -403,12 +411,12 @@ while curtime < endtime and chunk < totalchunks:
# dictionary of parsers
parsers = {
'check': log_parser.CheckParser,
'mochitest': log_parser.MochitestParser,
'reftest': log_parser.ReftestParser,
'jsreftest': log_parser.ReftestParser,
'crashtest': log_parser.ReftestParser,
'xpcshell': log_parser.XPCshellParser,
'check': logparser.CheckParser,
'mochitest': logparser.MochitestParser,
'reftest': logparser.ReftestParser,
'jsreftest': logparser.ReftestParser,
'crashtest': logparser.ReftestParser,
'xpcshell': logparser.XPCshellParser,
}
# regular expression to find the harness
@@ -478,7 +486,7 @@ while curtime < endtime and chunk < totalchunks:
# assured to match because we search for this above
harness_type = re.match(harness_regex, logname).groups()[0]
parser = parsers.get(harness_type, log_parser.LogParser)()
parser = parsers.get(harness_type, logparser.LogParser)()
failures = parser.parse(gz)
# add the failures to the database

View File

@@ -152,6 +152,9 @@ class LogParser(object):
else :
test=tup[0]
# remove whitespace and trailing dots
test = test.strip().rstrip('.')
# append interesting data to failures return value
failures.append({'test': test, 'text': text, 'reason': reason})

View File

@@ -1,7 +1,7 @@
# Django settings for topfails project.
import os
DEBUG = True
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DBUSER = DBPASSWD = ''

121
topfails/templates/#base.html# Executable file
View File

@@ -0,0 +1,121 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Topfails</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style>
.linear{
display: block;
font-family: Helvetica,Arial,sans-serif;
font-weight: bold;
font-size: 110.5%;
text-decoration: none;
padding: 2px;
-moz-border-radius: 5px;
border: 1px solid #000000;
color: #999999;
background-image:url("http://people.mozilla.com/~mnandigama/bg.png")
}
.linear:hover {
color: #cc3300;
font-style:italic
}
.info {
font-size: 81%;
font-weight: normal;
}
.ralign{
text-align: right;
}
.lalign {
text-align: left;
}
.calign{
text-align: center;
}
DIV,UL,OL /* Left */
{
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<div style="width: 180px;position:absolute; left:3px; top:102px; z-index:0">
<a class="linear ralign" href="{% url latest tree=tree %}">
<span> Latest Fails</span>
</a>
</div>
<div style="width: 180px;position:absolute; left:3px; top:135px; z-index:0">
<a class="linear ralign" href="{% url topfails tree=tree %}">
<span> Top 25 Fails</span>
</a>
</div>
<div style="width: 180px;position:absolute; left:3px; top:168px; z-index:0">
<a class="linear ralign" href="{% url tests tree=tree %}">
<span> All Failed Tests</span>
</a>
</div>
<div style="width: 180px;position:absolute; left:3px; top:201px; z-index:0">
<a class="linear ralign" href="{% url failswindow tree=tree %}?window=7d">
<span> Fails from X days</span>
</a>
</div>
<div style="width: 180px;position:absolute; left:3px; top:234px; z-index:0">
<a class="linear ralign" href="{% url Help tree=tree %}">
<span>Help</span>
</a>
</div>
<div id="image1" style="position:absolute; overflow:hidden; left:3px; top:1px; width:180px; height:68px; z-index:1">
<img src="http://people.mozilla.com/~mnandigama/images/logo-wordmark.png" alt="Firefox Logo" title="http://www.mozilla.com" border=0 width=179 height=68>
</div>
<div id="text1" style="position:absolute; overflow:hidden; left:321px; top:2px; width:591px; height:41px; z-index:3">
<div>
<div><font color="#CC4200" face="Tahoma" size="+3"><B>Mozilla Tinderbox Topfails Dashboard</B></font></div>
</div></div>
<div id="ff" style="width: 111px;position:absolute; left:311px; top:45px; z-index:2;">
<a class="linear calign" title="Click for Firefox Trunk Topfails Dashboard" href="{% url latest tree='Firefox' %}" >
<span> Firefox </span>
</a>
</div>
<div id="ff36" style="width: 111px;position:absolute; left:423px; top:45px; z-index:2">
<a class="linear calign" href="{% url latest tree='Firefox3.6' %}" title="Click for Firefox 3.6 Topfails Dashboard">
<span> Firefox3.6</span>
</a>
</div>
<div id="tb" style="width: 111px;position:absolute; left:535px; top:45px; z-index:2">
<a class="linear calign" title="Click for Thunderbird Trunk Topfails Dashboard" href="{% url latest tree='Thunderbird' %}">
<span>Thunderbird</span>
</a>
</div>
<div id="sm" style="width: 111px;position:absolute; left:647px; top:45px; z-index:2">
<a class="linear calign" title="Click for SeaMonkey Topfails Dashboard" href="{% url latest tree='SeaMonkey' %}">
<span> SeaMonkey</span>
</a>
</div>
<div id="text2" style="position:absolute; overflow:hidden; left:190px; top:102px; width:800px; z-index:4">
{% block content %}
{% endblock %}
</div>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<html>
<head>
<title>404</title>
</head>
<body>
<h1>404</h1>
<p>The resource you are looking for can't be found</p>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<html>
<head>
<title>500</title>
</head>
<body>
<h1>500 Internal Server Error</h1>
<p>There was an error in django. Oops! We're sorry</p>
</body>
</html>

View File

@@ -1,27 +0,0 @@
{% extends "base.html" %}
{% block content %}
<h3>Logfile links and Changeset links for {{ test }} failures</h3>
<ul>
<li style="display:none"><ul>
{% for f in section %}{% ifchanged f.build.id %}</ul></li><li>
<a href="{{ f.build.tinderboxlink|safe }}">{{ f.build.startdate|date:"Y-m-d H:i" }} {{ f.build.tree }} {{ f.build.get_os_display }}</a> [{{ f.build.changesetlink|safe }}]:
<ul>{% endifchanged %}
<!--<li>{{ f.description }}</li>-->{% endfor %}
</ul>
{% endblock %}
<div class="pagination">
<span class="step-links">
{% if section.has_previous %}
<a href="?page={{ section.previous_page_number }}">previous</a>
{% endif %}
<span class="current">
Page {{ section.number }} of {{ section.paginator.num_pages }}.
</span>
{% if section.has_next %}
<a href="?page={{ section.next_page_number }}">next</a>
{% endif %}
</span>
</div>

View File

@@ -2,19 +2,21 @@ import re
from django.db import models, connection
from datetime import datetime
from time import ctime, sleep, time
from topfails.mappings import OSes
class OS():
Windows = 0
Mac = 1
Linux = 2
Unknown = 3
# class OS():
# Windows = 0
# Mac = 1
# Linux = 2
# Unknown = 3
OS_CHOICES = (
(OS.Windows, 'Windows'),
(OS.Mac, 'Mac'),
(OS.Linux, 'Linux'),
(OS.Unknown, 'Unknown')
)
# OS_CHOICES = (
# (OS.Windows, 'Windows'),
# (OS.Mac, 'Mac'),
# (OS.Linux, 'Linux'),
# (OS.Unknown, 'Unknown')
# )
OS_CHOICES = tuple([(index, OS) for index, OS in enumerate(OSes)])
class BuildStatus():
Success = 0