conf.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码
def _fetch_latest_from_datastore(app_version):
  """Get the latest configuration data for this app-version from the datastore.

  Args:
    app_version: the major version you want configuration data for.

  Side Effects:
    We populate memcache with whatever we find in the datastore.

  Returns:
    A config class instance for most recently set options or None if the
    query could not complete due to a datastore exception.
  """





  rpc = db.create_rpc(deadline=DATASTORE_DEADLINE,
                      read_policy=db.EVENTUAL_CONSISTENCY)
  key = _get_active_config_key(app_version)
  config = None
  try:
    config = Config.get(key, rpc=rpc)
    logging.debug('Loaded most recent conf data from datastore.')
  except:
    logging.warning('Tried but failed to fetch latest conf data from the '
                    'datastore.')

  if config:
    memcache.set(app_version, db.model_to_protobuf(config).Encode(),
                 namespace=NAMESPACE)
    logging.debug('Wrote most recent conf data into memcache.')

  return config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号