Chromium Code Reviews| Index: appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py |
| diff --git a/appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py b/appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a27e43530a1757dceacaec8f427f88a919ec4509 |
| --- /dev/null |
| +++ b/appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py |
| @@ -0,0 +1,44 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import argparse |
| +from datetime import date |
| +from datetime import timedelta |
| + |
| +from crash_queries.crash_printer import crash_printer |
| + |
| +_TODAY = date.today().strftime('%Y-%m-%d') |
| +_A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime('%Y-%m-%d') |
| + |
| + |
| +if __name__ == '__main__': |
| + argparser = argparse.ArgumentParser( |
| + description='Print crashes.') |
| + |
| + argparser.add_argument( |
| + '--date', |
| + '-d', |
| + default='%s..%s' % (_A_YEAR_AGO, _TODAY), |
| + help=('Should be in start_date..end_date format.' |
| + '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.
|
| + '..2016-08-16, default start_date to a year ago.' |
| + 'Start date and end date to query data in [start_date, end_date)')) |
| + |
| + argparser.add_argument( |
| + '--client', |
| + '-c', |
| + default='fracas', |
| + 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.
|
| + 'fracas is supported.')) |
| + |
| + args = argparser.parse_args() |
| + |
| + start_date, end_date = args.date.split('..') |
| + 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
|
| + start_date = None |
| + if not end_date: |
| + end_date = None |
| + |
| + crash_printer.CrashPrinter(args.client, |
| + start_date=start_date, end_date=end_date) |