summaryrefslogtreecommitdiff
path: root/python/pgq/ticker.py
diff options
context:
space:
mode:
authorMarko Kreen2013-01-14 12:30:21 +0000
committerMarko Kreen2013-01-14 12:30:21 +0000
commit327563df9fdc0c05bec8cf0ef89dc37cdab5b1a2 (patch)
treef9b9d614c8362883daa7f39725a0ac04a68af90e /python/pgq/ticker.py
parent39d6f2913e2e7a497ea23db52ff2bf574b590e47 (diff)
Remove: pgqadm and related code, its unmaintained
Although it was nice to have Python code that shows how PgQ ticker and maintenance operations should work, if it's unmaintaned, it's pointless.
Diffstat (limited to 'python/pgq/ticker.py')
-rw-r--r--python/pgq/ticker.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/python/pgq/ticker.py b/python/pgq/ticker.py
deleted file mode 100644
index e623b9cb..00000000
--- a/python/pgq/ticker.py
+++ /dev/null
@@ -1,52 +0,0 @@
-"""PgQ ticker.
-
-It will also launch maintenance job.
-"""
-
-import time, threading
-import skytools
-
-from pgq.maint import MaintenanceJob
-
-__all__ = ['SmallTicker']
-
-class SmallTicker(skytools.DBScript):
- """Ticker that periodically calls pgq.ticker()."""
- tick_count = 0
- maint_thread = None
-
- def __init__(self, args):
- skytools.DBScript.__init__(self, 'pgqadm', args)
-
- self.ticker_log_time = 0
- self.ticker_log_delay = 5*60
-
- def reload(self):
- skytools.DBScript.reload(self)
- self.ticker_log_delay = self.cf.getfloat("ticker_log_delay", 5*60)
-
- def startup(self):
- if self.maint_thread:
- return
-
- # launch maint thread
- self.maint_thread = MaintenanceJob(self, [self.cf.filename])
- t = threading.Thread(name = 'maint_thread',
- target = self.maint_thread.run)
- t.setDaemon(1)
- t.start()
-
- def work(self):
- db = self.get_database("db", autocommit = 1)
- cx = db.cursor()
-
- # run ticker
- cx.execute("select pgq.ticker()")
- self.tick_count += cx.fetchone()[0]
-
- cur_time = time.time()
- if cur_time > self.ticker_log_time + self.ticker_log_delay:
- self.ticker_log_time = cur_time
- self.stat_increase('ticks', self.tick_count)
- self.tick_count = 0
-