trackerv2/server/sendtoindexer.py
async def offload_local(name, clusterconf, dumpconf, data):
    r"""
    When the Elasticsearch cluster/node is unavailable, offload data to disk
    and try to resend the next time the script is run.
    :param str name: Cluster (nick)name
    :param dict clusterconf: Connection configuration for the cluster
    :param dict dumpconf: `configuration['elasticsearch']['offload']`
    :param list(dict) data: All ES documents to be flushed to disk
    """
    dumpuuid = str(uuid4())
    if not path.exists(dumpconf['data folder']):
        makedirs(dumpconf['data folder'])
    with open(path.join(dumpconf['data folder'], dumpuuid), 'wb') as outfile:
        if isinstance(data, GeneratorType):
            data = list(data)
        elif isinstance(data, AsyncGeneratorType):
            data = [d async for d in data]
        pickle.dump(data, outfile, pickle.HIGHEST_PROTOCOL)
    # with open(conf['index'], 'a') as indexfile:
    #     indexfile.write(dumpuuid + '\n')
    if path.exists(dumpconf['index']):
        with open(dumpconf['index']) as f:
            indexdata = json.load(f)
    else:
        if not path.exists(path.abspath(path.join(dumpconf['index'], pardir))):
            makedirs(path.abspath(path.join(dumpconf['index'], pardir)))
        indexdata = {'clusters': {}, 'dumps': {}}
    if name not in indexdata['clusters']:
        indexdata['clusters'][name] = clusterconf
        indexdata['dumps'][name] = []
    indexdata['dumps'][name].append(dumpuuid)
    with open(dumpconf['index'], 'w') as f:
        json.dump(indexdata, f)
r"""
    When the Elasticsearch cluster/node is unavailable, offload data to disk
    and try to resend the next time the script is run.
    :param str name: Cluster (nick)name
    :param dict clusterconf: Connection configuration for the cluster
    :param dict dumpconf: `configuration['elasticsearch']['offload']`
    :param list(dict) data: All ES documents to be flushed to disk
    
r"""
When the Elasticsearch cluster/node is unavailable, offload data to disk
and try to resend the next time the script is run.
r " " " When the Elasticsearch cluster / node is unavailable offload data to disk and try to resend the next time the script is run .
async def offload_local(name, clusterconf, dumpconf, data):
    dumpuuid = str(uuid4())
    if not path.exists(dumpconf['data folder']):
        makedirs(dumpconf['data folder'])
    with open(path.join(dumpconf['data folder'], dumpuuid), 'wb') as outfile:
        if isinstance(data, GeneratorType):
            data = list(data)
        elif isinstance(data, AsyncGeneratorType):
            data = [d async for d in data]
        pickle.dump(data, outfile, pickle.HIGHEST_PROTOCOL)
    if path.exists(dumpconf['index']):
        with open(dumpconf['index']) as f:
            indexdata = json.load(f)
    else:
        if not path.exists(path.abspath(path.join(dumpconf['index'], pardir))):
            makedirs(path.abspath(path.join(dumpconf['index'], pardir)))
        indexdata = {'clusters': {}, 'dumps': {}}
    if name not in indexdata['clusters']:
        indexdata['clusters'][name] = clusterconf
        indexdata['dumps'][name] = []
    indexdata['dumps'][name].append(dumpuuid)
    with open(dumpconf['index'], 'w') as f:
        json.dump(indexdata, f)
async def offload_local ( name , clusterconf , dumpconf , data ) : dumpuuid = str ( uuid4 ( ) ) if not path . exists ( dumpconf [ 'data folder' ] ) : makedirs ( dumpconf [ 'data folder' ] ) with open ( path . join ( dumpconf [ 'data folder' ] , dumpuuid ) , 'wb' ) as outfile : if isinstance ( data , GeneratorType ) : data = list ( data ) elif isinstance ( data , AsyncGeneratorType ) : data = [ d async for d in data ] pickle . dump ( data , outfile , pickle . HIGHEST_PROTOCOL ) if path . exists ( dumpconf [ 'index' ] ) : with open ( dumpconf [ 'index' ] ) as f : indexdata = json . load ( f ) else : if not path . exists ( path . abspath ( path . join ( dumpconf [ 'index' ] , pardir ) ) ) : makedirs ( path . abspath ( path . join ( dumpconf [ 'index' ] , pardir ) ) ) indexdata = { 'clusters' : { } , 'dumps' : { } } if name not in indexdata [ 'clusters' ] : indexdata [ 'clusters' ] [ name ] = clusterconf indexdata [ 'dumps' ] [ name ] = [ ] indexdata [ 'dumps' ] [ name ] . append ( dumpuuid ) with open ( dumpconf [ 'index' ] , 'w' ) as f : json . dump ( indexdata , f )
r"""
When the Elasticsearch cluster/node is unavailable, offload data to disk
and try to resend the next time the script is run.
r " " " When the Elasticsearch cluster / node is unavailable offload data to disk and try to resend the next time the script is run .
r"""
    When the Elasticsearch cluster/node is unavailable, offload data to disk
    and try to resend the next time the script is run.
    :param str name: Cluster (nick)name
    :param dict clusterconf: Connection configuration for the cluster
    :param dict dumpconf: `configuration['elasticsearch']['offload']`
    :param list(dict) data: All ES documents to be flushed to disk
    """ # with open(conf['index'], 'a') as indexfile: #     indexfile.write(dumpuuid + '\n')
name
None
clusterconf
Connection configuration for the cluster
Connection configuration for the cluster
dumpconf
None
data
All ES documents to be flushed to disk
All ES documents to be flushed to disk