inveniosoftware / inveniosoftware/xrootdpyfs

xrootdpyfs: fix extended attributes fetch

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8
Forks
20
PR merge metrics
No merged PRs in 30d

Description

## Problem

After an upload fails we try to delete the file(s) from the FS. This operation eventually checks whether the file is a directory (using the fs `getinfo` [method](https://github.com/inveniosoftware/xrootdpyfs/blob/403566c8e3dce8ce7f47cdc8c13d863d299e9c11/xrootdpyfs/fs.py#L490)). In turn, this executes `fs._query(QueryCode.XATTR, path)` which is not a valid query for XATTR (it seems it's an unsupported operation).

---

## Possible fix

From what I see, the client supports extended attributes listing which I believe would be what we need. I ran some tests in the CLI and seems to be OK:

```python
from xrootdpyfs.fs import XRootDPyFS

url = '...'
fs = XRootDPyFS(url)
path = '...'

# Current code that fails
fs._query(QueryCode.XATTR, path)

# Alternative code
extended_attr = fs._client.list_xattr(path)
```

In the example above, I realised that we have another issue when [raising](https://github.com/inveniosoftware/xrootdpyfs/blob/403566c8e3dce8ce7f47cdc8c13d863d299e9c11/xrootdpyfs/fs.py#L173) the fs exceptions (e.g. `Unsupported`). We must use raise `Unsupported(msg=status.message)`. This is also being tracked by https://github.com/inveniosoftware/xrootdpyfs/issues/122

If this is fixed, we could potentially have more visibility on why the upload failed on the first place (to be tested)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.