зеркало из https://github.com/mozilla/treeherder.git
Bug 1214860 - Reduce amount of data loaded in perfherder compare view
We only need the data associated with the result sets we are comparing, instead of a large time interval covering it.
This commit is contained in:
Родитель
9a978f4089
Коммит
9e6e70cd77
|
@ -81,16 +81,26 @@ class PerformanceDatumViewSet(viewsets.ViewSet):
|
|||
def list(self, request, project):
|
||||
repository = models.Repository.objects.get(name=project)
|
||||
|
||||
try:
|
||||
signature_hashes = request.query_params.getlist("signatures")
|
||||
except:
|
||||
raise exceptions.ValidationError('need signature list')
|
||||
signature_hashes = request.query_params.getlist("signatures")
|
||||
result_set_ids = request.query_params.getlist("result_set_id")
|
||||
job_ids = request.query_params.getlist("job_id")
|
||||
|
||||
if not (signature_hashes or result_set_ids or job_ids):
|
||||
raise exceptions.ValidationError('Need to specify either '
|
||||
'signatures, result_set_id, or '
|
||||
'job_id')
|
||||
|
||||
datums = PerformanceDatum.objects.filter(
|
||||
repository=repository,
|
||||
signature__signature_hash__in=signature_hashes).select_related(
|
||||
repository=repository).select_related(
|
||||
'signature__signature_hash').order_by('push_timestamp')
|
||||
|
||||
if signature_hashes:
|
||||
datums = datums.filter(signature__signature_hash__in=signature_hashes)
|
||||
if result_set_ids:
|
||||
datums = datums.filter(result_set_id__in=result_set_ids)
|
||||
if job_ids:
|
||||
datums = datums.filter(job_id__in=job_ids)
|
||||
|
||||
interval = request.query_params.get('interval')
|
||||
if interval:
|
||||
datums = datums.filter(
|
||||
|
|
|
@ -119,7 +119,6 @@ perf.controller('CompareResultsCtrl', [
|
|||
$scope.testList = originalSeriesData.testList;
|
||||
return PhCompare.getResultsMap($scope.originalProject.name,
|
||||
originalSeriesData.seriesList,
|
||||
timeRange,
|
||||
resultSetIds);
|
||||
}).then(function(resultMaps) {
|
||||
var originalResultsMap = resultMaps[$scope.originalResultSet.id];
|
||||
|
@ -144,7 +143,6 @@ perf.controller('CompareResultsCtrl', [
|
|||
newSeriesData.testList).sort();
|
||||
return PhCompare.getResultsMap($scope.newProject.name,
|
||||
newSeriesData.seriesList,
|
||||
timeRange,
|
||||
[$scope.newResultSet.id]);
|
||||
}).then(function(resultMaps) {
|
||||
var newResultsMap = resultMaps[$scope.newResultSet.id];
|
||||
|
@ -395,7 +393,6 @@ perf.controller('CompareSubtestResultsCtrl', [
|
|||
$scope.platformList = originalSeriesData.platformList;
|
||||
return PhCompare.getResultsMap($scope.originalProject.name,
|
||||
originalSeriesData.seriesList,
|
||||
timeRange,
|
||||
resultSetIds);
|
||||
}).then(function(seriesMaps) {
|
||||
var originalSeriesMap = seriesMaps[$scope.originalResultSet.id];
|
||||
|
@ -431,7 +428,6 @@ perf.controller('CompareSubtestResultsCtrl', [
|
|||
|
||||
return PhCompare.getResultsMap($scope.newProject.name,
|
||||
newSeriesData.seriesList,
|
||||
timeRange,
|
||||
[$scope.newResultSet.id]);
|
||||
}).then(function(newSeriesMaps) {
|
||||
var newSeriesMap = newSeriesMaps[$scope.newResultSet.id];
|
||||
|
|
|
@ -429,18 +429,20 @@ perf.factory('PhCompare', [ '$q', '$http', 'thServiceDomain', 'PhSeries',
|
|||
return errors;
|
||||
},
|
||||
|
||||
getResultsMap: function(projectName, seriesList, timeRange, resultSetIds) {
|
||||
var baseURL = thServiceDomain + '/api/project/' +
|
||||
getResultsMap: function(projectName, seriesList, resultSetIds) {
|
||||
var url = thServiceDomain + '/api/project/' +
|
||||
projectName + '/performance/' +
|
||||
'data/?interval=' + timeRange;
|
||||
|
||||
'data/?';
|
||||
url += _.map(resultSetIds, function(resultSetId) {
|
||||
return 'result_set_id=' + resultSetId;
|
||||
}).join('&');
|
||||
var resultsMap = {};
|
||||
return $q.all(_.chunk(seriesList, 20).map(function(seriesChunk) {
|
||||
var signatures = "";
|
||||
seriesChunk.forEach(function(series) {
|
||||
signatures += "&signatures=" + series.signature;
|
||||
});
|
||||
return $http.get(baseURL + signatures).then(
|
||||
return $http.get(url + signatures).then(
|
||||
function(response) {
|
||||
resultSetIds.forEach(function(resultSetId) {
|
||||
if (resultsMap[resultSetId] === undefined) {
|
||||
|
@ -455,14 +457,14 @@ perf.factory('PhCompare', [ '$q', '$http', 'thServiceDomain', 'PhSeries',
|
|||
_.where(data, { result_set_id: resultSetId }).forEach(function(pdata) {
|
||||
values.push(pdata.value);
|
||||
});
|
||||
|
||||
var seriesData = _.find(seriesChunk, {'signature': signature});
|
||||
|
||||
resultsMap[resultSetId][signature] = {
|
||||
platform: seriesData.platform,
|
||||
name: seriesData.name,
|
||||
values: values
|
||||
};
|
||||
var seriesData = _.find(seriesList, {'signature': signature});
|
||||
if (seriesData) {
|
||||
resultsMap[resultSetId][signature] = {
|
||||
platform: seriesData.platform,
|
||||
name: seriesData.name,
|
||||
values: values
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче