bug 957301 - refactor bugzilla cron #1903

merged 5 commits into from Feb 22, 2014


None yet
2 participants

lonnen commented Feb 20, 2014

This fixes bug 957301 by resolving the time zone discrepancy.

@peterbe peterbe commented on an outdated diff Feb 21, 2014

@@ -11,18 +11,18 @@
from socorro.cron.base import PostgresTransactionManagedCronApp
-_URL = ('https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&short_d'
- 'esc_type=allwordssubstr&short_desc=&long_desc_type=allwordssubstr&long'
- '_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboar'
- 'd_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywor'
- 'ds=&deadlinefrom=&deadlineto=&emailassigned_to1=1&emailtype1=substring'
- '&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&email'
- 'cc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&ch'
- 'fieldfrom=%s&chfieldto=Now&chfield=[Bug+creation]&chfield=resolution&c'
- 'hfield=bug_status&chfield=short_desc&chfield=cf_crash_signature&chfiel'
- 'dvalue=&cmdtype=doit&order=Importance&field0-0-0=noop&type0-0-0=noop&v'
- 'alue0-0-0=&columnlist=bug_id,bug_status,resolution,short_desc,cf_crash'
- '_signature&ctype=csv')
+_URL = ('https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&short_'

peterbe Feb 21, 2014


The new cool way to writing this would probably be

_URL = (

that way you become independent of the site of the variable without the indentation looking pants.


peterbe Feb 21, 2014


Fairly certain this current way was my mistake at first.

lonnen added some commits Feb 21, 2014

@lonnen lonnen requirements refresh and additional dateutil req for 957301 d7660cb
@lonnen lonnen use PST instead of UTC when talking to bugzilla
Bugzilla runs on PST, so requesting time-sensitive data from it using
UTC means we occasionally miss changes that were made in PST evening.
This patch fixes that by getting the current PST/PDT time instead of
UTC before talking to BZ.
@lonnen lonnen apply time zone formatting before interacting with bugzilla
apply the proper time zone formatting to the bugzilla cron and cron
tests for the happy path and degenerate case

fixes bug 957301

@peterbe peterbe commented on an outdated diff Feb 21, 2014

@@ -51,14 +54,15 @@ def run(self, connection):
# TypeError if self.job_information is None
last_run = self.job_information['last_success']
except (KeyError, TypeError):
- last_run = utc_now() - datetime.timedelta(
- days=self.config.days_into_past and
- self.config.days_into_past or
- 30)
- last_run_formatted = last_run.strftime('%Y-%m-%d')
+ last_run = (datetime.datetime.now(tz.gettz('UTC')) -
+ datetime.timedelta(days=self.config.days_into_past))
+ PST = tz.gettz('PST8PDT')
+ last_run_formatted = last_run.astimezone(PST).strftime('%Y-%m-%d')

peterbe Feb 21, 2014


Can you add a comment to explain that why this is done is because BMO uses Pacific time.


peterbe commented Feb 21, 2014

r+ but with a nit on the lacking comment.

@lonnen lonnen added a commit that referenced this pull request Feb 22, 2014

@lonnen lonnen Merge pull request #1903 from lonnen/957301-bugzilla-cron
bug 957301 - refactor bugzilla cron

@lonnen lonnen merged commit 68ebf1d into mozilla-services:master Feb 22, 2014

1 check passed

default Jenkins build 'socorro-github' #2833 has succeeded

lonnen deleted the lonnen:957301-bugzilla-cron branch Feb 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment