Package pgq :: Module consumer :: Class RemoteConsumer
[frames] | no frames]

Class RemoteConsumer

source code

                 object --+        
                          |        
skytools.scripting.DBScript --+    
                              |    
                       Consumer --+
                                  |
                                 RemoteConsumer

Helper for doing event processing in another database.

Requires that whole batch is processed in one TX.

Instance Methods
 
__init__(self, service_name, db_name, remote_db, args)
Initialize new consumer.
source code
 
process_batch(self, db, batch_id, event_list)
Process all events in batch.
source code
 
is_last_batch(self, dst_curs, batch_id)
Helper function to keep track of last successful batch in external database.
source code
 
set_last_batch(self, dst_curs, batch_id)
Helper function to set last successful batch in external database.
source code
 
process_remote_batch(self, db, batch_id, event_list, dst_db) source code

Inherited from Consumer: attach, detach, get_batch_info, process_event, register_consumer, stat_end, stat_start, unregister_consumer, work

Inherited from skytools.scripting.DBScript: close_database, get_database, hook_sighup, hook_sigint, init_optparse, reload, reset, run, run_once, send_signal, send_stats, set_single_loop, start, startup, stat_add, stat_increase, stat_put, stop

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables

Inherited from skytools.scripting.DBScript: cf, job_name, log, service_name

Properties

Inherited from object: __class__

Method Details

__init__(self, service_name, db_name, remote_db, args)
(Constructor)

source code 
Initialize new consumer.
Overrides: Consumer.__init__
(inherited documentation)

process_batch(self, db, batch_id, event_list)

source code 

Process all events in batch.

By default calls process_event for each.
Overrides: Consumer.process_batch