- def load_collection(self, uuid):
- if uuid in self.collections:
- return
- now = time.time()
- reader = arvados.CollectionReader(uuid)
- files = {}
- files[''] = dict(
- stat=dict(
- st_mode=(stat.S_IFDIR | 0755), st_ctime=now,
- st_mtime=now, st_atime=now, st_nlink=2))
- try:
- for s in reader.all_streams():
- for f in s.all_files():
- path = re.sub(r'^\./', '', os.path.join(s.name(), f.name()))
- files[path] = dict(
- stat=dict(
- st_mode=(stat.S_IFREG | 0444),
- st_size=f.size(), st_nlink=1,
- st_ctime=now, st_mtime=now, st_atime=now),
- arv_file=f)
- logger.debug("collection.load: %s: %s" % (uuid, path))
- except:
- # TODO: propagate real error, don't assume ENOENT
- raise fuse.FuseOSError(errno.ENOENT)
- self.collections[uuid] = dict(reader=reader, files=files)
- logger.info("collection.load %s" % uuid)
+if __name__ == '__main__':
+ # Handle command line parameters
+ parser = argparse.ArgumentParser(
+ description='Mount Keep data under the local filesystem.',
+ epilog="""
+Note: When using the --exec feature, you must either specify the
+mountpoint before --exec, or mark the end of your --exec arguments
+with "--".
+""")
+ 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""")
+ parser.add_argument('--exec', type=str, nargs=argparse.REMAINDER,
+ dest="exec_args", metavar=('command', 'args', '...', '--'),
+ help="""Mount, run a command, then unmount and exit""")