Exemplo n.º 1
0
first_repo = True
found_colls = set()
for repo in config['process_repositories']:
    repo_name = OLToolbox.repo_name(repo)
    # download the channel database for this repository
    if not update_channel_db(repo):
        continue
    # Latest OpenLoops process API version for which processes
    # are available in the repository
    latest_api_version = int(
        OLToolbox.import_dictionary(latest_api_version_url %
                                    repo)['process_api_version'])
    max_latest_api_version = max(max_latest_api_version, latest_api_version)
    # This fails if the repository does not contain processes
    # with the API of the installed OpenLoops version.
    process_dbs[repo] = OLToolbox.ProcessDB(db=(version_db_url % repo))
    libname_maps[repo] = OLToolbox.import_dictionary(libmappins_url % repo,
                                                     fatal=False)
    # scan all repositories for collections to download
    # Note that when the downloader is invoked by the build script,
    # the collections will already be resolved.
    for coll in collections:
        if coll == 'all.coll' or coll == repo_name + '.coll':
            process_coll = list(process_dbs[repo].content.keys())
        else:
            if first_repo:
                # check if the collection is available locally
                process_coll = OLToolbox.import_list(coll, fatal=False)
            else:
                process_coll = None
            if process_coll is None:
Exemplo n.º 2
0
            sys.stdout.flush()
            os.remove(server_process_definition)
        except OSError:
            print '[deleting definition failed]',
            sys.stdout.flush()
    # update process and channel databases
    db.remove(process)
    ch_db.remove(process)
    print 'done'


print 'repository:', repository

if local_api_version == latest_api_version:
    print 'process API version: %d' % local_api_version
    process_db = OLToolbox.ProcessDB(db=version_db_file)
    channel_db = OLToolbox.ChannelDB(db=channel_db_file)
else:
    if local_api_version > latest_api_version:
        print 'new process API version: %d (server: %d)' % (local_api_version,
                                                            latest_api_version)
        OLToolbox.export_dictionary(latest_api_version_file,
                                    {'process_api_version': local_api_version})
    else:
        print 'WARNING: local process API is outdated'
        print '         (local: %d, server: %d)' % (local_api_version,
                                                    latest_api_version)
    if not os.path.isdir(repository_path):
        os.mkdir(repository_path)
        process_db = OLToolbox.ProcessDB()
        channel_db = OLToolbox.ChannelDB()