Blocks allows module-wide configuration values to be set using a YAML configuration file and environment variables. Environment variables override the configuration file which in its turn overrides the defaults.
The configuration is read from ~/.blocksrc if it exists. A custom configuration file can be used by setting the BLOCKS_CONFIG environment variable. A configuration file is of the form:
If a setting is not configured and does not provide a default, a ConfigurationError is raised when it is accessed.
Configuration values can be accessed as attributes of blocks.config.config.
>>> from blocks.config import config >>> print(config.default_seed) 1
The following configurations are supported:
The recursion max depth limit used in MainLoop as well as in other situations when deep recursion is required. The most notable example of such a situation is pickling or unpickling a complex structure with lots of objects, such as a big Theano computation graph.
- profile, BLOCKS_PROFILE¶
A boolean value which determines whether to print profiling information at the end of a call to MainLoop.run().
The backend to use for logging experiments. Defaults to python, which stores the log as a Python object in memory. The other option is sqlite.
- sqlite_database, BLOCKS_SQLITEDB¶
The SQLite database file to use.
The maximum size of an object to store in an SQLite database in bytes. Objects beyond this size will trigger a warning. Defaults to 4 kilobyte.
The directory in which Blocks will create temporary files. If unspecified, the platform-dependent default chosen by the Python tempfile module is used.
- class blocks.config.ConfigurationError¶
Error raised when a configuration value is requested but not set.