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.' | |
|
stgao
2016/10/10 23:39:40
Maybe give a real example too.
Sharu Jiang
2016/10/12 00:52:11
Done.
| |
| 24 'If the end date is missing, then it defaults to today. ' | |
| 25 'If the start date is missing, then it defaults to a year before ' | |
| 26 'the end date.' | |
| 27 'Start date and end date to query data in [start_date, end_date)')) | |
| 28 | |
| 29 argparser.add_argument( | |
| 30 '--client', | |
| 31 '-c', | |
| 32 default='fracas', | |
| 33 help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' | |
| 34 'fracas is supported.')) | |
| 35 | |
| 36 args = argparser.parse_args() | |
| 37 | |
| 38 start_date, end_date = args.date.split('..') | |
| 39 if not start_date: | |
| 40 start_date = _A_YEAR_AGO | |
|
stgao
2016/10/10 23:39:40
If the end date is provided, this doesn't conform
Sharu Jiang
2016/10/12 00:52:11
Done.
| |
| 41 if not end_date: | |
| 42 end_date = _TODAY | |
| 43 | |
| 44 crash_printer.CrashPrinter(args.client, | |
| 45 start_date=start_date, end_date=end_date) | |
| OLD | NEW |