Specify ATC contribution start/end in seconds

Change-Id: Ic62b00782f1ef709ce6f7b14217d36f02e230d79
This commit is contained in:
Jeremy Stanley 2014-09-26 16:17:23 +00:00
parent 58829de5bc
commit 981ba7290d
2 changed files with 16 additions and 14 deletions

View File

@ -13,12 +13,12 @@ elections and Summit invitations.
virtualenv venv
. venv/bin/activate
pip install paramiko requests pyyaml
./email_stats.py --begin <BEGINDATE>
./email_stats.py --begin <BEGINTIME>
# optionally specify --end, --keyfile, --ref and --user
DATE=`date --iso`
mv out $DATE
cat $DATE/*.csv | sort | uniq > $DATE/all.csv
TIME=`date +%Y%m%d%H%M%S`
mv out $TIME
cat $TIME/*.csv | sort | uniq > $TIME/all.csv
4) You can use diff.py to get the new ATCs since the previous run:
./diff.py $OLD-DATE/all.csv $DATE/all.csv $DATE/new.csv
./diff.py $OLD-TIME/all.csv $TIME/all.csv $TIME/new.csv

View File

@ -109,10 +109,12 @@ def project_stats(project, output, begin, end, keyfile, user):
done = False
last_sortkey = ''
start_date = datetime.datetime(int(begin[0:4]), int(begin[4:6]),
int(begin[6:8]), 0, 0, 0)
end_date = datetime.datetime(int(end[0:4]), int(end[4:6]), int(end[6:8]),
0, 0, 0)
begin_time = datetime.datetime(
int(begin[0:4]), int(begin[4:6]), int(begin[6:8]),
int(begin[8:10]), int(begin[10:12]), int(begin[12:14]))
end_time = datetime.datetime(
int(end[0:4]), int(end[4:6]), int(end[6:8]),
int(end[8:10]), int(end[10:12]), int(end[12:14]))
count = 0
earliest = datetime.datetime.now()
@ -138,7 +140,7 @@ def project_stats(project, output, begin, end, keyfile, user):
if aprv['type'] != 'SUBM':
continue
ts = datetime.datetime.fromtimestamp(aprv['grantedOn'])
if ts < start_date or ts > end_date:
if ts < begin_time or ts > end_time:
continue
approved = True
if ts < earliest:
@ -177,14 +179,14 @@ def get_extra_atcs(url):
def main():
today = ''.join(
'%02d' % x for x in datetime.datetime.utcnow().utctimetuple()[:3])
now = ''.join(
'%02d' % x for x in datetime.datetime.utcnow().utctimetuple()[:6])
optparser = optparse.OptionParser()
optparser.add_option(
'-b', '--begin', help='begin date (e.g. 20131017)')
'-b', '--begin', help='begin date/time (e.g. 20131017000000)')
optparser.add_option(
'-e', '--end', default=today, help='end date (default is today)')
'-e', '--end', default=now, help='end date/time (default is now)')
optparser.add_option(
'-k', '--keyfile', default='~/.ssh/id_rsa',
help='SSH key (default is ~/.ssh/id_rsa)')