コード例 #1
0
async def get_remote_module_config(request):
    queries = request.rel_url.query
    module = queries['module']
    conf = au.get_remote_module_config(module)
    if 'tags' not in conf:
        conf['tags'] = []
    response = conf
    return web.json_response(response)
コード例 #2
0
ファイル: webresult.py プロジェクト: BadSeby/open-cravat
async def get_nowg_annot_modules(request):
    # disabling this until required_annotator is included in the remote manifest.
    return web.json_response({})
    # Below is not run. Delete the above and change the below so that remote manifest's required_annotator is used.
    queries = request.rel_url.query
    job_id, dbpath = await get_jobid_dbpath(request)
    conn = await aiosqlite3.connect(dbpath)
    cursor = await conn.cursor()
    remote_widget_modules = au.get_remote_module_infos_of_type(
        'webviewerwidget')
    remote_widget_names = remote_widget_modules.keys()
    remote_annot_to_widgets = {}
    for remote_widget_name in remote_widget_names:
        conf = au.get_remote_module_config(remote_widget_name)
        if 'required_annotator' in conf:
            req_annot = conf['required_annotator']
            if req_annot not in remote_annot_to_widgets:
                remote_annot_to_widgets[req_annot] = []
            remote_annot_to_widgets[req_annot].append(remote_widget_name)
    wgmodules = au.get_local_module_infos_of_type('webviewerwidget')
    annot_modules_with_wg = []
    for wgmodule in wgmodules:
        conf = wgmodules[wgmodule].conf
        if 'required_annotator' in conf:
            annot_module = conf['required_annotator']
            if annot_module not in annot_modules_with_wg:
                annot_modules_with_wg.append(annot_module)
    nowg_annot_modules = {}
    r = await table_exists(cursor, 'variant')
    if r:
        q = 'select name, displayname from variant_annotator'
        await cursor.execute(q)
        for r in await cursor.fetchall():
            m = r[0]
            if m in ['example_annotator', 'testannot', 'tagsampler']:
                continue
            annot_module = r[0]
            displayname = r[1]
            if annot_module not in annot_modules_with_wg and annot_module not in nowg_annot_modules and annot_module in remote_annot_to_widgets:
                nowg_annot_modules[annot_module] = displayname
    content = nowg_annot_modules
    await cursor.close()
    await conn.close()
    return web.json_response(content)
コード例 #3
0
def print_info(args):
    module_name = args.module
    installed = False
    remote_available = False
    up_to_date = False
    local_info = None
    remote_info = None
    # Remote
    try:
        remote_info = au.get_remote_module_info(module_name)
        if remote_info != None:
            remote_available = True
    except LookupError:
        remote_available = False
    # Local
    release_note = {}
    try:
        local_info = au.get_local_module_info(module_name)
        if local_info != None:
            installed = True
            del local_info.readme
            release_note = local_info.conf.get('release_note', {})
        else:
            installed = False
    except LookupError:
        installed = False
    if remote_available:
        versions = remote_info.versions
        data_sources = remote_info.data_sources
        new_versions = []
        for version in versions:
            data_source = data_sources.get(version, None)
            note = release_note.get(version, None)
            if data_source:
                version = version + ' (data source ' + data_source + ')'
            if note:
                version = version + ' ' + note
            new_versions.append(version)
        remote_info.versions = new_versions
        del remote_info.data_sources
        dump = yaml_string(remote_info)
        print(dump)
    # output columns
    print('output columns:')
    conf = au.get_remote_module_config(module_name)
    if 'output_columns' in conf:
        output_columns = conf['output_columns']
        for col in output_columns:
            desc = ''
            if 'desc' in col:
                desc = col['desc']
            print('  {}: {}'.format(col['title'], desc))
    if installed:
        print('INSTALLED')
        if args.local:
            li_out = copy.deepcopy(local_info)
            del li_out.conf
            li_out.get_size()
            dump = yaml_string(li_out)
            print(dump)
    else:
        print('NOT INSTALLED')
    if installed and remote_available:
        if installed and local_info.version == remote_info.latest_version:
            up_to_date = True
        else:
            up_to_date = False
        if up_to_date:
            print('UP TO DATE')
        else:
            print('NEWER VERSION EXISTS')