XRootDPyFS is a PyFilesystem interface to XRootD.
XRootD protocol aims at giving high performance, scalable fault tolerant access to data repositories of many kinds. The XRootDPyFS adds a high-level interface on top of the existing Python interface (pyxrootd) and makes it easy to e.g. copy a directory in parallel or recursively remove a directory.
Further documentation is available on https://xrootdpyfs.readthedocs.io/.
Getting started
If you just want to try out the library, the easiest is to use Docker.
$ docker build -t xrootd .
$ docker run -h xrootdpyfs -it xrootd bash
Next, start a XRootD server in the container and fire up an ipython shell:
[xrootdpyfs@xrootdpyfs code]$ xrootd -b -l /dev/null
[xrootdpyfs@xrootdpyfs code]$ ipython
Quick examples
Here is a quick example of a file listing with the xrootd PyFilesystem integration:
>>> from xrootdpyfs import XRootDPyFS
>>> fs = XRootDPyFS("root://localhost//tmp/")
>>> fs.listdir("xrootdpyfs")
['test.txt']
Or, alternatively using the PyFilesystem opener (note the first import xrootdpyfs is required to ensure the XRootDPyFS opener is registered):
>>> import xrootdpyfs
>>> from fs.opener import opener
>>> fs, path = opener.parse("root://localhost//tmp/")
>>> fs.listdir("xrootdpyfs")
[u'test.txt']
Reading files:
>>> f = fs.open("xrootdpyfs/test.txt")
>>> f.read()
'Welcome to xrootdpyfs!'
>>> f.close()
Reading files using the getcontents() method:
>>> fs.getcontents("xrootdpyfs/test.txt")
'Welcome to xrootdpyfs!'
Writing files:
>>> f = fs.open("xrootdpyfs/hello.txt", "w+")
>>> f.write("World")
>>> f.close()
Writing files using the setcontents() method:
>>> fs.setcontents("xrootdpyfs/test.txt", "World")
Development
The easiest way to develop is to build the Docker image and mount the source code as a volume to test any code modification with a running XRootD server:
$ docker build -t xrootd .
$ docker run -h xrootdpyfs -it -v <absolute path to this project>:/code xrootd bash
[xrootdpyfs@xrootdpyfs code]$ xrootd -b -l /dev/null
If you want to test a specific version of xrootd, run:
$ docker build --build-arg xrootd_version=4.8.5 -t xrootd .
Documentation
Documentation is available at <http://xrootdpyfs.readthedocs.io/> or can be build using Sphinx:
pip install Sphinx python setup.py build_sphinx
Testing
Running the tests are most easily done using docker:
$ docker build -t xrootd . && docker run -h xrootdpyfs -it xrootd
Release files for xrootdpyfs 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xrootdpyfs-0.2.1.tar.gz | 39.0 kB | Details |
Release files / xrootdpyfs-0.2.1.tar.gz
| Download URL | xrootdpyfs-0.2.1.tar.gz |
|---|---|
| Size | 39.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbcc16ca696f31ba115cf00713a659d4246f1a5c7677c8d4d7c8ba3d6e473e24
|
|
BLAKE2b-256 checksum How to use checksums |
2fc9da24b5a97e62c4b9711e101e3579bea6adbc82021b2d1eaf0996ef23e0d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|