resource_manager¶
Bindings for basic::resource_manager namespace
- class pyrosetta.rosetta.basic.resource_manager.ResourceLoader¶
Bases:
pybind11_object
The ResourceLoader is responsible for instantiating a Resource object and initializing it. In order to do so, the ResourceLoader is given an input stream and a XML “Tag” object. The ResourceLoader can also request other Resources from the ResourceManager in trying to construct a particular resource.
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoader, : pyrosetta.rosetta.basic.resource_manager.ResourceLoader) pyrosetta.rosetta.basic.resource_manager.ResourceLoader ¶
C++: basic::resource_manager::ResourceLoader::operator=(const class basic::resource_manager::ResourceLoader &) –> class basic::resource_manager::ResourceLoader &
- class pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator¶
Bases:
pybind11_object
Instantiates a ResourceLoader as part of the ResourceLoaderFactory scheme. Derived classes should be registered with the ResourceLoaderFactory in one of the library init.cc files with a ResourceLoaderRegistrator
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator, : pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator) pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator ¶
C++: basic::resource_manager::ResourceLoaderCreator::operator=(const class basic::resource_manager::ResourceLoaderCreator &) –> class basic::resource_manager::ResourceLoaderCreator &
- create_resource_loader(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator) pyrosetta.rosetta.basic.resource_manager.ResourceLoader ¶
Instantiate a ResourceLoader
C++: basic::resource_manager::ResourceLoaderCreator::create_resource_loader() const –> class std::shared_ptr<class basic::resource_manager::ResourceLoader>
- loader_type(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator) str ¶
Give the name of the ResourceLoader that this Creator will instantiate.
C++: basic::resource_manager::ResourceLoaderCreator::loader_type() const –> std::string
- class pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory¶
Bases:
SingletonBase_basic_resource_manager_ResourceLoaderFactory_t
Instantiates ResourceLoaders. Creators may be registered with the Factory at any point, though it is recommended they be registered at load time. If two Creators are registered and they both give the same name for the ResourceLoader they say they will instantiate, then the Factory will exit with an error message.
- available_resource_loaders(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory) pyrosetta.rosetta.std.list_std_string_t ¶
Return a list of all the resource loaders available
C++: basic::resource_manager::ResourceLoaderFactory::available_resource_loaders() const –> class std::list<std::string, class std::allocator<std::string > >
- static complex_type_name_for_loader(loader_name: str) str ¶
- The name mangling function used by ResourceLoaders when they define their complexTypes
in the XML Schema.
C++: basic::resource_manager::ResourceLoaderFactory::complex_type_name_for_loader(const std::string &) –> std::string
- create_resource_loader(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory, loader_type: str) pyrosetta.rosetta.basic.resource_manager.ResourceLoader ¶
- Instantiates a resource loader ofa given type; throws
an exception if no loader with this type has been previously registered.
C++: basic::resource_manager::ResourceLoaderFactory::create_resource_loader(const std::string &) const –> class std::shared_ptr<class basic::resource_manager::ResourceLoader>
- factory_register(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory, creator: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderCreator) None ¶
- Register a ResourceLoaderCreator with the factory. The factory
asks the Creator for the name of the ResourceLoader that it will create; if another Creator has already registered with the factory that proports to instantiate another ResourceLoader with the same name, then it will exit with an error message, or, if set_throw_on_double_registration() has previously been called, throw an exception.
C++: basic::resource_manager::ResourceLoaderFactory::factory_register(class std::shared_ptr<class basic::resource_manager::ResourceLoaderCreator>) –> void
- static get_instance() basic::resource_manager::ResourceLoaderFactory ¶
C++: utility::SingletonBase<basic::resource_manager::ResourceLoaderFactory>::get_instance() –> class basic::resource_manager::ResourceLoaderFactory *
- has_resource_loader(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory, loader_type: str) bool ¶
- Returns true if a resource loader of the given type has been
registered with the factory
C++: basic::resource_manager::ResourceLoaderFactory::has_resource_loader(const std::string &) const –> bool
- loader_map(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory) pyrosetta.rosetta.std.map_std_string_std_shared_ptr_basic_resource_manager_ResourceLoaderCreator_t_std_allocator_std_pair_const_std_string_std_shared_ptr_basic_resource_manager_ResourceLoaderCreator_t ¶
- Read access to the set of creators that the factry holds; used to create the
schema definition for the ResourceManager.
C++: basic::resource_manager::ResourceLoaderFactory::loader_map() const –> const class std::map<std::string, class std::shared_ptr<class basic::resource_manager::ResourceLoaderCreator>, struct std::less<std::string >, class std::allocator<struct std::pair<const std::string, class std::shared_ptr<class basic::resource_manager::ResourceLoaderCreator> > > > &
- set_throw_on_double_registration(self: pyrosetta.rosetta.basic.resource_manager.ResourceLoaderFactory) None ¶
- Only useful for unit testing. Since factory registration happens (sometimes) at
load time, there may be no one to catch a thrown exception in the event of a name collision
C++: basic::resource_manager::ResourceLoaderFactory::set_throw_on_double_registration() –> void
- class pyrosetta.rosetta.basic.resource_manager.ResourceLocator¶
Bases:
pybind11_object
%ResourceLocator classes are responsible for retrieving data from a data store that will be used to construct a Resource. This data store could be a file system or a database or any other place where data is stored.
The ResourceManager asks the ResourceLocator to produce a ResourceStream object when given a “locator_id.” A “locator_id” is what’s needed to identify a data source from a data store: for example, for the FileSystemResourceLocator, the locator id is a file name; for the DatabaseResourceLocator, it would be a database query.
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator, : pyrosetta.rosetta.basic.resource_manager.ResourceLocator) pyrosetta.rosetta.basic.resource_manager.ResourceLocator ¶
C++: basic::resource_manager::ResourceLocator::operator=(const class basic::resource_manager::ResourceLocator &) –> class basic::resource_manager::ResourceLocator &
- locate_resource_stream(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator, locator_id: str) pyrosetta.rosetta.basic.resource_manager.ResourceStream ¶
- Create and return a ResourceStream object from the given locator_id
so that its stream can be passed to the ResourceLoader
C++: basic::resource_manager::ResourceLocator::locate_resource_stream(const std::string &) const –> class std::shared_ptr<class basic::resource_manager::ResourceStream>
- locator_tag(*args, **kwargs)¶
Overloaded function.
locator_tag(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator, locator_tag: str) -> None
Set the name for this %ResourceLocator
C++: basic::resource_manager::ResourceLocator::locator_tag(const std::string &) –> void
locator_tag(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator) -> str
Return the name for this %ResourceLocator
C++: basic::resource_manager::ResourceLocator::locator_tag() const –> std::string
- parse_my_tag(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator, tag: utility::tag::Tag) None ¶
- Initialize the parameters for this %ResourceLocator from the contents of
an XML file.
C++: basic::resource_manager::ResourceLocator::parse_my_tag(class std::shared_ptr<const class utility::tag::Tag>) –> void
- show(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator, out: pyrosetta.rosetta.std.ostream) None ¶
Write a description of this %ResourceLocator to an out stream
C++: basic::resource_manager::ResourceLocator::show(std::ostream &) const –> void
- type(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocator) str ¶
- Return the class name for this %ResourceLocator instance.
This function allows for better error message delivery.
C++: basic::resource_manager::ResourceLocator::type() const –> std::string
- class pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator¶
Bases:
pybind11_object
The %ResourceLocatorCreator class serves to link the name of a locator type and the (derived) ResourceLocator class that’s responsible for retrieving data from a data store.
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator, : pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator) pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator ¶
C++: basic::resource_manager::ResourceLocatorCreator::operator=(const class basic::resource_manager::ResourceLocatorCreator &) –> class basic::resource_manager::ResourceLocatorCreator &
- create_resource_locator(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator) pyrosetta.rosetta.basic.resource_manager.ResourceLocator ¶
C++: basic::resource_manager::ResourceLocatorCreator::create_resource_locator() const –> class std::shared_ptr<class basic::resource_manager::ResourceLocator>
- locator_type(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator) str ¶
C++: basic::resource_manager::ResourceLocatorCreator::locator_type() const –> std::string
- class pyrosetta.rosetta.basic.resource_manager.ResourceLocatorFactory¶
Bases:
SingletonBase_basic_resource_manager_ResourceLocatorFactory_t
The %ResourceLocatorFactory instantiates ResourceLocator objects given their corresponding locator-type strings. It uses the load-time factory registration scheme, meaning that it is a singleton and takes an instance of a Creator object (a ResourceLocatorCreator) in its “factory_register” method. Templated instances of the ResourceLocatorRegistrator classes should be placed in the library init.cc files (e.g. core/init/init.cc or protocols/init/init.ResourceLocatorRegistrators.ihh)
- static complex_type_name_for_locator(locator_name: str) str ¶
C++: basic::resource_manager::ResourceLocatorFactory::complex_type_name_for_locator(const std::string &) –> std::string
- create_resource_locator(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorFactory, locator_type: str, locator_tag: str, tags: utility::tag::Tag) pyrosetta.rosetta.basic.resource_manager.ResourceLocator ¶
Create a ResourceLocator given its locator_type, giving the newly created instance the name locator_tag
C++: basic::resource_manager::ResourceLocatorFactory::create_resource_locator(const std::string &, const std::string &, class std::shared_ptr<const class utility::tag::Tag>) const –> class std::shared_ptr<class basic::resource_manager::ResourceLocator>
- factory_register(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorFactory, creator: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorCreator) None ¶
- This function is called on the singleton instance to give a ResourceLocatorCreator to the
factory, usually through the constructor of a ResourceLocatorRegistrator class.
C++: basic::resource_manager::ResourceLocatorFactory::factory_register(class std::shared_ptr<class basic::resource_manager::ResourceLocatorCreator>) –> void
- static get_instance() basic::resource_manager::ResourceLocatorFactory ¶
C++: utility::SingletonBase<basic::resource_manager::ResourceLocatorFactory>::get_instance() –> class basic::resource_manager::ResourceLocatorFactory *
- locator_map(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorFactory) pyrosetta.rosetta.std.map_std_string_std_shared_ptr_basic_resource_manager_ResourceLocatorCreator_t_std_allocator_std_pair_const_std_string_std_shared_ptr_basic_resource_manager_ResourceLocatorCreator_t ¶
C++: basic::resource_manager::ResourceLocatorFactory::locator_map() const –> const class std::map<std::string, class std::shared_ptr<class basic::resource_manager::ResourceLocatorCreator>, struct std::less<std::string >, class std::allocator<struct std::pair<const std::string, class std::shared_ptr<class basic::resource_manager::ResourceLocatorCreator> > > > &
- set_throw_on_double_registration(self: pyrosetta.rosetta.basic.resource_manager.ResourceLocatorFactory) None ¶
- Only useful for unit testing. Since factory registration happens (sometimes) at
load time, there may be no one to catch a thrown exception in the event of a name collision between two ResourceLocatorCreators that register for the same name.
C++: basic::resource_manager::ResourceLocatorFactory::set_throw_on_double_registration() –> void
- class pyrosetta.rosetta.basic.resource_manager.ResourceManager¶
Bases:
pybind11_object
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager, : pyrosetta.rosetta.basic.resource_manager.ResourceManager) pyrosetta.rosetta.basic.resource_manager.ResourceManager ¶
C++: basic::resource_manager::ResourceManager::operator=(const class basic::resource_manager::ResourceManager &) –> class basic::resource_manager::ResourceManager &
- clear(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager) None ¶
- Delete all stored data, including all information about how to construct
not-yet-constructed resources.
C++: basic::resource_manager::ResourceManager::clear() –> void
- static complex_type_name_for_resource_def(element_name: str) str ¶
- The name mangling function for the top-level elements of the <ResourceDefinitions>
tag in the resource-definition file.
C++: basic::resource_manager::ResourceManager::complex_type_name_for_resource_def(const std::string &) –> std::string
- deallocate_resource(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager, resource_name: str) None ¶
- When a resource no longer needs to be held in memory, it may be
deallocated. If the resource has not been allocated, this function simply returns (without throwing an exception).
C++: basic::resource_manager::ResourceManager::deallocate_resource(const std::string &) –> void
- has_resource(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager, resource_name: str) bool ¶
Has a particular resource been declared?
C++: basic::resource_manager::ResourceManager::has_resource(const std::string &) const –> bool
- has_resource_in_memory(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager, resource_name: str) bool ¶
- Does a particular resource currently reside in memory? Mostly this
function is for testing purposes.
C++: basic::resource_manager::ResourceManager::has_resource_in_memory(const std::string &) const –> bool
- initialize_from_commandline(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager) None ¶
- Read all of the resource definition files specified on the command line
from the “-resource_definitions <fname1> <fname2>… ” flag.
C++: basic::resource_manager::ResourceManager::initialize_from_commandline() –> void
- n_resources_declared(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager) int ¶
How many resource definitions were read into the %ResourceManager?
C++: basic::resource_manager::ResourceManager::n_resources_declared() const –> unsigned long
- n_resources_in_memory(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager) int ¶
How many resources are currently being held by the %ResourceManager?
C++: basic::resource_manager::ResourceManager::n_resources_in_memory() const –> unsigned long
- read_resources_from_xml(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager, filename: str, input_xml: str) None ¶
- The ResourceManager will take the input stream and
parse it as an XML document. Then it will read the ResourceLocators and Resouces tags out of this stream. Multiple streams may be read this way, though, if two streams try and declare the locators or resources that have the same name, then the ResourceManager will throw an exception
C++: basic::resource_manager::ResourceManager::read_resources_from_xml(const std::string &, const std::string &) –> void
- resources_that_have_been_declared(self: pyrosetta.rosetta.basic.resource_manager.ResourceManager) pyrosetta.rosetta.std.list_std_string_t ¶
Return a list of all of the resources that have been declared.
C++: basic::resource_manager::ResourceManager::resources_that_have_been_declared() const –> class std::list<std::string, class std::allocator<std::string > >
- static schema_for_resource_definition_file() str ¶
- Construct the XML Schema for all of the various resource types that can be
loaded using the ResourceManager using all of the various input-stream-fetching techniques (i.e. file on disk vs database query).
C++: basic::resource_manager::ResourceManager::schema_for_resource_definition_file() –> std::string
- class pyrosetta.rosetta.basic.resource_manager.ResourceManagerCreator¶
Bases:
pybind11_object
Derived classes will be used by the ResourceManagerFactory to decide which of the various ResourceManagers should be instantiated. The ResourceManager is a singleton, but, different ResourceManagers can be instantiated in different contexts.
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceManagerCreator, : pyrosetta.rosetta.basic.resource_manager.ResourceManagerCreator) pyrosetta.rosetta.basic.resource_manager.ResourceManagerCreator ¶
C++: basic::resource_manager::ResourceManagerCreator::operator=(const class basic::resource_manager::ResourceManagerCreator &) –> class basic::resource_manager::ResourceManagerCreator &
- class pyrosetta.rosetta.basic.resource_manager.ResourceManagerFactory¶
Bases:
SingletonBase_basic_resource_manager_ResourceManagerFactory_t
A factory class for managing the instantiation of the singleton ResourceManager: only one of the various derived classes will be instantiated. Currently, it asks for the JD2ResourceManager; in the future, this should be fixed so that it reads from the options system to figure out which ResourceManager to instantiate.
- create_resource_manager_from_options_system(self: pyrosetta.rosetta.basic.resource_manager.ResourceManagerFactory) pyrosetta.rosetta.basic.resource_manager.ResourceManager ¶
Should only be called by the ResourceManager in its singleton construction!
C++: basic::resource_manager::ResourceManagerFactory::create_resource_manager_from_options_system() const –> class basic::resource_manager::ResourceManager *
- factory_register(self: pyrosetta.rosetta.basic.resource_manager.ResourceManagerFactory, creator: pyrosetta.rosetta.basic.resource_manager.ResourceManagerCreator) None ¶
C++: basic::resource_manager::ResourceManagerFactory::factory_register(class std::shared_ptr<class basic::resource_manager::ResourceManagerCreator>) –> void
- static get_instance() basic::resource_manager::ResourceManagerFactory ¶
C++: utility::SingletonBase<basic::resource_manager::ResourceManagerFactory>::get_instance() –> class basic::resource_manager::ResourceManagerFactory *
- class pyrosetta.rosetta.basic.resource_manager.ResourceStream¶
Bases:
pybind11_object
The %ResourceStream represents an abstract class for packaging up a standard istream so that data that the ResourceLocator needs to deliver to a ResourceLoader can come from arbitrary sources (e.g. from either a file or from a database).
- assign(self: pyrosetta.rosetta.basic.resource_manager.ResourceStream, : pyrosetta.rosetta.basic.resource_manager.ResourceStream) pyrosetta.rosetta.basic.resource_manager.ResourceStream ¶
C++: basic::resource_manager::ResourceStream::operator=(const class basic::resource_manager::ResourceStream &) –> class basic::resource_manager::ResourceStream &
- stream(self: pyrosetta.rosetta.basic.resource_manager.ResourceStream) pyrosetta.rosetta.std.istream ¶
- Return an istream reference so that the ResourceLoader can access arbitrary data
returned by the %ResourceLocator
C++: basic::resource_manager::ResourceStream::stream() –> std::istream &
- pyrosetta.rosetta.basic.resource_manager.resource_loader_xsd_type_definition_w_attributes(xsd: utility::tag::XMLSchemaDefinition, loader_type: str, description: str, attributes: pyrosetta.rosetta.std.list_utility_tag_XMLSchemaAttribute_t) None ¶
- Define the XML schema definition for a ResourceLoader that
contains no subtags but may contain any number of attributes (aka options).
C++: basic::resource_manager::resource_loader_xsd_type_definition_w_attributes(class utility::tag::XMLSchemaDefinition &, const std::string &, const std::string &, const class std::list<class utility::tag::XMLSchemaAttribute, class std::allocator<class utility::tag::XMLSchemaAttribute> > &) –> void
- pyrosetta.rosetta.basic.resource_manager.resource_loader_xsd_type_definition_w_attributes_and_repeatable_subelements(xsd: utility::tag::XMLSchemaDefinition, loader_type: str, description: str, attributes: pyrosetta.rosetta.std.list_utility_tag_XMLSchemaAttribute_t, subelements: utility::tag::XMLSchemaSimpleSubelementList) None ¶
- Define the XML schema definition for a ResourceLoader that
contains subtags and attributes (aka options).
C++: basic::resource_manager::resource_loader_xsd_type_definition_w_attributes_and_repeatable_subelements(class utility::tag::XMLSchemaDefinition &, const std::string &, const std::string &, const class std::list<class utility::tag::XMLSchemaAttribute, class std::allocator<class utility::tag::XMLSchemaAttribute> > &, const class utility::tag::XMLSchemaSimpleSubelementList &) –> void