Adds more stats to the qinfo command

* Average execution time
* Tasks per day/hour/minute/second
* Number of schedules
This commit is contained in:
Ilan
2015-08-12 12:39:14 +02:00
parent e86308b434
commit df7f8bbcaf
2 changed files with 62 additions and 2 deletions
+17 -1
View File
@@ -1,10 +1,12 @@
import pytest
import redis
from django_q import async
from django_q.cluster import Cluster
from django_q.monitor import monitor, Stat, ping_redis
from django_q.monitor import monitor, Stat, ping_redis, info
@pytest.mark.django_db
def test_monitor():
assert Stat.get(0).sentinel == 0
c = Cluster()
@@ -22,6 +24,20 @@ def test_monitor():
assert found_c is True
@pytest.mark.django_db
def test_info():
info()
do_sync()
info()
for _ in range(24):
do_sync()
info()
def do_sync():
async('django_q.tests.tasks.countdown', 1, sync=True, save=True)
@pytest.mark.django_db
def test_ping_redis():
r = redis.StrictRedis(port=6388)