mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-01 23:48:11 +08:00
Adds more stats to the qinfo command
* Average execution time * Tasks per day/hour/minute/second * Number of schedules
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user