forked from tilejet/tilejet-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geowatch-consumer-stats.py
executable file
·31 lines (27 loc) · 1.03 KB
/
geowatch-consumer-stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.conf import settings
from geowatchdjango.utils import provision_geowatch_consumer
from tilejetserver.broker import TileJetBrokerStats
verbose = True
enabled = settings.GEOWATCH_ENABLED
topic = settings.TILEJET_GEOWATCH_TOPIC_STATS
count = settings.TILEJET_GEOWATCH_COUNT_STATS
sleep_period = settings.TILEJET_GEOWATCH_SLEEP_STATS
mongodb_host = settings.TILEJET_MONGODB_HOST
mongodb_port = settings.TILEJET_MONGODB_PORT
mongodb_name = settings.TILEJET_MONGODB_NAME
timeout = 5
max_tries = 3
client, consumer = provision_geowatch_consumer(topic, "GeoWatchCodecJSON", max_tries=max_tries, sleep_period=sleep_period, topic_check=False, verbose=verbose)
if not consumer:
print "Could not get lock on GeoWatch server after "+str(max_tries)+" tries."
else:
broker = TileJetBrokerStats(
consumer=consumer,
sleep_period=sleep_period,
count=count,
timeout=timeout,
mongodb_host=mongodb_host,
mongodb_port=mongodb_port,
mongodb_name=mongodb_name,
verbose=verbose)
broker.run()