def get(self): # { # "python-package-info": [ # "aiocron 1.6", # "aiohttp 3.6.2", # "async-timeout 3.0.1", # ... # ], # "codebase": { # "repository-url": "https://github.com/biothings/biothings.api.git", # "commit-hash": "8715a8ebcf49bc436bca24b1ce1a35f1777a7c4c" # }, # "biothings": { # "repository-url": "https://github.com/biothings/biothings.api.git", # "commit-hash": "f3ca99a1f5261a70eaef196bbab1163302c16859", # "master-commits": "2478", # "version": "0.10.0" # }, # "python-info": { # "version": "3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52)", # "version_info": { # "major": 3, # "minor": 9, # "micro": 5 # } # } # } try: return get_software_info(self._repo) except Exception: return {}
async def get(self): _raw = await self.web_settings.metadata.refresh(self.biothing_type) _meta = self.web_settings.metadata.biothing_metadata[self.biothing_type] if self.args.raw: raise Finish(_raw) elif self.args.dev: _meta['software'] = get_software_info( app_dir=self.web_settings.devinfo.get_git_repo_path()) _meta['cluster'] = await get_es_versions( client=self.web_settings.connections.async_client) _meta['hosts'] = self.web_settings.connections.async_client.transport.info else: # remove correlation info _meta.pop('_biothing', None) _meta.pop('_indices', None) _meta = self.extras(_meta) # override here self.finish(dict(sorted(_meta.items())))
def extras(self, _meta): appdir = self.web_settings.devinfo.get_git_repo_path() commit = get_software_info(appdir).get('commit-hash', '') _meta['available_fields'] = 'http://mygene.info/metadata/fields' _meta['app_revision'] = commit _meta['genome_assembly'] = {} _meta['taxonomy'] = {} for s, d in self.web_settings.TAXONOMY.items(): if 'tax_id' in d: _meta['taxonomy'][s] = int(d['tax_id']) if 'assembly' in d: _meta['genome_assembly'][s] = d['assembly'] if "source" not in _meta: # occurs when loaded from scratch, not from a change/diff file _meta["source"] = None return _meta
def _get_software_info(self): ''' Override me ''' return get_software_info(app_dir=self.app_dir)
def _fill_software_info(self,_meta): kwargs = self.get_query_params() debug = kwargs.pop('dev', False) if debug: _meta['software'] = get_software_info()