-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add qmemory command * Update README, add test * Redesign qmemory * Add optional argument to show each worker's memory usage * Add --workers argument to test_qmemory
- Loading branch information
Showing
4 changed files
with
201 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
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,31 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.utils.translation import gettext as _ | ||
|
||
from django_q.monitor import memory | ||
|
||
|
||
class Command(BaseCommand): | ||
# Translators: help text for qmemory management command | ||
help = _("Monitors Q Cluster memory usage") | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
"--run-once", | ||
action="store_true", | ||
dest="run_once", | ||
default=False, | ||
help="Run once and then stop.", | ||
) | ||
parser.add_argument( | ||
"--workers", | ||
action="store_true", | ||
dest="workers", | ||
default=False, | ||
help="Show each worker's memory usage.", | ||
) | ||
|
||
def handle(self, *args, **options): | ||
memory( | ||
run_once=options.get("run_once", False), | ||
workers=options.get("workers", False) | ||
) |
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
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