def resolver_requirements(self, index): requirements = [] resolver = self._dependency_resolver(index) if not hasattr(resolver, "list_dependencies"): raise NotImplemented() for requirement in resolver.list_dependencies(): requirements.append(requirement.to_dict()) return requirements
def clean(self, index=None, **kwds): if index: resolver = self._dependency_resolver(index) if not hasattr(resolver, "clean"): raise NotImplemented() else: resolver.clean() return "OK" else: [resolver.clean(**kwds) for resolver in self._dependency_resolvers if hasattr(resolver, 'clean')] return "OK"
def install_dependency(self, index, payload): resolver = self._dependency_resolver(index) if not hasattr(resolver, "install_dependency"): raise NotImplemented() name, version, type, extra_kwds = self._parse_dependency_info(payload) return resolver.install_dependency( name=name, version=version, type=type, **extra_kwds )
def install_dependency(self, name, version, type, **kwds): if type != "package": raise NotImplemented("Can only install dependencies of type '%s'" % type) if self.versionless: version = None conda_target = CondaTarget(name, version=version) if install_conda_target(conda_target, conda_context=self.conda_context): raise Exception("Failed to install conda recipe.")
def _install_dependency(self, index, **payload): """ Resolver install dependency should return True when installation succeeds, False if not successful """ resolver = self._dependency_resolver(index) if not hasattr(resolver, "install_dependency"): raise NotImplemented() name, version, type, extra_kwds = self._parse_dependency_info(payload) return resolver.install_dependency(name=name, version=version, type=type, **extra_kwds)
def index(self, trans, **kwd): """ GET /api/tools Displays a collection of tools with optional criteria. :param q: (optional)if present search on the given query will be performed :type q: str :param page: (optional)requested page of the search :type page: int :param page_size: (optional)requested page_size of the search :type page_size: int :param jsonp: (optional)flag whether to use jsonp format response, defaults to False :type jsonp: bool :param callback: (optional)name of the function to wrap callback in used only when jsonp is true, defaults to 'callback' :type callback: str :returns dict: object containing list of results and metadata Examples: GET http://localhost:9009/api/tools GET http://localhost:9009/api/tools?q=fastq """ q = kwd.get('q', '') if not q: raise NotImplemented( 'Listing of all the tools is not implemented. Provide parameter "q" to search instead.' ) else: page = kwd.get('page', 1) page_size = kwd.get('page_size', 10) try: page = int(page) page_size = int(page_size) except ValueError: raise RequestParameterInvalidException( 'The "page" and "page_size" have to be integers.') return_jsonp = util.asbool(kwd.get('jsonp', False)) callback = kwd.get('callback', 'callback') search_results = self._search(trans, q, page, page_size) if return_jsonp: response = str('%s(%s);' % (callback, json.dumps(search_results))) else: response = json.dumps(search_results) return response
def index(self, trans, **kwd): raise NotImplemented("Listing uploads is not implemented.")