Python google.appengine.ext.db 模块,non_transactional() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用google.appengine.ext.db.non_transactional()

项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def find_all_by_mapreduce_state(cls, mapreduce_state):
    """Find all shard states for given mapreduce.

    Args:
      mapreduce_state: MapreduceState instance

    Yields:
      shard states sorted by shard id.
    """
    keys = cls.calculate_keys_by_mapreduce_state(mapreduce_state)
    i = 0
    while i < len(keys):
      @db.non_transactional
      def no_tx_get(i):
        return db.get(keys[i:i+cls._MAX_STATES_IN_MEMORY])


      states = no_tx_get(i)
      for s in states:
        i += 1
        if s is not None:
          yield s