Skip to content

Commit

Permalink
Parameterize the nightly signature frequency on the channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmedberg committed Sep 11, 2013
1 parent 8089e21 commit 37ed030
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/main/python/nightly-signature-frequency.py
Expand Up @@ -10,9 +10,20 @@
help='Start date', default=date.today() - timedelta(days=14))
p.add_option('-e', '--end-date', dest='enddate', type='date',
help='End date', default=date.today())
p.add_option('-c', '--channel', dest='channel', type='string',
help='Channel name', default='nightly')

opts, (signature,) = p.parse_args()

channels = {
'nightly': 'mozilla-central',
'aurora': 'mozilla-aurora',
}

if opts.channel not in channels:
print >>sys.stderr, "Channel '%s' unknown: add it to the channels map" % opts.channel
sys.exit(2)

connectionstring = open(os.path.expanduser('~/socorro.connection'), 'r').read().strip()

conn = psycopg2.connect(connectionstring)
Expand All @@ -25,7 +36,7 @@
WHERE
product_name = 'Firefox' AND
product_os_platform = 'Windows' AND
build_channel = 'nightly' AND
build_channel = %(channel)s AND
date >= %(startdate)s AND date <= %(enddate)s AND
date < to_date(substring(build from 1 for 8), 'YYYYMMDD') + interval '10 days'
GROUP BY build
Expand Down Expand Up @@ -56,13 +67,16 @@
WHERE
product_name = 'firefox' AND
platform = 'win32' AND
build_type = 'Nightly' AND
repository = 'mozilla-central' AND
build_type = %(studlyChannel)s AND
repository = %(repository)s AND
to_date(substring(build_id::text from 1 for 8), 'YYYYMMDD') BETWEEN %(startdate)s AND %(enddate)s
ORDER BY build_id
''', {'startdate': opts.startdate,
'enddate': opts.enddate,
'signature': signature})
'signature': signature,
'channel': opts.channel,
'studlyChannel': opts.channel.capitalize(),
'repository': channels[opts.channel]})

csvw = csv.writer(sys.stdout)

Expand Down

0 comments on commit 37ed030

Please sign in to comment.