def reload(self): self.logger.info('Reloading..') package_repository_manager.clear_caches() family_names = list( set(f.name for f in packages.iter_package_families())) self.setRowCount(len(family_names)) family_names.sort(key=lambda x: x.lower()) for row, family_name in enumerate(family_names): self._make_row(row, family_name) self.logger.info(f'{len(family_names)} packages collected.')
def _reset_plugin_manager(cls): # for resetting package_repository type plugins package_repository_manager.clear_caches() package_repository_manager.pool.resource_classes.clear() # for resetting new-style plugins uncache_rezplugins_module_paths() plugin_types = [] for singleton in plugin_manager._plugin_types.values(): plugin_types.append(singleton.instance_class) plugin_manager._plugin_types.clear() for plugin_type in plugin_types: plugin_manager.register_plugin_type(plugin_type) for key in list(sys.modules.keys()): if key.startswith("rezplugins."): del sys.modules[key]
def clear_caches(self, hard=False): """Clear all caches in Rez. Rez caches package contents and iteration during a python session. Thus newly released packages, and changes to existing packages, may not be picked up. You need to clear the cache for these changes to become visible. Args: hard (bool): Perform a 'hard' cache clear. This just means that the memcached cache is also cleared. Generally this is not needed - this option is for debugging purposes. """ from rez.package_repository import package_repository_manager from rez.utils.memcached import memcached_client package_repository_manager.clear_caches() if hard: with memcached_client() as client: client.flush()