#!/usr/bin/env python from arvados.fuse import * import arvados if __name__ == '__main__': api = arvados.api() # Handle command line parameters parser = argparse.ArgumentParser( description='Mount Keep data under the local filesystem.') parser.add_argument('mountpoint', type=str, help="""Mount point.""") parser.add_argument('--collection', type=str, help="""Collection locator""") parser.add_argument('--debug', action='store_true', help="""Debug mode""") args = parser.parse_args() # Create the request handler operations = Operations(os.getuid(), os.getgid()) if args.collection != None: # Set up the request handler with the collection at the root e = operations.inodes.add_entry(Directory(llfuse.ROOT_INODE)) operations.inodes.load_collection(e, arvados.CollectionReader(arvados.Keep.get(args.collection))) else: # Set up the request handler with the 'magic directory' at the root operations.inodes.add_entry(MagicDirectory(llfuse.ROOT_INODE, operations.inodes)) # FUSE options, see mount.fuse(8) opts = [] # Enable FUSE debugging (logs each FUSE request) if args.debug: opts += ['debug'] # Initialize the fuse connection llfuse.init(operations, args.mountpoint, opts) # Run the main loop #try: llfuse.main() #except: # llfuse.close(unmount=True) # raise # #llfuse.close(unmount=True)