本文整理汇总了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)
示例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)