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()
def mk_cache(spec, resolver=None): 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, pinger=self.pinger, resolver=resolver) return cache_factory.get_read_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, pinger=MockPinger({ 'host1': 5, 'host2:666': 3, 'host3': 7 })) return cache_factory.get_read_cache()
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()
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()