def get_local_manifest(): au.refresh_cache() module_names = au.list_local() out = {} for module_name in module_names: local_info = au.get_local_module_info(module_name) out[module_name] = { 'version': local_info.version, 'type': local_info.type, 'title': local_info.title, 'description': local_info.description, 'developer': local_info.developer } return web.json_response(out)
def get_annotators(): module_names = au.list_local() out = {} for module_name in module_names: local_info = au.get_local_module_info(module_name) if local_info.type == 'annotator': out[module_name] = { 'name': module_name, 'version': local_info.version, 'type': local_info.type, 'title': local_info.title, 'description': local_info.description, 'developer': vars(local_info.developer) } return out
def save(self, path, modules=[]): """ Save all the config settings to a file. A list of modules to include may be passed in. An empty list results in all module configs being saved. """ # Load all modules, or only requested modules if len(modules) == 0: modules = au.list_local() for module_name in modules: self._load_module_conf(module_name, build_all=False) self._build_all() # Delete configs for modules in the job conf but not in the modules list extra_modules = list(set(self._all['modules']) - set(modules)) for module_name in extra_modules: del self._all['modules'][module_name] # Write to a file with open(path, 'w') as wf: wf.write(yaml.dump(self._all, default_flow_style=False))
def update_modules(args): if len(args.modules) == 0: requested_modules = au.list_local() else: requested_modules = au.search_local(*args.modules) print('Checking status') needs_update = [] status_table = [['Name', 'Status']] for module_name in requested_modules: local_info = au.get_local_module_info(module_name) version = local_info.conf['version'] if au.module_exists_remote(module_name): latest_version = au.get_remote_latest_version(module_name) if version == latest_version: status = 'Up to date' else: status = 'Requires update' needs_update.append(module_name) else: status = 'No remote version' status_table.append([module_name, status]) print_tabular_lines(status_table) if len(needs_update) == 0: print('All modules are up to date') exit() else: user_cont = input('Continue to update the following modules:\n%s\n<y/n>: '\ %','.join(needs_update)) if user_cont.lower() not in ['y', 'yes']: print('Cancelling update') exit() args.modules = needs_update args.force_data = False args.version = None args.yes = True install_modules(args)