當前位置: 首頁>>代碼示例>>Python>>正文


Python cache_setup.CacheSetup類代碼示例

本文整理匯總了Python中pants.cache.cache_setup.CacheSetup的典型用法代碼示例。如果您正苦於以下問題:Python CacheSetup類的具體用法?Python CacheSetup怎麽用?Python CacheSetup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CacheSetup類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: mk_cache

 def mk_cache(spec):
   Subsystem.reset()
   self.set_options_for_scope(CacheSetup.subscope(DummyTask.options_scope),
                              read_from=spec, compression=1)
   self.context(for_task_types=[DummyTask])  # Force option initialization.
   cache_factory = CacheSetup.create_cache_factory_for_task(DummyTask)
   return cache_factory.get_read_cache()
開發者ID:Gabriel439,項目名稱:pants,代碼行數:7,代碼來源:test_cache_setup.py

示例2: __init__

  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,代碼行數:28,代碼來源:task.py

示例3: __init__

    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,代碼行數:28,代碼來源:task.py

示例4: subsystem_dependencies

 def subsystem_dependencies(cls):
   # NB: `Goal.Options` implements `SubsystemClientMixin` in order to allow v1 `Tasks` to
   # depend on v2 Goals, and for `Goals` to declare a deprecated dependency on a `CacheSetup`
   # instance for backwards compatibility purposes. But v2 Goals should _not_ have subsystem
   # dependencies: instead, the @rules participating (transitively) in a Goal should directly
   # declare their Subsystem deps.
   if outer_cls.deprecated_cache_setup_removal_version:
     dep = CacheSetup.scoped(
         cls,
         removal_version=outer_cls.deprecated_cache_setup_removal_version,
         removal_hint='Goal `{}` uses an independent caching implementation, and ignores `{}`.'.format(
           cls.options_scope,
           CacheSetup.subscope(cls.options_scope),
         )
       )
     return (dep,)
   return tuple()
開發者ID:cosmicexplorer,項目名稱:pants,代碼行數:17,代碼來源:goal.py

示例5: __init__

  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._task_name = type(self).__name__
    self._cache_key_errors = set()
    self._cache_factory = CacheSetup.create_cache_factory_for_task(self)
    self._force_invalidated = False
開發者ID:cosmicexplorer,項目名稱:pants,代碼行數:22,代碼來源:task.py

示例6: subsystem_dependencies

 def subsystem_dependencies(cls):
   return super(TaskBase, cls).subsystem_dependencies() + (CacheSetup.scoped(cls),)
開發者ID:wonlay,項目名稱:pants,代碼行數:2,代碼來源:task.py

示例7: subsystem_dependencies

 def subsystem_dependencies(cls):
   return (super(TaskBase, cls).subsystem_dependencies() +
           (CacheSetup.scoped(cls), BuildInvalidator.Factory, SourceRootConfig) +
           ((TargetFilter.scoped(cls),) if cls.target_filtering_enabled else tuple()))
開發者ID:cosmicexplorer,項目名稱:pants,代碼行數:4,代碼來源:task.py

示例8: subsystem_dependencies

 def subsystem_dependencies(cls):
   return (super(TaskBase, cls).subsystem_dependencies() +
           (CacheSetup.scoped(cls), BuildInvalidator.Factory, SourceRootConfig))
開發者ID:baroquebobcat,項目名稱:pants,代碼行數:3,代碼來源:task.py

示例9: subsystem_dependencies

 def subsystem_dependencies(cls):
   return super(TaskBase, cls).subsystem_dependencies() + (CacheSetup.scoped(cls),
                                                           BuildInvalidator.Factory)
開發者ID:grimreaper,項目名稱:pants,代碼行數:3,代碼來源:task.py


注:本文中的pants.cache.cache_setup.CacheSetup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。