Exemplo n.º 1
0
def azurereadfile(filename):
    token = auth(tenant_id=tenant,
                 client_id=client,
                 client_secret=clientsecret)
    azureDLS = AzureDLFileSystem(store_name=adls, token=token)
    with azureDLS.open('vishfile', blocksize=2**20) as f:
        print(f.readline())
Exemplo n.º 2
0
def azurelistfile():
    token = auth(tenant_id=tenant,
                 client_id=client,
                 client_secret=clientsecret)
    azureDLS = AzureDLFileSystem(store_name=adls, token=token)
    childItems = azureDLS.ls("/")
    print '\n'.join([str(item) for item in childItems])
Exemplo n.º 3
0
def azurewritefile():
    token = auth(tenant_id=tenant,
                 client_id=client,
                 client_secret=clientsecret)
    azureDLS = AzureDLFileSystem(store_name=adls, token=token)
    with azureDLS.open('vishfile', 'wb') as f:
        f.write(b'example')
Exemplo n.º 4
0
    ADLFS_LOG_LEVEL (defines logging level)
    """
    import logging
    import os
    import sys

    log_level = os.environ.get('ADLFS_LOG_LEVEL', default_level)

    levels = dict(CRITICAL=logging.CRITICAL,
                  ERROR=logging.ERROR,
                  WARNING=logging.WARNING,
                  INFO=logging.INFO,
                  DEBUG=logging.DEBUG)

    if log_level in levels:
        log_level = levels[log_level]
    else:
        sys.exit("invalid ADLFS_LOG_LEVEL '{0}'".format(log_level))

    logging.basicConfig(level=log_level)


if __name__ == '__main__':
    setup_logging()
    fs = AzureDLFileSystem()
    if len(sys.argv) > 1:
        AzureDataLakeFSCommand(fs).onecmd(' '.join(sys.argv[1:]))
    else:
        AzureDataLakeFSCommand(fs).cmdloop()