Skip to content
Browse files

Merge pull request #85 from mozilla/socket-timeout

Socket timeout
  • Loading branch information...
2 parents 524d6fc + 37925a5 commit 4b283e1909e7912255451c88e51b8a072bbf2aff @jeads jeads committed
View
21 datazilla/model/base.py
@@ -12,6 +12,7 @@
import time
import json
import urllib
+import socket
import zlib
import MySQLdb
@@ -382,6 +383,13 @@ def store_pushlogs(
"""
+ ###
+ #This sets the socket timeout globally for all socket operations.
+ #Its default setting is None. In production, the /json-pushes
+ #web service call will occasionally hang on a TCP CLOSE_WAIT state.
+ ###
+ socket.setdefaulttimeout(120)
+
# fetch the list of known branches.
branch_list = self.get_branch_list(branch)
@@ -396,7 +404,6 @@ def store_pushlogs(
"maxhours": hours,
}
-
for br in branch_list:
self.println(u"Branch: pushlogs for {0}".format(
unicode(br["name"])).encode("UTF-8"),
@@ -411,12 +418,18 @@ def store_pushlogs(
)
self.println("URL: {0}".format(url), 1)
# fetch the JSON content from the constructed URL.
- res = urllib.urlopen(url)
- json_data = res.read()
+
+ json_data = ''
try:
- pushlog_dict = json.loads(json_data)
+ res = urllib.urlopen(url)
+ json_data = res.read()
+
+ except socket.timeout:
+ continue
+ try:
+ pushlog_dict = json.loads(json_data)
self._insert_branch_pushlogs(br["id"], pushlog_dict)
self.branch_count += 1
View
7 datazilla/webapp/static/js/b2g_apps/GraphControlsComponent.js
@@ -184,6 +184,8 @@ var GraphControlsView = new Class({
this.appContainerSel = '#app_container';
+ this.defaultBranchOption = 'master';
+
//series label ids
this.datasetLegendSel = '#su_legend';
this.datasetTestLegendSel = '#su_test_legend';
@@ -279,6 +281,11 @@ var GraphControlsView = new Class({
addBranch: function(branch){
var optionEl = $('<option></option>');
$(optionEl).attr('value', branch);
+
+ if(branch === this.defaultBranchOption){
+ $(optionEl).attr('selected', 'selected');
+ }
+
$(optionEl).text(branch);
$(this.branchSelectMenuSel).append(optionEl);
}
View
22 datazilla/webapp/static/js/b2g_apps/PerformanceGraphComponent.js
@@ -135,6 +135,7 @@ var PerformanceGraphComponent = new Class({
this.data = data;
this.chartData = {};
+ this.tickDisplayDates = {};
var i = 0;
@@ -143,8 +144,9 @@ var PerformanceGraphComponent = new Class({
var appName = "";
var timestamp = "";
var formattedTime = "";
+ var dataLength = data.length;
- for(i = 0; i<data.length; i++){
+ for(i = 0; i<dataLength; i++){
testId = data[i]['test_id'];
@@ -161,16 +163,15 @@ var PerformanceGraphComponent = new Class({
this.chartData[ testId ][ 'lines' ] = { 'show': true };
this.chartData[ testId ][ 'data' ] = [];
this.chartData[ testId ][ 'full_data' ] = [];
+
}
timestamp = data[i]['date_run'];
//Don't add x-axis labels to the first and last x-axis values
- if((i > 0) && (i < data.length - 1)){
- if(!this.tickDisplayDates[ data[i]['test_run_id'] ]){
- formattedTime = this.view.convertTimestampToDate(timestamp);
- this.tickDisplayDates[ data[i]['test_run_id'] ] = formattedTime;
- }
+ if((i > 0) && (i < dataLength - 1)){
+ formattedTime = this.view.convertTimestampToDate(timestamp);
+ this.tickDisplayDates[ i ] = formattedTime;
}
if(!data[i]['formatted_date_run']){
@@ -181,7 +182,7 @@ var PerformanceGraphComponent = new Class({
//Data for flot
this.chartData[ testId ][ 'data' ].push(
- [ data[i]['test_run_id'], data[i]['avg'] ]
+ [ i, data[i]['avg'] ]
);
//Data for presentation
@@ -217,7 +218,12 @@ var PerformanceGraphComponent = new Class({
);
if(!this.replicatesInitialized && this.seriesIndexDataMap[seriesIndex]){
- this._clickPlot({}, {}, { 'seriesIndex':seriesIndex, 'dataIndex':0 });
+ //Simulate plot click on first series, last datapoint
+ this._clickPlot({}, {}, {
+ 'seriesIndex':0,
+ 'dataIndex':this.seriesIndexDataMap[0]['data'].length - 1
+ });
+
this.view.resetSeriesLabelBackground(this.chartData);
this.replicatesInitialized = true;
}
View
2 datazilla/webapp/static/js/b2g_apps/apps-summary-min.js
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
19 datazilla/webapp/static/js/data_views/Bases.js
@@ -127,15 +127,20 @@ var View = new Class({
convertTimestampToDate: function(unixTimestamp, getHMS){
var dateObj = new Date(unixTimestamp * 1000);
- var dateString = dateObj.getFullYear() + '-' +
- this.padNumber((dateObj.getMonth() + 1), 10, '0') + '-' +
- dateObj.getDate();
+
+ var year = dateObj.getFullYear();
+ var month = this.padNumber(dateObj.getMonth() + 1, 10, '0');
+ var day = this.padNumber(dateObj.getDate(), 10, '0');
+
+ var dateString = year + '-' + month + '-' + day;
if(getHMS){
- dateString += ' ' +
- dateObj.getHours() + ':' +
- dateObj.getMinutes() + ':' +
- this.padNumber(dateObj.getSeconds(), 10, '0');
+
+ var hours = this.padNumber(dateObj.getHours(), 10, '0');
+ var minutes = this.padNumber(dateObj.getMinutes(), 10, '0');
+ var seconds = this.padNumber(dateObj.getSeconds(), 10, '0');
+
+ dateString += ' ' + hours + ':' + minutes + ':' + seconds;
}
return dateString;
View
2 datazilla/webapp/templates/apps.summary.html
@@ -66,7 +66,7 @@
<div class="ui-widget ui-widget-header ui-corner-all app-graph-container">
<div id="app_perf_wait" class="app-spinner"></div>
<div id="app_perf_data_container" style="display:none;">
- <div style="position:absolute; left:-60px; top:10px;" class="su-vertical-text">Average Run Time (milliseconds)</div>
+ <div style="position:absolute; left:-68px; top:10px;" class="su-vertical-text">Average Run Time (milliseconds)</div>
<div id="app_perf_chart" style="width:905px; height:370px; margin-top:5px; margin-left:35px;"></div>
<div id="app_perf_detail_container" class="ui-widget ui-widget-header ui-corner-all app-detail-graph-container">
<div style="width:180px;" class="app-control-element app-control-small-element">Application:<span id="app_series_application" class="app-data"></span></div>

0 comments on commit 4b283e1

Please sign in to comment.
Something went wrong with that request. Please try again.