This commit is contained in:
Cameron Dawson 2013-08-05 23:00:44 -07:00
Родитель 9198911ff9
Коммит 09450fcb4f
4 изменённых файлов: 21 добавлений и 17 удалений

Просмотреть файл

@ -18,17 +18,17 @@
},
"job_source": {
"sql": "SELECT rev.commit_timestamp,
rs.push_timestamp,
res.push_timestamp,
rev.comments,
rev.repository_id,
rev.revision
FROM `revision` as rev
LEFT JOIN `revision_map` as rm
ON rev.id = rm.revision_id
LEFT JOIN `result_set` as rs
ON rm.result_set_id = rs.id
LEFT JOIN `revision_map` as revmap
ON rev.id = revmap.revision_id
LEFT JOIN `result_set` as res
ON revmap.result_set_id = res.id
LEFT JOIN `job`
ON job.result_set_id = rs.id
ON job.result_set_id = res.id
WHERE job.id = ?
",
"host": "master_host"

Просмотреть файл

@ -146,9 +146,7 @@ def test_job_detail_bad_project(webapp, ten_jobs_processed, jm):
test retrieving a single job from the jobs-detail
endpoint.
"""
job = jm.get_job_list(0, 1)
print list(job)
job = job.next()
job = jm.get_job_list(0, 1).next()
url = reverse("jobs-detail",
kwargs={"project": jm.project, "pk": job["id"]})
badurl = url.replace(jm.project, "badproject")

Просмотреть файл

@ -150,7 +150,7 @@ class JobsModel(TreeherderModelBase):
def get_result_set_job_list(self, result_set_id):
"""
Retrieve a list of ``jobs`` with results.
Retrieve a list of ``jobs`` and results for a result_set.
Mainly used by the restful api to list the job results in the UI
"""
@ -318,9 +318,8 @@ class JobsModel(TreeherderModelBase):
"""
# @@@ ``push_timestamp`` will come from a different location in the
# data structure
# in the future. most likely at the top-level, rather than
# inside ``sources``
# data structure in the future. most likely at the top-level,
# rather than inside ``sources``
result_set_id = self._get_or_create_result_set(
data["revision_hash"],
data["sources"][0].get("push_timestamp", 0),

Просмотреть файл

@ -134,14 +134,15 @@ class JobsViewSet(viewsets.ViewSet):
class ResultSetViewSet(viewsets.ViewSet):
"""GET a list of ``result sets`` with revisions
"""
View for ``resultset`` records
``result sets`` are synonymous with ``pushes`` in the ui
``result sets`` are synonymous with ``pushes`` in the ui
"""
def list(self, request, project):
"""
GET method for list of result_sets with revisions
GET method for list of ``resultset`` records with revisions
"""
try:
page = request.QUERY_PARAMS.get('page', 0)
@ -157,6 +158,12 @@ class ResultSetViewSet(viewsets.ViewSet):
jm.disconnect()
def get_warning_level(self, jobs):
"""
Return the most severe warning level for a list of jobs.
A color-based warning level based on the most severe
level in the list of jobs.
"""
job_states = set([x["result"] for x in jobs])
if "busted" in job_states:
return "red"
@ -171,7 +178,7 @@ class ResultSetViewSet(viewsets.ViewSet):
def retrieve(self, request, project, pk=None):
"""
GET method implementation for detail view
GET method implementation for detail view of ``resultset``
"""
try:
jm = JobsModel(project)