master.lib package

Submodules

master.lib.amqp_man module

class master.lib.amqp_man.AmqpManager(host=None)[source]

Bases: threading.Thread

A class to manage jobs (starting/stopping/cancelling/etc)

AMQP_JOB_QUEUE = 'jobs'
AMQP_JOB_RESULT_QUEUE = 'job_results'
ack_method(method)[source]

basic_ack the method

Method:The method to ack
bind_queue(exchange, queue)[source]

Bind the queue queue to the exchange exchange

consume_queue(queue_name, callback, no_ack=False)[source]

Consume from the queue queue_name with callback callback

declare_exchange(name, type)[source]

Declare an exchange named name and of type type

declare_queue(queue_name, **props)[source]

Declare the queue queue_name with properties defined in **props kwargs. Popular properties to set:

  • durable
  • exclusive
  • auto_delete
do_start()[source]
get_message_count(queue_name, **props)[source]

Get the size of the amqp queue queue_name. Note that the props kwargs must match the declaration properties of the queue. Getting the queue size is done by redeclaring the queue with the same properties, with the additional passive=True property set.

Queue_name:The name of the queue
classmethod instance(host=None)[source]
queue_msg(msg, queue_name, **props)[source]

Queue the message msg in the queue queue_name

Parameters:
  • msg (str) – The message to send (str or unicode)
  • queue_name (str) – The queue to put the message in
  • **props (dict) –

    Any additional props (exchange, etc)

run()[source]

Run the job manager. Only one of these should ever be running at a time :returns: TODO

stop()[source]

Stop the job manager :returns: TODO

wait_for_ready(timeout=2147483648)[source]

Wait until the AMQP manager is connected and ready to go

class master.lib.amqp_man.AmqpQueueHandler(callback, queue_name, channel, lock, no_ack, running)[source]

Bases: threading.Thread

run()[source]
stop()[source]

master.lib.mongo_oplog_watcher module

class master.lib.mongo_oplog_watcher.OplogPrinter(db=None, collection=None, poll_time=1.0, connection=None)[source]

Bases: master.lib.mongo_oplog_watcher.OplogWatcher

all(**kw)[source]
class master.lib.mongo_oplog_watcher.OplogWatcher(db=None, collection=None, poll_time=1.0, connection=None)[source]

Bases: threading.Thread

all(ns, ts, op, id, raw)[source]
all_with_noop(ns, ts, op, id, raw)[source]
command(ns, ts, cmd, raw, **kw)[source]
db_declare(ns, ts, **kw)[source]
delete(ns, ts, id, raw, **kw)[source]
insert(ns, ts, id, obj, raw, **kw)[source]
noop(ts)[source]
run()[source]
stop()[source]

Stop the running thread :returns: None

update(ns, ts, id, mod, raw, **kw)[source]

Module contents