Beispiel #1
0
def data_listen():
    try:
        qresult = etcd_client.read_recursive('raw')
        print(qresult)
        logging.info(qresult)
        for key, value in qresult.items():
            dir = config['WORKING_ENVIRONMENT']['importdir'] + '/' + key.split('/')[2]
            filename = dir + '/' + key.split('/')[3] + '.json'
            print(filename)
            print(value)
            if not os.path.isdir(dir):
                os.mkdir(dir)
            with open(filename, 'w') as output:
                output.write(value)
    except:
        print("No pernding data")
        logging.info("No pending data")
Beispiel #2
0
async def write(request):
    data = await request.json()
    return web.json_response(etcd_client.read_recursive(data['key']))
Beispiel #3
0
async def datasets(request):
    return web.json_response(
        etcd_client.read_recursive(f"data/{request.match_info['dataset']}"))
Beispiel #4
0
async def retrieveall(request):
    reg = etcd_client.read_recursive(f"data/{request.match_info['dataset']}")
    nodes = list(key.split('/')[3] for key in reg.keys())
    response = syncer.temp_retrieve(request.match_info['dataset'], nodes)
    return web.json_response(response)