/usr/bin/queue_mover3 is in skytools3 3.2.6-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 | #!/usr/bin/python
"""This script simply mover events from one queue to another.
Config parameters::
## Parameters for queue_mover
src_db = dbname=sourcedb
dst_db = dbname=targetdb
dst_queue_name = dest_queue
"""
import sys, os
import pkgloader
pkgloader.require('skytools', '3.0')
import pgq
class QueueMover(pgq.SerialConsumer):
__doc__ = __doc__
def __init__(self, args):
pgq.SerialConsumer.__init__(self, "queue_mover3", "src_db", "dst_db", args)
self.dst_queue_name = self.cf.get("dst_queue_name")
def process_remote_batch(self, db, batch_id, ev_list, dst_db):
# load data
rows = []
for ev in ev_list:
data = [ev.type, ev.data, ev.extra1, ev.extra2, ev.extra3, ev.extra4, ev.time]
rows.append(data)
fields = ['type', 'data', 'extra1', 'extra2', 'extra3', 'extra4', 'time']
# insert data
curs = dst_db.cursor()
pgq.bulk_insert_events(curs, rows, fields, self.dst_queue_name)
if __name__ == '__main__':
script = QueueMover(sys.argv[1:])
script.start()
|