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


Python CacheSetup.create_cache_factory_for_task方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pants.cache.cache_setup import CacheSetup [as 别名]
# 或者: from pants.cache.cache_setup.CacheSetup import create_cache_factory_for_task [as 别名]
  def __init__(self, context, workdir):
    """Subclass __init__ methods, if defined, *must* follow this idiom:

    class MyTask(Task):
      def __init__(self, *args, **kwargs):
        super(MyTask, self).__init__(*args, **kwargs)
        ...

    This allows us to change Task.__init__()'s arguments without
    changing every subclass. If the subclass does not need its own
    initialization, this method can (and should) be omitted entirely.

    :API: public
    """
    super(TaskBase, self).__init__()
    self.context = context
    self._workdir = workdir

    self._cache_key_errors = set()

    self._build_invalidator_dir = os.path.join(
      self.context.options.for_global_scope().pants_workdir,
      'build_invalidator',
      self.stable_name())

    self._cache_factory = CacheSetup.create_cache_factory_for_task(self)

    self._options_fingerprinter = OptionsFingerprinter(self.context.build_graph)
开发者ID:wonlay,项目名称:pants,代码行数:30,代码来源:task.py

示例2: __init__

# 需要导入模块: from pants.cache.cache_setup import CacheSetup [as 别名]
# 或者: from pants.cache.cache_setup.CacheSetup import create_cache_factory_for_task [as 别名]
    def __init__(self, context, workdir):
        """Subclass __init__ methods, if defined, *must* follow this idiom:

    class MyTask(Task):
      def __init__(self, *args, **kwargs):
        super(MyTask, self).__init__(*args, **kwargs)
        ...

    This allows us to change Task.__init__()'s arguments without
    changing every subclass. If the subclass does not need its own
    initialization, this method can (and should) be omitted entirely.
    """
        super(TaskBase, self).__init__()
        self.context = context
        self._workdir = workdir
        # TODO: It would be nice to use self.get_options().cache_key_gen_version here, because then
        # we could have a separate value for each scope if we really wanted to. However we can't
        # access per-task options in Task.__init__ because GroupTask.__init__ calls it with the
        # group task's scope, which isn't currently in the known scopes we generate options for.
        self._cache_key_generator = CacheKeyGenerator(self.context.options.for_global_scope().cache_key_gen_version)

        self._cache_key_errors = set()

        self._build_invalidator_dir = os.path.join(
            self.context.options.for_global_scope().pants_workdir, "build_invalidator", self.stable_name()
        )

        self._cache_factory = CacheSetup.create_cache_factory_for_task(self)
开发者ID:qiaohaijun,项目名称:pants,代码行数:30,代码来源:task.py


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