wtsi-hgi / hgi-vault

Data retention policy tools
GNU General Public License v3.0
1 stars 0 forks source link

Bug on 'Mine' View Context when source file has been deleted #22

Closed piyushahuja closed 2 years ago

piyushahuja commented 2 years ago

Example:

vault keep --view mine

lists a few files and then gives

pipelines/Pilot_UKB/qc/ELGH_nfCore/work/06/94b5f115c398030ea983c6dc433e17/minimal_dataset/ELGH_VAL11509205.doublet.h5ad
pipelines/Pilot_UKB/qc/ELGH_nfCore/work/06/94b5f115c398030ea983c6dc433e17/minimal_dataset/ELGH_VAL11509206.donor5.h5ad
2022-04-01T14:51:54Z+0100   CRITICAL    [Errno 2] No such file or directory: '/lustre/scratch123/hgi/mdt1/projects/ukbb_scrna/pipelines/hp3_dev/elgh_yascp/yascp/.git/objects/23/9de85972c940378e6d122e8be7731378fef4ad'
  File "/nfs/users/nfs_p/pa11/vault/.venv/bin/vault", line 8, in <module>
    sys.exit(main())
  File "/nfs/users/nfs_p/pa11/vault/.venv/lib/python3.8/site-packages/bin/vault/__init__.py", line 209, in main
    view(Branch.Keep, _view_contexts[context], args.absolute)
  File "/nfs/users/nfs_p/pa11/vault/.venv/lib/python3.8/site-packages/bin/vault/__init__.py", line 72, in view
    elif view_mode == ViewContext.Mine and path.stat().st_uid != os.getuid():
  File "/lustre/scratch118/humgen/resources/conda_envs/R.4/lib/python3.8/pathlib.py", line 1197, in stat
    return self._accessor.stat(self)

This bug happenes because this line https://github.com/wtsi-hgi/hgi-vault/blob/bdb37eb65beafca21b95a6f4fabbceab2d13df4d/bin/vault/__init__.py#L72 in the view function assumes that the source file is available to query its uid. But this assumption is problematic: the source file can be deleted after annotation, in which case the query would cause the software to crash.

michael-grace commented 2 years ago

closing as duplicate of #20