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..199152012465e2c99f80af7b0be39eec12c230c6 |
| --- /dev/null |
| +++ b/appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py |
| @@ -0,0 +1,45 @@ |
| +# 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.' |
|
stgao
2016/10/10 23:39:40
Maybe give a real example too.
Sharu Jiang
2016/10/12 00:52:11
Done.
|
| + 'If the end date is missing, then it defaults to today. ' |
| + 'If the start date is missing, then it defaults to a year before ' |
| + 'the end date.' |
| + 'Start date and end date to query data in [start_date, end_date)')) |
| + |
| + argparser.add_argument( |
| + '--client', |
| + '-c', |
| + default='fracas', |
| + help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' |
| + 'fracas is supported.')) |
| + |
| + args = argparser.parse_args() |
| + |
| + start_date, end_date = args.date.split('..') |
| + if not start_date: |
| + 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.
|
| + if not end_date: |
| + end_date = _TODAY |
| + |
| + crash_printer.CrashPrinter(args.client, |
| + start_date=start_date, end_date=end_date) |