config Package

environment

Environment related checks or operations are to be defined here.

class tvb.basic.config.environment.Environment[source]

Bases: object

PYTHON_FOLDER = 'python3.10'
append_to_path(*paths)[source]

Set PATH :param paths: list of absolute folder paths to join and add BEFORE the current PATH

get_library_folder(default_mac)[source]

Return top level library folder. Will be use for setting paths

static is_distribution()[source]

Return True when TVB_Distribution package, False when used from a GitHub clone, Pypi, Conda or Docker

is_framework_present()[source]
Returns:

True when framework classes are present and can be imported.

is_linux()[source]
is_linux_deployment()[source]

Return True if current run is not development and is running on Linux.

static is_mac()[source]
is_mac_deployment()[source]

Return True if current run is not development and is running on Mac OS X

static is_windows()[source]
is_windows_deployment()[source]

Return True if current run is not development and is running on Windows.

setup_python_path(*paths)[source]

Set PYTHONPATH :param paths: list of absolute folder paths to join.

setup_tk_tcl_environ(root_folder)[source]

Given a root folder to look in, find the required configuration files for TCL/TK and set the proper environmental variables so everything works fine in the distribution package.

Parameters:

root_folder – the top folder from which to start looking for the required configuration files

profile_settings

Prepare TVB settings to be grouped under various profile classes.

class tvb.basic.config.profile_settings.BaseSettingsProfile[source]

Bases: object

ACCESS_MODE_TVB_FILES = 484
property BIN_FOLDER

Return path towards tvb_bin location. It will be used in some environment for determining the starting point

DEFAULT_STORAGE = '/home/tvb_user/TVB/'
FIRST_RUN_STORAGE = '/home/tvb_user/.tvb-temp'
LOGGER_CONFIG_FILE_NAME = 'logger_config.conf'
MAGIC_NUMBER = 9
property PYTHON_INTERPRETER_PATH

Get Python path, based on current environment.

TVB_CONFIG_FILE = '/home/tvb_user/.tvb.configuration'
TVB_USER_HOME = '/home/tvb_user'
initialize_for_deployment()[source]
initialize_profile()[source]

Make sure tvb folders are created.

prepare_for_operation_mode()[source]

Overwrite PostgreSQL number of connections when executed in the context of a node.

class tvb.basic.config.profile_settings.LibrarySettingsProfile[source]

Bases: BaseSettingsProfile

Profile used when scientific library is used without storage and without web UI.

LOGGER_CONFIG_FILE_NAME = 'library_logger.conf'
TVB_STORAGE = '/root/TVB/'
class tvb.basic.config.profile_settings.MATLABLibraryProfile[source]

Bases: LibrarySettingsProfile

Profile use library use from MATLAB.

LOGGER_CONFIG_FILE_NAME = None
class tvb.basic.config.profile_settings.TestLibraryProfile[source]

Bases: LibrarySettingsProfile

Profile for library unit-tests.

LOGGER_CONFIG_FILE_NAME = 'library_logger_test.conf'

settings

TVB Raw Settings are defined here, grouped by their category of usage (e.g. cluster related, web related, etc). Do not instantiate these classes directly, but rather use them through TvpProfile.current instance.

class tvb.basic.config.settings.ClusterSettings(manager)[source]

Bases: object

Cluster related settings.

property CLUSTER_NODE_NAME
:return the name of the cluster on which TVB code is executed.

If code is executed on a normal machine (not cluster node) returns None

IN_OPERATION_EXECUTION_PROCESS = False
property IS_RUNNING_ON_CLUSTER_NODE

Returns True if current execution happens on cluster node. Even when IS_DEPLOY is True, this call will return False for the web machine.

property JOB_ID_STRING
property NODE_ENV
SCHEDULER_OAR = 'oar'
SCHEDULER_SLURM = 'slurm'
property SCHEDULE_COMMAND
property STATUS_COMMAND
property STOP_COMMAND
class tvb.basic.config.settings.DBSettings(manager, default_storage, current_storage)[source]

Bases: object

ALLOW_NESTED_TRANSACTIONS = False
class tvb.basic.config.settings.HPCSettings(manager)[source]

Bases: object

HPC related specifications

CAN_RUN_HPC = True
CRYPT_BUFFER_SIZE = 65536
CRYPT_PASS_SIZE = 64
HPC_LAUNCHER_SH_SCRIPT = 'hpcLauncher'
IN_OPERATION_EXECUTION_PROCESS = False
JOB_MOUNT_POINT_KEY = 'mountPoint'
JOB_STATUS_KEY = 'status'
UNICORE_ARGS_KEY = 'Arguments'
UNICORE_EXE_KEY = 'Executable'
UNICORE_PROJECT_KEY = 'Project'
UNICORE_RESOURCER_KEY = 'Resources'
class tvb.basic.config.settings.VersionSettings(manager, bin_folder)[source]

Bases: object

Gather settings related to various version numbers of TVB application

BASE_VERSION = '2.8.3'
DATA_VERSION = 5
DATA_VERSION_ATTRIBUTE = 'Data_version'
DB_STRUCTURE_VERSION = '32d4bf9f8def'
PROJECT_VERSION = 3
property REVISION_NUMBER
SVN_GIT_MIGRATION_REVISION = 10000
static parse_revision_number(version_string)[source]
class tvb.basic.config.settings.WebAdminSettings(manager)[source]

Bases: object

Setting related to the default users of web-tvb

ADMINISTRATOR_BLANK_PWD = 'pass'
DEFAULT_ADMIN_EMAIL = 'jira.tvb@gmail.com'
SYSTEM_USER_NAME = 'TVB system'
class tvb.basic.config.settings.WebSettings(manager)[source]

Bases: object

Web related specifications

CAN_ENCRYPT_STORAGE = True
LOCALHOST = 'localhost'
RENDER_HTML = True
VISUALIZERS_ROOT = 'tvb.interfaces.web.templates.jinja2.visualizers'

stored

Manages reading and writing settings in file

class tvb.basic.config.stored.SettingsManager(config_file_location)[source]

Bases: object

add_entries_to_config_file(input_data)[source]

Add to the dictionary of settings already existent in the settings file.

Parameters:

input_data – A dictionary of pairs that need to be added to the config file.

delete_entries_from_config_file(data_to_be_deleted)[source]

Delete from the dictionary of settings existent in the settings file.

Parameters:

data_to_be_deleted – A list of attributes that need to be deleted from the config file.

get_attribute(key, default=None, dtype=<class 'str'>)[source]

Get a cfg attribute that could also be found in the settings file.

is_first_run()[source]
write_config_data(config_dict)[source]

Overwrite anything already existent in the config file

utils

Helper tools, for the configuration area.

class tvb.basic.config.utils.EnhancedDictionary[source]

Bases: dict

A dictionary like class that provides easy access to configuration values.