This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new fd20e7bc0 task command: add another filter option for days
fd20e7bc0 is described below
commit fd20e7bc0ab9ad5218612ce85a8679744e025229
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Apr 12 15:28:06 2023 -0400
task command: add another filter option for days
---
Allura/allura/command/taskd.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index dc2b173c6..9d6c42c67 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -182,8 +182,10 @@ class TaskCommand(base.Command):
help='limit to task names starting with this. Example
allura.tasks.index_tasks.')
parser.add_option('--filter-result-regex', dest='filter_result_regex',
default=None,
help='limit to tasks with result matching this regex.
Example "pysolr"')
- parser.add_option('--filter-queued-days-ago', dest='days_ago', type=int,
default=None,
- help='limit to tasks queued NUM days ago. Example
"180"')
+ parser.add_option('--filter-queued-days-ago', dest='days_ago', type=float,
default=None,
+ help='limit to tasks queued more than NUM days ago.
Example "180"')
+ parser.add_option('--filter-queued-less-than-days', dest='less_than_days',
type=float, default=None,
+ help='limit to tasks queued less than NUM days ago.
Example "0.5"')
min_args = 2
max_args = None
usage = '''<ini file> [list|count|retry|purge|timeout|commit]
@@ -231,6 +233,9 @@ class TaskCommand(base.Command):
q['result'] = {'$regex': self.options.filter_result_regex}
if self.options.days_ago:
q['time_queue'] = {'$lt': datetime.utcnow() -
timedelta(days=self.options.days_ago)}
+ if self.options.less_than_days:
+ q.setdefault('time_queue', {}) # if time_queue set from above,
don't clobber it
+ q['time_queue']['$gt'] = datetime.utcnow() -
timedelta(days=self.options.less_than_days)
if self.verbose:
print(q)
return q