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


Python Task.do_check_artifact_cache方法代码示例

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


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

示例1: check_artifact_cache

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import do_check_artifact_cache [as 别名]
  def check_artifact_cache(self, vts):
    # Special handling for scala analysis files. Class files are retrieved directly into their
    # final locations in the global classes dir.

    def post_process_cached_vts(cached_vts):
      # Merge the localized analysis with the global one (if any).
      analyses_to_merge = []
      for vt in cached_vts:
        for target in vt.targets:
          analysis_file = ScalaCompile._analysis_for_target(self._analysis_tmpdir, target)
          portable_analysis_file = ScalaCompile._portable_analysis_for_target(self._analysis_tmpdir, target)
          if os.path.exists(portable_analysis_file):
            self._zinc_utils.localize_analysis_file(portable_analysis_file, analysis_file)
          if os.path.exists(analysis_file):
            analyses_to_merge.append(analysis_file)

      if len(analyses_to_merge) > 0:
        if os.path.exists(self._analysis_file):
          analyses_to_merge.append(self._analysis_file)
        with contextutil.temporary_dir() as tmpdir:
          tmp_analysis = os.path.join(tmpdir, 'analysis')
          Analysis.merge_from_paths(analyses_to_merge, tmp_analysis)
          shutil.move(tmp_analysis, self._analysis_file)

    self._ensure_analysis_tmpdir()
    return Task.do_check_artifact_cache(self, vts, post_process_cached_vts=post_process_cached_vts)
开发者ID:ssalevan,项目名称:commons,代码行数:28,代码来源:scala_compile.py

示例2: check_artifact_cache

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import do_check_artifact_cache [as 别名]
  def check_artifact_cache(self, vts):
    # Special handling for scala analysis files. Class files are retrieved directly into their
    # final locations in the global classes dir.

    def post_process_cached_vts(cached_vts):
      # Merge the localized analysis with the global one (if any).
      analyses_to_merge = []
      for vt in cached_vts:
        for target in vt.targets:
          analysis_file = ScalaCompile._analysis_for_target(self._analysis_tmpdir, target)
          if os.path.exists(analysis_file):
            analyses_to_merge.append(analysis_file)

      if len(analyses_to_merge) > 0:
        if os.path.exists(self._analysis_file):
          analyses_to_merge.append(self._analysis_file)
        with contextutil.temporary_dir() as tmpdir:
          tmp_analysis = os.path.join(tmpdir, 'analysis')
          if self._zinc_utils.run_zinc_merge(analyses_to_merge, tmp_analysis):
            raise TaskError('Zinc failed to merge cached analysis files.')
          ZincUtils._copy_analysis(tmp_analysis, self._analysis_file)

    self._ensure_analysis_tmpdir()
    return Task.do_check_artifact_cache(self, vts, post_process_cached_vts=post_process_cached_vts)
开发者ID:davearata,项目名称:twitter-commons,代码行数:26,代码来源:scala_compile.py


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