forked from rq/django-rq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from django_rq import get_queue | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Removes all queue jobs | ||
""" | ||
help = __doc__ | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('--queue', '-q', dest='queue', default='default', | ||
help='Specify the queue [default]') | ||
|
||
def handle(self, *args, **options): | ||
""" | ||
Queues the function given with the first argument with the | ||
parameters given with the rest of the argument list. | ||
""" | ||
verbosity = int(options.get('verbosity', 1)) | ||
queue = get_queue(options.get('queue')) | ||
queue.empty() | ||
if verbosity: | ||
print('Queue "%s" cleaned' % queue.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters