7661: add --by-pdh option to FUSE and use this option in crunch-job. Do not start...
[arvados.git] / services / fuse / bin / arv-mount
index 7f9c916c456f49e76744f78ba06b18af2eb1ed1b..e2df1c8da3b34c6e1126f8405c9ffc474aef040a 100755 (executable)
@@ -32,13 +32,15 @@ with "--".
 
     mount_mode = parser.add_mutually_exclusive_group()
 
-    mount_mode.add_argument('--all', action='store_true', help="""Mount a subdirectory for each mode: home, shared, by_tag, by_id (default).""")
+    mount_mode.add_argument('--all', action='store_true', help="""Mount a subdirectory for each mode: home, shared, by_tag, by_pdh, by_id (default).""")
     mount_mode.add_argument('--home', action='store_true', help="""Mount only the user's home project.""")
     mount_mode.add_argument('--shared', action='store_true', help="""Mount only list of projects shared with the user.""")
     mount_mode.add_argument('--by-tag', action='store_true',
                             help="""Mount subdirectories listed by tag.""")
     mount_mode.add_argument('--by-id', action='store_true',
                             help="""Mount subdirectories listed by portable data hash or uuid.""")
+    mount_mode.add_argument('--by-pdh', action='store_true',
+                            help="""Mount subdirectories listed by portable data hash.""")
     mount_mode.add_argument('--project', type=str, help="""Mount a specific project.""")
     mount_mode.add_argument('--collection', type=str, help="""Mount only the specified collection.""")
 
@@ -103,7 +105,7 @@ with "--".
         now = time.time()
         dir_class = None
         dir_args = [llfuse.ROOT_INODE, operations.inodes, api, args.retries]
-        if args.by_id:
+        if args.by_id or args.by_pdh:
             # Set up the request handler with the 'magic directory' at the root
             dir_class = MagicDirectory
         elif args.by_tag:
@@ -130,7 +132,8 @@ with "--".
             e = operations.inodes.add_entry(Directory(llfuse.ROOT_INODE, operations.inodes))
             dir_args[0] = e.inode
 
-            e._entries['by_id'] = operations.inodes.add_entry(MagicDirectory(*dir_args))
+            e._entries['by_id'] = operations.inodes.add_entry(MagicDirectory(*dir_args, by_pdh=True if args.by_pdh else False))
+
             e._entries['by_tag'] = operations.inodes.add_entry(TagsDirectory(*dir_args))
 
             dir_args.append(usr)
@@ -170,7 +173,8 @@ From here, the following directories are available:
         llfuse.init(operations, args.mountpoint, opts)
 
         # Subscribe to change events from API server
-        operations.listen_for_events(api)
+        if not args.by_pdh:
+            operations.listen_for_events(api)
 
         t = threading.Thread(None, lambda: llfuse.main())
         t.start()