当前位置: 首页>>代码示例>>Python>>正文


Python CascadedConsumer.finish_remote_batch方法代码示例

本文整理汇总了Python中pgq.cascade.consumer.CascadedConsumer.finish_remote_batch方法的典型用法代码示例。如果您正苦于以下问题:Python CascadedConsumer.finish_remote_batch方法的具体用法?Python CascadedConsumer.finish_remote_batch怎么用?Python CascadedConsumer.finish_remote_batch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pgq.cascade.consumer.CascadedConsumer的用法示例。


在下文中一共展示了CascadedConsumer.finish_remote_batch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: finish_remote_batch

# 需要导入模块: from pgq.cascade.consumer import CascadedConsumer [as 别名]
# 或者: from pgq.cascade.consumer.CascadedConsumer import finish_remote_batch [as 别名]
    def finish_remote_batch(self, src_db, dst_db, tick_id):
        """Worker-specific cleanup on target node.
        """

        # merge-leaf on branch should not update tick pos
        wst = self._worker_state
        if wst.wait_behind:
            dst_db.commit()
            return

        if self.main_worker:
            st = self._worker_state
            dst_curs = dst_db.cursor()

            self.flush_events(dst_curs)

            # send tick event into queue
            if st.send_tick_event:
                q = "select pgq.insert_event(%s, 'pgq.tick-id', %s, %s, null, null, null)"
                dst_curs.execute(q, [st.target_queue, str(tick_id), self.pgq_queue_name])

        CascadedConsumer.finish_remote_batch(self, src_db, dst_db, tick_id)

        if self.main_worker:
            if st.create_tick:
                # create actual tick
                tick_id = self.batch_info['tick_id']
                tick_time = self.batch_info['batch_end']
                self.create_branch_tick(dst_db, tick_id, tick_time)
开发者ID:digideskio,项目名称:skytools,代码行数:31,代码来源:worker.py

示例2: finish_remote_batch

# 需要导入模块: from pgq.cascade.consumer import CascadedConsumer [as 别名]
# 或者: from pgq.cascade.consumer.CascadedConsumer import finish_remote_batch [as 别名]
    def finish_remote_batch(self, src_db, dst_db, tick_id):
        """Worker-specific cleanup on target node.
        """

        if self.main_worker:
            st = self._worker_state
            dst_curs = dst_db.cursor()

            self.flush_events(dst_curs)

            # send tick event into queue
            if st.send_tick_event:
                q = "select pgq.insert_event(%s, 'pgq.tick-id', %s, %s, null, null, null)"
                dst_curs.execute(q, [st.target_queue, str(tick_id), self.pgq_queue_name])
            if st.create_tick:
                # create actual tick
                tick_id = self._batch_info['tick_id']
                tick_time = self._batch_info['batch_end']
                q = "select pgq.ticker(%s, %s, %s, %s)"
                dst_curs.execute(q, [self.pgq_queue_name, tick_id, tick_time, self.cur_max_id])

        CascadedConsumer.finish_remote_batch(self, src_db, dst_db, tick_id)
开发者ID:priitkustala,项目名称:skytools-dev,代码行数:24,代码来源:worker.py


注:本文中的pgq.cascade.consumer.CascadedConsumer.finish_remote_batch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。