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


Python E.rmall方法代码示例

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


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

示例1: DeleteFiles

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import rmall [as 别名]
  def DeleteFiles(self):
    # nothing to do?
    if not self.default_files_var:
      return 1

    machines = self.config.var('MACHINES')

    defaults = self.config.var(self.default_files_var)

    # build a list of files from the defaults
    fileParamList = []
    for param in defaults.keys():
      var_path = (self.base_map_var, self.name, param)
      if self.config.has_var(var_path) and self.config.var(var_path) != None:
        fileParamList.append(var_path)

    # get a list of config dirs
    dirList = self.GetDirList()

    success = 1

    # remove the files on all machines
    for fileParam in fileParamList:
      success = self.config.del_file_var_content(fileParam) and success

    # remove the directories on all machines
    if len(dirList) > 0:
      success = E.rmall(machines, string.join(dirList, " ")) and success

    return success
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:32,代码来源:ent_collection.py

示例2: sanitizeMap

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import rmall [as 别名]
  def sanitizeMap(self, partition_dir, apache_dir, click_dir):
    """Sanitize the map and remove unused directories due to abandoned
    collections. Note that this is a little bit expensive, so it should
    not be called liberally. collect_logs cron job is the only caller
    right now.
    Return true if this has made some changes in the map."""

    removed_dirs = {}
    for dirname in self.dirnames:
      partitioned_subdir = os.path.join(partition_dir, dirname)
      apache_subdir = os.path.join(apache_dir, dirname)
      click_subdir = os.path.join(click_dir, dirname)

      if os.path.exists(partitioned_subdir) and \
         not self.hasFileInSubdirs(partitioned_subdir):
        E.rmall([E.LOCALHOST], partitioned_subdir)

      if os.path.exists(apache_subdir) and \
         not self.hasFileInSubdirs(apache_subdir):
        E.rmall([E.LOCALHOST], apache_subdir)

      if os.path.exists(click_subdir) and \
         not self.hasFileInSubdirs(click_subdir):
        E.rmall([E.LOCALHOST], click_subdir)

      if not os.path.exists(apache_subdir) and \
         not os.path.exists(click_subdir) and \
         not os.path.exists(partitioned_subdir):
        removed_dirs[dirname] = 1
        logging.info("Remove directory: %s" % dirname)

    for coll in self.collection_dir_map.keys():
      dirlist = self.collection_dir_map[coll]
      for i in range(len(dirlist) - 1, -1, -1):
        if removed_dirs.has_key(dirlist[i]):
          del dirlist[i]
      if len(dirlist) == 0:
        del self.collection_dir_map[coll]
        logging.info("Remove collection: %s" % coll)

    if removed_dirs:
      self.changed = true
    return self.changed
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:45,代码来源:liblog.py


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