Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change permissions on NFS4 ACL filesystems in order to remove git annex files #141

Open
Michael-Sun opened this issue Sep 28, 2023 · 1 comment

Comments

@Michael-Sun
Copy link

On the NFS4 ACL filesystem, git annex generates read-only files, some info about it here: https://git-annex.branchable.com/tips/git-annex_on_NFS/

What this means is if BABS is deleting annexed files to save space, it must change permissions in such a way that is compliant in such file systems e.g., nfs4_setfacl -R -a A:fd:OWNER@:RWX babs_demo

Not doing so results in many BABS operations breaking e.g., babs-init:

You asked to amend the most recent commit, but doing so would make
it empty. You can repeat your command with --allow-empty, or you can
remove the commit entirely with "git reset HEAD^".

babs-init failed! Below is the error message:
Traceback (most recent call last):
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/lib/python3.9/site-packages/babs/cli.py", line 234, in babs_init_main
babs_proj.babs_bootstrap(input_ds,
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/lib/python3.9/site-packages/babs/babs.py", line 386, in babs_bootstrap
proc_git_commit_amend.check_returncode()
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/lib/python3.9/subprocess.py", line 460, in check_returncode
raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['git', 'commit', '--amend', '-m', "Register input data dataset '1080_wasabi' as a subdataset"]' returned non-zero exit status 1.

Cleanup operations:

Cleaning up created BABS project...
Removing input dataset(s) if cloned...
Traceback (most recent call last):
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/babs/cli.py", line 234, in babs_init_main
babs_proj.babs_bootstrap(input_ds,
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/babs/babs.py", line 425, in babs_bootstrap
dlapi.install(dataset=self.analysis_path,
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/base.py", line 773, in eval_func
return return_func(*args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/base.py", line 763, in return_func
results = list(results)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad_next/patches/interface_utils.py", line 287, in execute_command
raise IncompleteResultsError(
datalad.support.exceptions.IncompleteResultsError: Command did not complete successfully. 1 failed:
[{'action': 'install',
'message': ('Failed to clone from any candidate source URL. Encountered '
'errors per each url were:\n'
'- %s',
'/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container\n'
" CommandError: 'git -c diff.ignoreSubmodules=none -c "
'core.quotepath=false clone --progress '
'/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container '
"/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/my_BABS_project/analysis/containers' "
"failed with exitcode 128 [err: 'fatal: repository "
"'/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container' "
"does not exist']"),
'path': '/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/my_BABS_project/analysis/containers',
'refds': '/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/my_BABS_project/analysis',
'source': {'default_destpath': 'toybidsapp-container',
'giturl': '/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container',
'source': '/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container',
'type': 'giturl',
'version': None},
'source_url': '/dartfs-hpc/rc/lab/C/CANlab/labdata/data/babs_demo/toybidsapp-container',
'status': 'error',
'type': 'dataset'}]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/bin/babs-init", line 8, in
sys.exit(babs_init_main())
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/babs/cli.py", line 243, in babs_init_main
babs_proj.clean_up(input_ds)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/babs/babs.py", line 591, in clean_up
_ = self.analysis_datalad_handle.remove(
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/distribution/dataset.py", line 507, in apply_func
return f(*args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/base.py", line 773, in eval_func
return return_func(*args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/base.py", line 763, in return_func
results = list(results)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad_next/patches/interface_utils.py", line 218, in execute_command
for r in _process_results(
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/utils.py", line 319, in _process_results
for res in results:
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/local/remove.py", line 212, in call
for res in Drop.call(
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad_next/patches/interface_utils.py", line 218, in execute_command
for r in _process_results(
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/interface/utils.py", line 319, in _process_results
for res in results:
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/distributed/drop.py", line 268, in call
for res in _drop_dataset(
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/distributed/drop.py", line 456, in _drop_dataset
yield from _kill_dataset(ds)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/distributed/drop.py", line 735, in _kill_dataset
rmtree(ds.path)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/utils.py", line 550, in rmtree
_rmtree(path, *args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/utils.py", line 2181, in _wrap_try_multiple_dec
return f(*args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/site-packages/datalad/utils.py", line 2223, in _rmtree
shutil.rmtree(*args, **kwargs)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 734, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 667, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 667, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 667, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
[Previous line repeated 6 more times]
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 690, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/dartfs-hpc/rc/home/j/f003z4j/miniconda3/envs/physio/babs/lib/python3.9/shutil.py", line 688, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'XDLRA--refs'

@zhao-cy
Copy link
Collaborator

zhao-cy commented Oct 5, 2023

Hi @Michael-Sun ! Thank you very much for reporting this + the way to get around! I just hoped to ask you for clarifications: based on slack messages between you and Matt, I know originally it was the problem when you manually deleted a BABS project, so for this I think we can just add how to do so on NFS4 system to the docs.

But based on what you reported above, it sounds like without doing so, you would always get issues with babs-init when it does git commit --amend? And also would always get issues when something went wrong and babs-init wants to clean up the BABS project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants