當前位置: 首頁>>代碼示例>>Python>>正文


Python handler.BaseHandler類代碼示例

本文整理匯總了Python中londiste.handler.BaseHandler的典型用法代碼示例。如果您正苦於以下問題:Python BaseHandler類的具體用法?Python BaseHandler怎麽用?Python BaseHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BaseHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add

    def add(self, trigger_arg_list):
        """Let trigger put hash into extra3"""

        arg = "ev_extra3='hash='||hashtext(%s)" % skytools.quote_ident(self.key)
        trigger_arg_list.append(arg)

        BaseHandler.add(self, trigger_arg_list)
開發者ID:mpihlak,項目名稱:skytools-dev,代碼行數:7,代碼來源:bublin.py

示例2: reset

 def reset(self):
     """Forget config info."""
     if Bublin.bubbles_max_slot:
         Bublin.bubbles_max_slot = None
     if Bublin.bubbles_local_slots:
         Bublin.bubbles_local_slots = None
     BaseHandler.reset(self)
開發者ID:mpihlak,項目名稱:skytools-dev,代碼行數:7,代碼來源:bublin.py

示例3: __init__

 def __init__(self, table_name, args, log):
     """Init per-batch table data cache."""
     BaseHandler.__init__(self, table_name, args, log)
     try:
         self.dst_queue_name = args['queue']
     except KeyError:
         raise Exception('specify queue with handler-arg')
     self.rows = []
開發者ID:digideskio,項目名稱:skytools,代碼行數:8,代碼來源:qtable.py

示例4: process_event

 def process_event(self, ev, sql_queue_func, arg):
     """Filter event by hash in extra3, apply only local slots."""
     if ev.extra3:
         meta = skytools.db_urldecode(ev.extra3)
         slot = int(meta['hash']) & self.bubbles_max_slot
         if slot not in self.bubbles_local_slots:
             return
     BaseHandler.process_event(self, ev, sql_queue_func, arg)
開發者ID:mpihlak,項目名稱:skytools-dev,代碼行數:8,代碼來源:bublin.py

示例5: prepare_copy

    def prepare_copy(self, expr_list, dst_curs):
        """Copy only slots needed locally."""
        self.load_bubbles(dst_curs)

        slist = self.bubbles_local_slots.keys()
        fn = 'hashtext(%s)' % skytools.quote_ident(self.key)
        w = "(((%s) & %d) in (%s))" % (fn, self.bubbles_max_slot, slist)
        expr_list.append(w)

        BaseHandler.prepare_copy(self, expr_list, dst_curs)
開發者ID:mpihlak,項目名稱:skytools-dev,代碼行數:10,代碼來源:bublin.py

示例6: __init__

    def __init__(self, table_name, args, log):
        """Init per-batch table data cache."""

        BaseHandler.__init__(self, table_name, args, log)

        self.pkey_list = None
        self.dist_fields = None
        self.col_list = None

        self.pkey_ev_map = {}
        self.method = int(args.get('method', DEFAULT_METHOD))
        if not self.method in (0,1,2):
            raise Exception('unknown method: %s' % self.method)

        self.log.debug('bulk_init(%s), method=%d' % (repr(args), self.method))
開發者ID:digideskio,項目名稱:skytools,代碼行數:15,代碼來源:bulk.py

示例7: __init__

 def __init__(self, table_name, args, log):
     BaseHandler.__init__(self, table_name, args, log)
     # show args
     self.log.debug("dispatch.init: table_name=%r, args=%r" % \
                    (table_name, args))
     # get table name
     self.table_name = args.get('table', self.table_name)
     self.quoted_name = quote_fqident(self.table_name)
     self.batch_info = None
     self.dst_curs = None
     self.pkeys = None
     # config
     self.conf = self.get_config()
     hdlr_cls = ROW_HANDLERS[self.conf.row_mode]
     self.row_handler = hdlr_cls(self.log)
開發者ID:ssinger,項目名稱:skytools,代碼行數:15,代碼來源:dispatch.py

示例8: __init__

    def __init__(self, table_name, args, dest_table):
        """Init per-batch table data cache."""

        BaseHandler.__init__(self, table_name, args, dest_table)

        self.pkey_list = None
        self.dist_fields = None
        self.col_list = None

        self.pkey_ev_map = {}
        self.method = int(args.get("method", DEFAULT_METHOD))
        if not self.method in (0, 1, 2):
            raise Exception("unknown method: %s" % self.method)

        self.log.debug("bulk_init(%r), method=%d", args, self.method)
開發者ID:SonicWang,項目名稱:skytools,代碼行數:15,代碼來源:bulk.py

示例9: __init__

 def __init__(self, table_name, args, log):
     BaseHandler.__init__(self, table_name, args, log)
     # show args
     self.log.debug("dispatch.init: table_name=%r, args=%r" % (table_name, args))
     # get table name
     self.table_name = args.get("table", self.table_name)
     self.quoted_name = quote_fqident(self.table_name)
     self.batch_info = None
     self.dst_curs = None
     self.pkeys = None
     # config
     self.conf = self.get_config()
     hdlr_cls = ROW_HANDLERS[self.conf.row_mode]
     self.row_handler = hdlr_cls(self.log)
     if self.conf.encoding:
         self.encoding_validator = EncodingValidator(self.log, self.conf.encoding)
     else:
         self.encoding_validator = None
開發者ID:kevpie,項目名稱:skytools,代碼行數:18,代碼來源:dispatch.py

示例10: real_copy

    def real_copy(self, tablename, src_curs, dst_curs, column_list, cond_list):
        """Copy only slots needed locally."""
        self.load_bubbles(dst_curs)

        slist = self.bubbles_local_slots.keys()
        fn = 'hashtext(%s)' % skytools.quote_ident(self.key)
        w = "(((%s) & %d) in (%s))" % (fn, self.bubbles_max_slot, slist)
        cond_list.append(w)

        return BaseHandler.real_copy(self, tablename, src_curs, dst_curs,
                                     column_list, cond_list)
開發者ID:cbbrowne,項目名稱:skytools,代碼行數:11,代碼來源:bublin.py

示例11: __init__

    def __init__(self, table_name, args, dest_table):

        # compat for dest-table
        dest_table = args.get('table', dest_table)

        BaseHandler.__init__(self, table_name, args, dest_table)

        # show args
        self.log.debug("dispatch.init: table_name=%r, args=%r", table_name, args)
        self.batch_info = None
        self.dst_curs = None
        self.pkeys = None
        # config
        self.conf = self.get_config()
        hdlr_cls = ROW_HANDLERS[self.conf.row_mode]
        self.row_handler = hdlr_cls(self.log)
        if self.conf.encoding:
            self.encoding_validator = EncodingValidator(self.log,
                                                        self.conf.encoding)
        else:
            self.encoding_validator = None
開發者ID:kitsemets,項目名稱:skytools,代碼行數:21,代碼來源:dispatch.py

示例12: __init__

    def __init__(self, table_name, next, args, log):
        """Init per-batch table data cache."""

        BaseHandler.__init__(self, table_name, next, args, log)

        self.method = DEFAULT_METHOD

        self.pkey_list = None
        self.dist_fields = None
        self.col_list = None

        self.pkey_ev_map = {}

        for a in args:
            k, v = a.split('=')
            if k == 'method':
                m = int(v)
                if m not in (0,1,2):
                    raise Exception('unknown method: %s' % v)
                self.method = int(v)
            else:
                raise Exception('unknown argument: %s' % a)

        self.log.debug('bulk_init(%s), method=%d' % (repr(args), self.method))
開發者ID:famoseagle,項目名稱:skytools,代碼行數:24,代碼來源:bulk.py

示例13: reset

 def reset(self):
     """Called before starting to process a batch.
     Should clean any pending data."""
     BaseHandler.reset(self)
開發者ID:cbbrowne,項目名稱:skytools,代碼行數:4,代碼來源:dispatch.py

示例14: reset

 def reset(self):
     self.pkey_ev_map = {}
     BaseHandler.reset(self)
開發者ID:digideskio,項目名稱:skytools,代碼行數:3,代碼來源:bulk.py

示例15: prepare_batch

 def prepare_batch(self, batch_info, dst_curs):
     """Called on first event for this table in current batch."""
     if not self.bubbles_max_slot:
         self.load_bubbles(dst_curs)
     BaseHandler.prepare_batch(self, batch_info, dst_curs)
開發者ID:mpihlak,項目名稱:skytools-dev,代碼行數:5,代碼來源:bublin.py


注:本文中的londiste.handler.BaseHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。