Browse Source

[beeswax] Close command should close the queries older than N

Currently it is closing the query between now and N days (e.g.
close 0 does nothing, close 1 closes between now and yesterday)
instead of older than N days:
Romain Rigaux 11 years ago
parent
commit
ee025b6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      apps/beeswax/src/beeswax/management/commands/close_queries.py

+ 2 - 2
apps/beeswax/src/beeswax/management/commands/close_queries.py

@@ -33,7 +33,7 @@ class Command(BaseCommand):
   0 queries closed.
   """
   args = '<age_in_days> <all> (default is 7)'
-  help = 'Closes the non running queries older than 7 days. If <all> is specified, close the ones of any types.'
+  help = 'Close finished Hive queries older than 7 days. If \'all\' is specified, also close the Impala ones.'
 
   def handle(self, *args, **options):
     days = int(args[0]) if len(args) >= 1 else 7
@@ -47,7 +47,7 @@ class Command(BaseCommand):
     if close_all:
       queries = HiveServerQueryHistory.objects.all()
 
-    queries = queries.filter(submission_date__gte=datetime.today() - timedelta(days=days))
+    queries = queries.filter(submission_date__lte=datetime.today() - timedelta(days=days))
 
     for query in queries:
       try: