Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py

Issue 2391823006: [Findit] Add iterator and crash_iterator for delta test (Closed)
Patch Set: Address comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import argparse
6 from datetime import date
7 from datetime import datetime
8 from datetime import timedelta
9 import os
10
11 from crash_queries.crash_printer import crash_printer
12
13 _DATETIME_FORMAT = '%Y-%m-%d'
14 _TODAY = date.today().strftime(_DATETIME_FORMAT)
15 _A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime(_DATETIME_FORMAT)
16
17
18 if __name__ == '__main__':
19 argparser = argparse.ArgumentParser(
20 description='Print crashes.')
21
22 argparser.add_argument(
23 '--date',
24 '-d',
25 default='%s..%s' % (_A_YEAR_AGO, _TODAY),
stgao 2016/10/13 06:38:52 Can we separate the start and end dates into two p
Sharu Jiang 2016/10/13 20:31:16 Done.
26 help=('Should be in start_date..end_date format. '
27 'E.g. 2015-09-31..2016-10-01.'
28 'If the end date is missing, then it defaults to today. '
29 'If the start date is missing, then it defaults to a year before '
30 'the end date.'
31 'Start date and end date to query data in [start_date, end_date)'))
32
33 argparser.add_argument(
34 '--client',
35 '-c',
36 default='fracas',
37 help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only '
38 'fracas is supported.'))
39
40 args = argparser.parse_args()
41
42 start_date, end_date = args.date.split('..')
43 if not end_date:
44 end_date = _TODAY
45 if not start_date:
46 start_date = (datetime.strptime(end_date, _DATETIME_FORMAT) -
47 timedelta(days=365)).strftime(_DATETIME_FORMAT)
48
49 crash_printer.CrashPrinter(args.client,
50 start_date=start_date, end_date=end_date,
51 app_id=os.getenv('APP_ID'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698