Exceptions for File Storage layer.
Bases: tvb.basic.exceptions.TVBException
Exception to be thrown in case of an unexpected problem when migrating an H5 file to a newer version.
Bases: tvb.basic.exceptions.TVBException
Generic exception when storing in data in files.
Bases: tvb.basic.exceptions.TVBException
Exception to be thrown in case of a problem related to File Structure Storage.
Bases: tvb.basic.exceptions.TVBException
A base exception class for all TVB file storage version conversion custom exceptions.
Bases: tvb.core.entities.file.exceptions.FileVersioningException
Exception that should be raised in case a file is handled by some filemanager which is incompatible with that version of TVB file storage.
Bases: tvb.core.entities.file.exceptions.FileStorageException
Exception when the file associated to some manager does not exist on disk for some reason.
Bases: tvb.core.entities.file.exceptions.FileStorageException
Exception when a dataset is accessed, but no written entry exists in HDF5 file for it. we will consider the attribute None.
Bases: tvb.core.entities.file.exceptions.FileMigrationException
Exception to be thrown in case of an unexpected problem when migrating an H5 file to a newer version.
Bases: builtins.object
This class manages all Structure related operations, using File storage. It will handle creating meaning-full entities and retrieving existent ones.
Computes the disk usage of all h5 files under the given directory. :param start_path: :return: A tuple of size in kiB
Given a file’s path, return size occupied on disk by that file. Size should be a number, representing size in KB.
Copy a file from source to dest. source and dest can either be strings or any object with a read or write method, like StringIO for example.
Parameters: | full_path – Absolute full path |
---|---|
Root_path: | find relative path from param full_path to this root. |
Computes the name/path of the folder where to store images.
Computes the folder where operation details are stored
Retrieve the root path for the given project. If root folder is not created yet, will create it.
Retrieve project meta info file path.
Returns: | File path for storing Project meta-data File might not exist yet, but parent folder is created after this method call. |
---|
Move H5 storage into a new location
Delegate reading of some XML content. Will parse the XMl and return a dictionary of elements with max 2 levels.
Parameters: |
|
---|
Given a folder path, try to remove that folder from disk. :param ignore_errors: When False throw FileStructureException if folder_path is invalid.
Remove all folders for project or THROW FileStructureException.
Rename Project folder or THROW FileStructureException.
Simple method to unpack ZIP archive in a given folder.
Parameters: | project – Project instance, to get metadata from it. |
---|
This method creates a ZIP file with all files provided as parameters :param zip_full_path: full path and name of the result ZIP file :param files: array with the FULL names/path of the files to add into ZIP
Manager for the file storage version updates.
Bases: tvb.core.code_versions.base_classes.UpdateManager
Manager for updating H5 files version, when code gets changed.
Return the data version for the given file.
Parameters: | file_path – the path on disk to the file for which you need the TVB data version |
---|---|
Returns: | a number representing the data version for which the input file was written |
Returns True only if the data version of the file is equal with the data version specified into the TVB configuration file.
Upgrades all the data types from TVB storage to the latest data version.
Returns: | a two entry tuple (status, message) where status is a boolean that is True in case the upgrade was successfully for all DataTypes and False otherwise, and message is a status update message. |
---|
Upgrades the given file to the latest data version. The file will be upgraded sequentially, up until the current version from tvb.basic.config.settings.VersionSettings.DB_STRUCTURE_VERSION
:param input_file_name the path to the file which needs to be upgraded :return True when update was successful and False when it resulted in an error.
Persistence of data in HDF5 format.
Bases: builtins.object
This class is responsible for saving / loading data in HDF5 file / format.
Bases: builtins.object
Helper class in order to buffer data for append operations, to limit the number of actual HDD I/O operations.
This method appends data to an existing data set. If the data set does not exists, create it first.
Parameters: |
|
---|
The synchronization of open/close doesn’t seem to be needed anymore for h5py in contrast to PyTables for concurrent reads. However since it shouldn’t add that much overhead in most situation we’ll leave it like this for now since in case of concurrent writes(metadata) this provides extra safety.
This method reads data from the given data set based on the slice specification
Parameters: |
|
---|---|
Returns: | a numpy.ndarray containing filtered data |
This method reads data-size from the given data set
Parameters: |
|
---|---|
Returns: | a tuple containing data size |
Used for obtaining the gid of the DataType of which data are stored in the current file.
Retrieve ALL meta-data information for root node or for a given data set.
Parameters: |
|
---|---|
Returns: | a dictionary containing all metadata associated with the node |
This method checks if specified file exists and if it has correct HDF5 format :returns: True is file exists and has HDF5 format. False otherwise.
Deleting a data set from H5 file.
:param dataset_name:name of the data set to be deleted :param where: represents the path where dataset is stored (e.g. /data/info)
Remove meta-data information for root node or for a given data set.
Parameters: |
|
---|
Set meta-data information for root node or for a given data set.
Parameters: |
|
---|
This method stores provided data list into a data set in the H5 file.
Parameters: |
|
---|
This module contains logic for meta-data handling.
It handles read/write operations in XML files for retrieving/storing meta-data. More specific: it contains XML Reader/Writer Utility, for GenericMetaData.
Bases: builtins.object
Reader for XML with meta-data on generic entities (e.g. Project, Operation).
Parameters: | xml_data – String representing an XML root. |
---|---|
Returns: | Dictionary with text-content read from the given XML. |