예제 #1
0
    def __init__(self):

        self.manager = stored.SettingsManager(self.TVB_CONFIG_FILE)

        # Actual storage of all TVB related files
        self.KEYCLOAK_CONFIG = self.manager.get_attribute(
            stored.KEY_KC_CONFIGURATION, '')
        self.KEYCLOAK_LOGIN_ENABLED = self.manager.get_attribute(
            stored.KEY_ENABLE_KC_LOGIN, False, eval)
        self.KEYCLOAK_WEB_CONFIG = self.manager.get_attribute(
            stored.KEY_KC_WEB_CONFIGURATION, '')
        self.TVB_STORAGE = self.manager.get_attribute(stored.KEY_STORAGE,
                                                      self.FIRST_RUN_STORAGE,
                                                      str)
        self.UPLOAD_KEY_PATH = self.manager.get_attribute(
            stored.KEY_UPLOAD_PRIVATE_KEY_PATH, None, str)
        self.TRACE_USER_ACTIONS = self.manager.get_attribute(
            stored.KEY_TRACE_USER_ACTIONS, False, eval)
        self.TVB_LOG_FOLDER = os.path.join(self.TVB_STORAGE, "logs")
        self.TVB_TEMP_FOLDER = os.path.join(self.TVB_STORAGE, "TEMP")

        self.env = Environment()
        self.cluster = ClusterSettings(self.manager)
        self.hpc = HPCSettings(self.manager)
        self.web = WebSettings(self.manager)
        self.db = DBSettings(self.manager, self.DEFAULT_STORAGE,
                             self.TVB_STORAGE)
        self.version = VersionSettings(self.manager, self.BIN_FOLDER)
        self.file_storage = self.manager.get_attribute(stored.KEY_FILE_STORAGE,
                                                       'h5', str)

        self.EXTERNALS_FOLDER_PARENT = os.path.dirname(self.BIN_FOLDER)
        if not self.env.is_distribution():
            self.EXTERNALS_FOLDER_PARENT = os.path.dirname(
                self.EXTERNALS_FOLDER_PARENT)

        # The path to the matlab executable (if existent). Otherwise just return an empty string.
        value = self.manager.get_attribute(stored.KEY_MATLAB_EXECUTABLE, '',
                                           str) or ''
        if value == 'None':
            value = ''
        self.MATLAB_EXECUTABLE = value

        # Maximum number of vertices acceptable o be part of a surface at import time.
        self.MAX_SURFACE_VERTICES_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_NR_SURFACE_VERTEX, 300000, int)
        # Max number of ops that can be scheduled from UI in a PSE. To be correlated with the oarsub limitations
        self.MAX_RANGE_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_RANGE_NR, 2000, int)
        # Max number of threads in the pool of ops running in parallel. TO be correlated with CPU cores
        self.MAX_THREADS_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_THREAD_NR, 4, int)
        self.OPERATIONS_BACKGROUND_JOB_INTERVAL = self.manager.get_attribute(
            stored.KEY_OP_BACKGROUND_INTERVAL, 60, int)
        # The maximum disk space that can be used by one single user, in KB.
        self.MAX_DISK_SPACE = self.manager.get_attribute(
            stored.KEY_MAX_DISK_SPACE_USR, 5 * 1024 * 1024, int)
예제 #2
0
    def __init__(self, web_enabled=True):

        self.manager = stored.SettingsManager(self.TVB_CONFIG_FILE)

        ## Actual storage of all TVB related files
        self.TVB_STORAGE = self.manager.get_attribute(stored.KEY_STORAGE,
                                                      self.FIRST_RUN_STORAGE,
                                                      unicode)
        self.TVB_LOG_FOLDER = os.path.join(self.TVB_STORAGE, "logs")
        self.TVB_TEMP_FOLDER = os.path.join(self.TVB_STORAGE, "TEMP")
        self.TVB_PATH = self.manager.get_attribute(stored.KEY_TVB_PATH, '')

        self.env = Environment()
        self.cluster = ClusterSettings(self.manager)
        self.web = WebSettings(self.manager, web_enabled)
        self.db = DBSettings(self.manager, self.DEFAULT_STORAGE,
                             self.TVB_STORAGE)
        self.version = VersionSettings(self.manager, self.BIN_FOLDER)

        self.EXTERNALS_FOLDER_PARENT = os.path.dirname(self.BIN_FOLDER)
        if not self.env.is_distribution():
            self.EXTERNALS_FOLDER_PARENT = os.path.dirname(
                self.EXTERNALS_FOLDER_PARENT)

        # The path to the matlab executable (if existent). Otherwise just return an empty string.
        value = self.manager.get_attribute(stored.KEY_MATLAB_EXECUTABLE, '',
                                           str) or ''
        if value == 'None':
            value = ''
        self.MATLAB_EXECUTABLE = value

        # Maximum number of vertices acceptable o be part of a surface at import time.
        self.MAX_SURFACE_VERTICES_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_NR_SURFACE_VERTEX, 300000, int)
        # Max number of ops that can be scheduled from UI in a PSE. To be correlated with the oarsub limitations
        self.MAX_RANGE_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_RANGE_NR, 2000, int)
        # Max number of threads in the pool of ops running in parallel. TO be correlated with CPU cores
        self.MAX_THREADS_NUMBER = self.manager.get_attribute(
            stored.KEY_MAX_THREAD_NR, 4, int)
        # The maximum disk space that can be used by one single user, in KB.
        self.MAX_DISK_SPACE = self.manager.get_attribute(
            stored.KEY_MAX_DISK_SPACE_USR, 5 * 1024 * 1024, int)

        ## Configure Traits
        self.TRAITS_CONFIGURATION = EnhancedDictionary()
        self.TRAITS_CONFIGURATION.interface_method_name = 'interface'
        self.TRAITS_CONFIGURATION.use_storage = True