def get_available_modules(): '''Lists all available Jterator modules in the `JtLibrary <https://github.com/TissueMAPS/JtLibrary>`_ repository. ''' logger.info('get list of available jterator modules') modules = AvailableModules() return jsonify(jtmodules=modules.to_dict())
def get_available_modules(): '''Lists all available Jterator modules in the `JtLibrary <https://github.com/TissueMAPS/JtLibrary>`_ repository. ''' logger.info('get list of available jterator modules') modules = AvailableModules() return jsonify(jtmodules=modules.to_dict())
def pipeline(self): '''List[tmlib.jterator.module.ImageAnalysisModule]: pipeline built based on :class`PipelineDescription <tmlib.workflow.jterator.description.PipelineDescription>` and :class:`HandleDescriptions <tmlib.workflow.jterator.description.HandleDescriptions>`. ''' handles = self.project.handles # only compute this once pipeline = list() for i, element in enumerate(self.project.pipe.description.pipeline): if not element.active: continue if '/' in element.source: logger.debug( 'assuming module `%s` resides outside the configured module path', element.source) source_file = os.path.expanduser( os.path.expandvars(element.source)) if not os.path.isabs(source_file): source_file = os.path.join(self.step_location, source_file) else: logger.debug( 'searching for module `%s` in configured module path %r ...', element.source, cfg.modules_path) source_file = AvailableModules().find_module_by_name( element.source) if not os.path.exists(source_file): raise PipelineDescriptionError( 'Module source `{0}` resolved to non-existing file `{1}`'. format(element.source, source_file)) pipeline.append( ImageAnalysisModule(name=handles[i].name, source_file=source_file, handles=handles[i].description)) return pipeline
def get_module_source_code(): '''Gets the source code for a given module.''' module_filename = request.args.get('module_filename') logger.info('get source code of module file "%s"', module_filename) modules = AvailableModules() files = [ f for i, f in enumerate(modules.module_files) if os.path.basename(f) == module_filename ] return send_file(files[0])
def get_module_source_code(): '''Gets the source code for a given module.''' name = request.args.get('module_name') logger.info('get source code of module "%s"', name) try: modules = AvailableModules() # XXX: this code relies on the fact that `.module_names` and # `.module_files` return corresponding items at the same # position in the list! The `AvailableModules` class should # be changed to provide a map name=>List[files] instead. idx = modules.module_names.index(name) return send_file(modules.module_files[idx]) except ValueError: logger.error("Could not find module `%s` in available modules %r", name, modules.module_names) raise