зеркало из https://github.com/mozilla/treeherder.git
Bug 1260110 - Add a "has subtests" property to performance series
This will be useful for some views where we don't know off the bat whether a signature has subtests or not (e.g. the e10s dashboard, the graphs view) and thus whether to show a "show subtests button"
This commit is contained in:
Родитель
e8fe392477
Коммит
70e00bc6da
|
@ -486,6 +486,7 @@ def test_perf_signature(test_repository):
|
|||
option_collection=option_collection,
|
||||
suite='mysuite',
|
||||
test='mytest',
|
||||
has_subtests=False,
|
||||
last_updated=datetime.datetime.now()
|
||||
)
|
||||
return signature
|
||||
|
|
|
@ -17,6 +17,7 @@ def subtests_perf_signature(test_perf_signature):
|
|||
platform=test_perf_signature.platform,
|
||||
option_collection=test_perf_signature.option_collection,
|
||||
suite='mysuite',
|
||||
has_subtests=False,
|
||||
last_updated=datetime.datetime.now()
|
||||
)
|
||||
test_perf_signature.parent_signature = signature
|
||||
|
|
|
@ -129,7 +129,7 @@ def _load_perf_artifact(project_name, reference_data, job_data, job_guid,
|
|||
summary_properties.update(extra_properties)
|
||||
summary_signature_hash = _get_signature_hash(
|
||||
summary_properties)
|
||||
signature, _ = PerformanceSignature.objects.get_or_create(
|
||||
signature, _ = PerformanceSignature.objects.update_or_create(
|
||||
repository=repository, signature_hash=summary_signature_hash,
|
||||
defaults={
|
||||
'test': '',
|
||||
|
@ -139,6 +139,7 @@ def _load_perf_artifact(project_name, reference_data, job_data, job_guid,
|
|||
'framework': framework,
|
||||
'extra_properties': extra_properties,
|
||||
'lower_is_better': suite.get('lowerIsBetter', True),
|
||||
'has_subtests': True,
|
||||
'last_updated': push_timestamp
|
||||
})
|
||||
(_, datum_created) = PerformanceDatum.objects.get_or_create(
|
||||
|
@ -176,6 +177,7 @@ def _load_perf_artifact(project_name, reference_data, job_data, job_guid,
|
|||
'extra_properties': extra_properties,
|
||||
'lower_is_better': subtest_metadata['lowerIsBetter'],
|
||||
'parent_signature': summary_signature,
|
||||
'has_subtests': False,
|
||||
'last_updated': push_timestamp
|
||||
})
|
||||
(_, datum_created) = PerformanceDatum.objects.get_or_create(
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('perf', '0012_performancesignature_parent_signature'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='performancesignature',
|
||||
name='has_subtests',
|
||||
field=models.BooleanField(default=False),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -42,6 +42,8 @@ class PerformanceSignature(models.Model):
|
|||
last_updated = models.DateTimeField(db_index=True)
|
||||
parent_signature = models.ForeignKey('self', related_name='subtests',
|
||||
null=True, blank=True)
|
||||
has_subtests = models.BooleanField()
|
||||
|
||||
# extra properties to distinguish the test (that don't fit into
|
||||
# option collection for whatever reason)
|
||||
extra_properties = JSONField(max_length=1024)
|
||||
|
|
|
@ -55,11 +55,12 @@ class PerformanceSignatureViewSet(viewsets.ViewSet):
|
|||
ret = {}
|
||||
for (signature_hash, option_collection_hash, platform, framework,
|
||||
suite, test, lower_is_better,
|
||||
extra_properties) in signature_data.values_list(
|
||||
extra_properties, has_subtests) in signature_data.values_list(
|
||||
'signature_hash',
|
||||
'option_collection__option_collection_hash',
|
||||
'platform__platform', 'framework', 'suite',
|
||||
'test', 'lower_is_better', 'extra_properties').distinct():
|
||||
'test', 'lower_is_better', 'extra_properties',
|
||||
'has_subtests').distinct():
|
||||
ret[signature_hash] = {
|
||||
'framework_id': framework,
|
||||
'option_collection_hash': option_collection_hash,
|
||||
|
@ -79,6 +80,8 @@ class PerformanceSignatureViewSet(viewsets.ViewSet):
|
|||
ret[signature_hash]['subtest_signatures'] = signature_data.filter(
|
||||
parent_signature__signature_hash__exact=signature_hash
|
||||
).values_list('signature_hash', flat=True)
|
||||
if has_subtests:
|
||||
ret[signature_hash]['has_subtests'] = True
|
||||
|
||||
ret[signature_hash].update(json.loads(extra_properties))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче