Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: appengine/findit/util_scripts/crash_queries/crash_printer/print_crash.py

Issue 2391823006: [Findit] Add iterator and crash_iterator for delta test (Closed)
Patch Set: Seperate --date argument. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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'))

Powered by Google App Engine
This is Rietveld 408576698