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..e0801fa8146af9e766e16d09c1ce7f15c7c260cb |
| --- /dev/null |
| +++ b/appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py |
| @@ -0,0 +1,48 @@ |
| +# 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 |
| +import os |
| + |
| +from crash_queries.crash_printer import crash_printer |
| + |
| +_DATETIME_FORMAT = '%Y-%m-%d' |
| +_TODAY = date.today().strftime(_DATETIME_FORMAT) |
| +_A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime(_DATETIME_FORMAT) |
| + |
| + |
| +if __name__ == '__main__': |
| + argparser = argparse.ArgumentParser( |
| + description='Print crashes.') |
| + |
| + argparser.add_argument( |
| + '--since', |
| + '--after', |
|
stgao
2016/10/14 00:55:01
Why we have two names here?
Sharu Jiang
2016/10/14 18:14:49
This is similar to args of git log command:
http
stgao
2016/10/19 00:49:47
I rarely see such a usage.
What's the considerati
Sharu Jiang
2016/10/19 20:12:44
Maybe when people can not remember clearly whether
stgao
2016/10/20 01:18:37
When people don't remember, they should run "scrip
Sharu Jiang
2016/10/20 20:38:21
Acknowledged.
wrengr
2016/10/24 18:09:37
FWIW, I agree with stgao here. Having multiple way
|
| + default=_A_YEAR_AGO, |
| + help=('Query data since this date (including this date). ' |
| + 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' |
| + 'Defaults to a year ago.')) |
| + |
| + argparser.add_argument( |
| + '--until', |
| + '--before', |
|
stgao
2016/10/14 00:55:01
same here.
Sharu Jiang
2016/10/14 18:14:49
Ditto.
|
| + default=_TODAY, |
| + help=('Query data until this date (not including this date). ' |
| + 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' |
| + 'Defaults to today.')) |
| + |
| + argparser.add_argument( |
| + '--client', |
| + '-c', |
| + default='fracas', |
| + help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' |
| + 'fracas is supported.')) |
| + |
| + args = argparser.parse_args() |
| + |
| + crash_printer.CrashPrinter(args.client, |
| + start_date=args.since, end_date=args.until, |
| + app_id=os.getenv('APP_ID')) |