From e979da23a7908f329e53fc9b23144c0f7b424fae Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Fri, 29 Nov 2024 08:51:59 -0500 Subject: [PATCH] Adding a "thismonth" option to the date argument for fetch_crashids (#6822) This adds a "thismonth" value to the value domain for the `--date" argument because it's not uncommon to be testing signature generation changes for situations that have happened in the last month, but not in the last week. --- socorro/scripts/fetch_crashids.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/socorro/scripts/fetch_crashids.py b/socorro/scripts/fetch_crashids.py index 883422fddd..a90b282b3d 100644 --- a/socorro/scripts/fetch_crashids.py +++ b/socorro/scripts/fetch_crashids.py @@ -108,7 +108,7 @@ def fetch_crashids(host, params, num_results): MAX_PAGE, # The number of results Super Search can return to us that is hasn't returned so far total - crashids_count, - # The numver of results we want that we haven't gotten, yet + # The number of results we want that we haven't gotten, yet num_results - crashids_count, ) @@ -137,8 +137,8 @@ def main(argv=None): "--date", default="", help=( - 'date to pull crash ids from as YYYY-MM-DD, "thisweek", "yesterday", ' - + '"today", or "now"; defaults to "yesterday"' + 'date to pull crash ids from as YYYY-MM-DD, "thismonth", "thisweek", ' + + '"yesterday", "today", or "now"; defaults to "yesterday"' ), ) parser.add_argument( @@ -200,6 +200,10 @@ def main(argv=None): enddate = enddate.strftime("%Y-%m-%dT%H:%M:%S.000Z") params["_sort"] = "-date" + elif datestamp == "thismonth": + startdate = utc_now() - datetime.timedelta(days=30) + enddate = utc_now() + datetime.timedelta(days=1) + elif datestamp == "thisweek": startdate = utc_now() - datetime.timedelta(days=7) enddate = utc_now() + datetime.timedelta(days=1)