storage Package

storage_interface

This module is an interface for the tvb storage module. All calls to methods from this module must be done through this class.

class tvb.storage.storage_interface.StorageInterface[source]

Bases: object

EXPORTED_SIMULATION_DTS_DIR = 'datatypes'
EXPORTED_SIMULATION_NAME = 'exported_simulation'
EXPORT_FOLDER = '/home/tvb_user/TVB_STORAGE/EXPORT_TMP'
EXPORT_FOLDER_NAME = 'EXPORT_TMP'
FILE_NAME_STRUCTURE = '{}_{}.h5'
IMAGES_FOLDER = 'IMAGES'
OPERATION_FOLDER_PREFIX = 'Operation_'
PROJECTS_FOLDER = 'PROJECTS'
ROOT_NODE_PATH = '/'
TEMP_FOLDER = 'TEMP'
TVB_PROJECT_FILE = 'Project.xml'
TVB_STORAGE_FILE_EXTENSION = '.h5'
TVB_XML_FILE_EXTENSION = '.xml'
TVB_ZIP_FILE_EXTENSION = '.zip'
static app_encryption_handler()[source]
check_and_delete(folder)[source]
check_created(path='/home/tvb_user/TVB_STORAGE/')[source]
static compute_recursive_h5_disk_usage(start_path='.')[source]
static compute_size_on_disk(file_path)[source]
static copy_file(source, dest, dest_postfix=None, buffer_size=1048576)[source]
dec_running_op_count(folder)[source]
static encryption_enabled()[source]
ends_with_tvb_file_extension(file)[source]
ends_with_tvb_storage_file_extension(file)[source]
export_datatype_from_rest_server(dt, data, download_file_name, public_key_path)[source]
export_datatypes(dt_path_list, data, download_file_name, public_key_path=None, password=None)[source]

This method is used to export a list of datatypes as a ZIP file. :param dt_path_list: a list of paths to be exported (there are more than one when exporting with links) :param data: data to be exported :param download_file_name: name of the zip file to be downloaded :param public_key_path: path to public key that will be used for encrypting the password by TVB :param password: password used for encrypting the files before exporting

export_datatypes_structure(op_file_dict, data, download_file_name, public_key_path, password, links_tuple_for_copy=None)[source]

This method is used to export a list of datatypes as a ZIP file, while preserving the folder structure (eg: operation folders). It is only used during normal tvb exporting for datatype groups. :param op_file_dict: a dictionary where keys are operation folders and the values are lists of files inside

that operation folder

Parameters:
  • data – data to be exported

  • download_file_name – name of the ZIP file to be exported

  • public_key_path – path to public key that will be used for encrypting the password by TVB

  • password – password used for encrypting the files before exporting

  • links_tuple_for_copy – a tuple containing two elements: a list of paths to be copied and the first datatype of the group

export_project(project, folders_to_exclude, linked_paths, op)[source]

This method is used to export a project as a ZIP file. :param project: project to be exported. :param folders_to_exclude: a list of paths to folders inside of a project folder which should not be exported. :param linked_paths: a list of links to datatypes for the project to be exported :param op: operation for links to exported datatypes (if any)

export_simulator_configuration(burst, all_view_model_paths, all_datatype_paths, zip_filename)[source]

This method is used to export a simulator configuration as a ZIP file :param burst: BurstConfiguration of the simulation to be exported :param all_view_model_paths: a list of paths to all view model files of the simulation :param all_datatype_paths: a list of paths to all datatype files of the simulation :param zip_filename: name of the file to be exported

get_allen_mouse_cache_folder(project_name)[source]
static get_encryption_handler(dir_gid)[source]
get_filename(class_name, gid)[source]
get_filenames_in_zip(dest_path, mode='r')[source]
get_images_folder(project_name)[source]
static get_import_export_encryption_handler()[source]
get_project_folder(project_name, *sub_folders)[source]
get_project_meta_file_path(project_name)[source]
static get_projects_folder()[source]
static get_storage_manager(file_full_path)[source]
get_temp_folder(project_name)[source]
get_tumor_dataset_folder()[source]
import_datatype_to_rest_client(file_path, temp_folder, private_key_path)[source]
inc_project_usage_count(folder)[source]
inc_running_op_count(folder)[source]
is_in_usage(project_folder)[source]
join()[source]
logger = <Logger tvb.storage.storage_interface (INFO)>
mark_stop()[source]
move_datatype_with_sync(to_project, to_project_path, new_op_id, path_list)[source]
open_tvb_zip(dest_path, name, mode='r')[source]
path_by_dir(base_dir, h5_file_class, gid, dt_class)[source]
path_for(op_id, h5_file_class, gid, project_name, dt_class)[source]
prepare_encryption(project_name)[source]
push_folder_to_sync(project_name)[source]
read_metadata_from_xml(xml_path)[source]
read_project_metadata(project_path)[source]
remove_figure(figure)[source]
static remove_files(file_list, ignore_exception=False)[source]
static remove_folder(folder_path, ignore_errors=False)[source]
remove_operation_data(project_name, operation_id)[source]
remove_project(project, sync_for_encryption=False)[source]
rename_project(current_proj_name, new_name)[source]
run()[source]
set_project_active(project, linked_dt=None)[source]
set_project_inactive(project)[source]
start()[source]
startup_cleanup()[source]
sync_folders(folder)[source]
unpack_zip(uploaded_zip, folder_path)[source]
write_image_metadata(figure, meta_entity)[source]
write_metadata_in_xml(entity, final_path)[source]
write_project_metadata(meta_dictionary)[source]
write_project_metadata_from_dict(project_path, meta_entity)[source]
write_zip_folder(dest_path, folder, linked_paths=None, op=None, exclude=[])[source]

Subpackages