def __dependency_manager_for_config(app_config, resolution_config=None): dm = build_dependency_manager(app_config_dict=app_config, resolution_config_dict=resolution_config) if ROUND_TRIP_TEST_DEPENDENCY_MANAGER_SERIALIZATION: as_dict = dm.to_dict() dm = build_dependency_manager(resolution_config_dict=as_dict) return dm
def build_job_script(self, builder: "Builder", command: List[str]) -> str: ensure_galaxy_lib_available() resolution_config_dict = { "use": self.use_tool_dependencies, "default_base_path": self.tool_dependency_dir, } app_config = { "conda_auto_install": True, "conda_auto_init": True, } tool_dependency_manager = deps.build_dependency_manager( app_config_dict=app_config, resolution_config_dict=resolution_config_dict, conf_file=self.dependency_resolvers_config_file, ) # type: deps.DependencyManager dependencies = get_dependencies(builder) handle_dependencies = "" # str if dependencies: handle_dependencies = "\n".join( tool_dependency_manager.dependency_shell_commands( dependencies, job_directory=builder.tmpdir)) template_kwds = dict( handle_dependencies=handle_dependencies) # type: Dict[str, str] job_script = COMMAND_WITH_DEPENDENCIES_TEMPLATE.substitute( template_kwds) return job_script
def __dependency_manager_for_base_path(default_base_path, conf_file=None): dm = DependencyManager(default_base_path=default_base_path, conf_file=conf_file, app_config={"conda_auto_init": False}) if ROUND_TRIP_TEST_DEPENDENCY_MANAGER_SERIALIZATION: as_dict = dm.to_dict() dm = build_dependency_manager(resolution_config_dict=as_dict) return dm
def _build_dependency_manager_no_config(kwargs): """Simplified variant of build_dependency_manager from galaxy.tool_util.deps. The canonical factory method requires a full Galaxy configuration object which we do not have available in this script (an optimization). """ configure_logging(kwargs) base, ext = os.path.splitext(kwargs.get('dependency_resolvers_config_file', 'dependency_resolvers_conf.xml')) dependency_resolvers_config_file = find_config_file(base, exts=[ext.lstrip('.')]) # FIXME: default is wrong for installed Galaxy dependency_manager = build_dependency_manager(app_config_dict=kwargs, conf_file=dependency_resolvers_config_file, default_tool_dependency_dir="database/dependencies") return dependency_manager
def __setup_dependency_manager(self, conf): default_tool_dependency_dir = "dependencies" resolvers_config_file = os.path.join(self.config_dir, conf.get("dependency_resolvers_config_file", "dependency_resolvers_conf.xml")) if build_dependency_manager is not None: self.dependency_manager = build_dependency_manager( app_config_dict=conf, conf_file=resolvers_config_file, default_tool_dependency_dir=default_tool_dependency_dir ) else: dependencies_dir = conf.get("tool_dependency_dir", default_tool_dependency_dir) conda_config = {k: v for k, v in conf.items() if k.startswith("conda_")} self.dependency_manager = DependencyManager(dependencies_dir, resolvers_config_file, app_config=conda_config)