Ejemplo n.º 1
0
    def __init__(self, file_sources_config, conf_file=None, conf_dict=None, load_stock_plugins=False):
        self._file_sources_config = file_sources_config
        self._plugin_classes = self._file_source_plugins_dict()
        file_sources = []
        if conf_file is not None:
            file_sources = self._load_plugins_from_file(conf_file)
        elif conf_dict is not None:
            plugin_source = plugin_config.plugin_source_from_dict(conf_dict)
            file_sources = self._parse_plugin_source(plugin_source)
        else:
            file_sources = []
        custom_sources_configured = len(file_sources) > 0
        if load_stock_plugins:
            stock_file_source_conf_dict = []

            def _ensure_loaded(plugin_type):
                for file_source in file_sources:
                    if file_source.plugin_type == plugin_type:
                        return
                stock_file_source_conf_dict.append({'type': plugin_type})

            if file_sources_config.library_import_dir is not None:
                _ensure_loaded('gximport')
            if file_sources_config.user_library_import_dir is not None:
                _ensure_loaded('gxuserimport')
            if file_sources_config.ftp_upload_dir is not None:
                _ensure_loaded('gxftp')
            if stock_file_source_conf_dict:
                stock_plugin_source = plugin_config.plugin_source_from_dict(stock_file_source_conf_dict)
                file_sources.extend(self._parse_plugin_source(stock_plugin_source))

        self._file_sources = file_sources
        self.custom_sources_configured = custom_sources_configured
Ejemplo n.º 2
0
    def __build_container_resolvers(self, app_info, destination_info):
        app_conf_file = getattr(app_info, 'container_resolvers_config_file',
                                None)
        app_conf_dict = getattr(app_info, 'container_resolvers_config_dict',
                                None)

        if destination_info is not None:
            conf_file = destination_info.get('container_resolvers_config_file',
                                             app_conf_file)
            conf_dict = destination_info.get('container_resolvers',
                                             app_conf_dict)
        else:
            conf_file = app_conf_file
            conf_dict = app_conf_dict

        plugin_source = None
        if conf_dict:
            log.debug(
                "Loading container resolution config inline from Galaxy or job configuration file"
            )
            plugin_source = plugin_config.plugin_source_from_dict(conf_dict)
        elif conf_file and not os.path.exists(conf_file):
            log.warning(f"Unable to find config file '{conf_file}'")
        elif conf_file:
            log.debug(
                "Loading container resolution config from file '{conf_file}'")
            plugin_source = plugin_config.plugin_source_from_path(conf_file)
        if plugin_source:
            return self._parse_resolver_conf(plugin_source)
        return self.__default_container_resolvers()
Ejemplo n.º 3
0
    def __init__(self,
                 file_sources_config: 'ConfiguredFileSourcesConfig',
                 conf_file=None,
                 conf_dict=None,
                 load_stock_plugins=False):
        self._file_sources_config = file_sources_config
        self._plugin_classes = self._file_source_plugins_dict()
        file_sources = []
        if conf_file is not None:
            file_sources = self._load_plugins_from_file(conf_file)
        elif conf_dict is not None:
            plugin_source = plugin_config.plugin_source_from_dict(conf_dict)
            file_sources = self._parse_plugin_source(plugin_source)
        else:
            file_sources = []
        custom_sources_configured = len(file_sources) > 0
        if load_stock_plugins:
            stock_file_source_conf_dict = []

            def _ensure_loaded(plugin_type):
                for file_source in file_sources:
                    if file_source.plugin_type == plugin_type:
                        return
                stock_file_source_conf_dict.append({'type': plugin_type})

            if file_sources_config.ftp_upload_dir is not None:
                _ensure_loaded('gxftp')
            if file_sources_config.library_import_dir is not None:
                _ensure_loaded('gximport')
            if file_sources_config.user_library_import_dir is not None:
                _ensure_loaded('gxuserimport')
            if stock_file_source_conf_dict:
                stock_plugin_source = plugin_config.plugin_source_from_dict(
                    stock_file_source_conf_dict)
                # insert at begining instead of append so FTP and library import appear
                # at the top of the list (presumably the most common options). Admins can insert
                # these explicitly for greater control.
                file_sources = self._parse_plugin_source(
                    stock_plugin_source) + file_sources

        self._file_sources = file_sources
        self.custom_sources_configured = custom_sources_configured