(self, service_name, db_name, args)
Initialize new consumer.

        @param service_name: service_name for DBScript
        @param db_name: name of database for get_database()
        @param args: cmdline args for DBScript
Initialize new consumer.
Initialize new consumer .
def __init__(self, service_name, db_name, args):
        """Initialize new consumer.

        @param service_name: service_name for DBScript
        @param db_name: name of database for get_database()
        @param args: cmdline args for DBScript
        """

        skytools.DBScript.__init__(self, service_name, args)

        self.db_name = db_name

        # compat params
        self.consumer_name = self.cf.get("pgq_consumer_id", '')
        self.queue_name = self.cf.get("pgq_queue_name", '')

        # proper params
        if not self.consumer_name:
            self.consumer_name = self.cf.get("consumer_name", self.job_name)
        if not self.queue_name:
            self.queue_name = self.cf.get("queue_name")

        self.stat_batch_start = 0

        # compat vars
        self.pgq_queue_name = self.queue_name
        self.consumer_id = self.consumer_name

        # set default just once
        self.pgq_autocommit = self.cf.getint("pgq_autocommit", self.pgq_autocommit)
        if self.pgq_autocommit and self.pgq_lazy_fetch:
            raise skytools.UsageError("pgq_autocommit is not compatible with pgq_lazy_fetch")
        self.set_database_defaults(self.db_name, autocommit = self.pgq_autocommit)

        self.idle_start = time.time()
def __init__ ( self , service_name , db_name , args ) : skytools . DBScript . __init__ ( self , service_name , args ) self . db_name = db_name # compat params self . consumer_name = self . cf . get ( "pgq_consumer_id" , '' ) self . queue_name = self . cf . get ( "pgq_queue_name" , '' ) # proper params if not self . consumer_name : self . consumer_name = self . cf . get ( "consumer_name" , self . job_name ) if not self . queue_name : self . queue_name = self . cf . get ( "queue_name" ) self . stat_batch_start = 0 # compat vars self . pgq_queue_name = self . queue_name self . consumer_id = self . consumer_name # set default just once self . pgq_autocommit = self . cf . getint ( "pgq_autocommit" , self . pgq_autocommit ) if self . pgq_autocommit and self . pgq_lazy_fetch : raise skytools . UsageError ( "pgq_autocommit is not compatible with pgq_lazy_fetch" ) self . set_database_defaults ( self . db_name , autocommit = self . pgq_autocommit ) self . idle_start = time . time ( )