| 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 import sys |
| 10 |
| 11 _SCRIPT_DIR = os.path.join(os.path.dirname(__file__), os.path.pardir, |
| 12 os.path.pardir) |
| 13 sys.path.insert(1, _SCRIPT_DIR) |
| 14 |
| 15 import script_util |
| 16 script_util.SetUpSystemPaths() |
| 17 from crash_queries.crash_printer import crash_printer |
| 18 |
| 19 _DATETIME_FORMAT = '%Y-%m-%d' |
| 20 _TODAY = date.today().strftime(_DATETIME_FORMAT) |
| 21 _A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime(_DATETIME_FORMAT) |
| 22 |
| 23 |
| 24 if __name__ == '__main__': |
| 25 argparser = argparse.ArgumentParser( |
| 26 description='Print crashes.') |
| 27 |
| 28 argparser.add_argument( |
| 29 '--since', |
| 30 '-s', |
| 31 default=_A_YEAR_AGO, |
| 32 help=('Query data since this date (including this date). ' |
| 33 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' |
| 34 'Defaults to a year ago.')) |
| 35 |
| 36 argparser.add_argument( |
| 37 '--until', |
| 38 '-u', |
| 39 default=_TODAY, |
| 40 help=('Query data until this date (not including this date). ' |
| 41 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' |
| 42 'Defaults to today.')) |
| 43 |
| 44 argparser.add_argument( |
| 45 '--client', |
| 46 '-c', |
| 47 default='fracas', |
| 48 help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' |
| 49 'fracas is supported.')) |
| 50 |
| 51 argparser.add_argument( |
| 52 '--app', |
| 53 '-a', |
| 54 default=os.getenv('APP_ID', 'findit-for-me-dev'), |
| 55 help=('App id of the App engine app that query needs to access. ' |
| 56 'Defualts to findit-for-me-dev. You can set enviroment variable by' |
| 57 ' \'export APP_ID=your-app-id\' to replace the default value.')) |
| 58 |
| 59 args = argparser.parse_args() |
| 60 |
| 61 crash_printer.CrashPrinter(args.client, args.app, |
| 62 start_date=args.since, end_date=args.until) |
| OLD | NEW |