Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 timedelta | |
| 8 | |
| 9 from crash_queries.crash_printer import crash_printer | |
| 10 | |
| 11 _TODAY = date.today().strftime('%Y-%m-%d') | |
| 12 _A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime('%Y-%m-%d') | |
| 13 | |
| 14 | |
| 15 if __name__ == '__main__': | |
| 16 argparser = argparse.ArgumentParser( | |
| 17 description='Print crashes.') | |
| 18 | |
| 19 argparser.add_argument( | |
| 20 '--date', | |
| 21 '-d', | |
| 22 default='%s..%s' % (_A_YEAR_AGO, _TODAY), | |
| 23 help=('Should be in start_date..end_date format.' | |
| 24 'If it\' 2016-08-01.., default end_date to today, if it\'s ' | |
|
wrengr
2016/10/05 18:41:59
-> "If the end date is missing, then it defaults t
Sharu Jiang
2016/10/06 18:16:56
Done.
| |
| 25 '..2016-08-16, default start_date to a year ago.' | |
| 26 'Start date and end date to query data in [start_date, end_date)')) | |
| 27 | |
| 28 argparser.add_argument( | |
| 29 '--client', | |
| 30 '-c', | |
| 31 default='fracas', | |
| 32 help=('Should be one in fracas/cracas/clusterfuzz. Right now, only ' | |
|
wrengr
2016/10/05 18:41:58
-> "Possible values are: fracas, cracas, clusterfu
Sharu Jiang
2016/10/06 18:16:56
Done.
| |
| 33 'fracas is supported.')) | |
| 34 | |
| 35 args = argparser.parse_args() | |
| 36 | |
| 37 start_date, end_date = args.date.split('..') | |
| 38 if not start_date: | |
|
wrengr
2016/10/05 18:41:58
Is this not redundant?
Sharu Jiang
2016/10/06 18:16:56
Oops, should be _A_YEAR_AGO
| |
| 39 start_date = None | |
| 40 if not end_date: | |
| 41 end_date = None | |
| 42 | |
| 43 crash_printer.CrashPrinter(args.client, | |
| 44 start_date=start_date, end_date=end_date) | |
| OLD | NEW |