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 import os | |
| 9 | |
| 10 from crash_queries.crash_printer import crash_printer | |
| 11 | |
| 12 _DATETIME_FORMAT = '%Y-%m-%d' | |
| 13 _TODAY = date.today().strftime(_DATETIME_FORMAT) | |
| 14 _A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime(_DATETIME_FORMAT) | |
| 15 | |
| 16 | |
| 17 if __name__ == '__main__': | |
| 18 argparser = argparse.ArgumentParser( | |
| 19 description='Print crashes.') | |
| 20 | |
| 21 argparser.add_argument( | |
| 22 '--since', | |
| 23 default=_A_YEAR_AGO, | |
| 24 help=('Query data since this date (including this date). ' | |
| 25 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' | |
| 26 'Defaults to a year ago.')) | |
| 27 | |
| 28 argparser.add_argument( | |
| 29 '--until', | |
| 30 default=_TODAY, | |
|
lijeffrey
2016/10/20 15:35:46
nit: is there a reason you include the -c shortcut
Sharu Jiang
2016/10/20 20:38:21
Done.
| |
| 31 help=('Query data until this date (not including this date). ' | |
| 32 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' | |
| 33 'Defaults to today.')) | |
| 34 | |
| 35 argparser.add_argument( | |
| 36 '--client', | |
| 37 '-c', | |
| 38 default='fracas', | |
| 39 help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' | |
| 40 'fracas is supported.')) | |
| 41 | |
| 42 args = argparser.parse_args() | |
| 43 | |
| 44 crash_printer.CrashPrinter(args.client, os.getenv('APP_ID'), | |
| 45 start_date=args.since, end_date=args.until) | |
| OLD | NEW |