Skip to main content

XRootDPyFS is a PyFilesystem interface to XRootD.

Project description

https://github.com/inveniosoftware/xrootdpyfs/actions?query=workflow%3ACI.svg?branch=master https://coveralls.io/repos/inveniosoftware/xrootdpyfs/badge.svg?branch=master https://pypip.in/v/xrootdpyfs/badge.svg

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")
['test.txt']

Reading files:

>>> f = fs.open("xrootdpyfs/test.txt")
>>> f.read()
b'Hello XRootD!\n'
>>> f.close()

Reading files using the getcontents() method:

>>> fs.getcontents("xrootdpyfs/test.txt")
b'Hello XRootD!\n'

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 --progress=plain .
$ 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 --progress=plain .

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xrootdpyfs-0.2.2.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

xrootdpyfs-0.2.2-py2.py3-none-any.whl (21.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file xrootdpyfs-0.2.2.tar.gz.

File metadata

  • Download URL: xrootdpyfs-0.2.2.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for xrootdpyfs-0.2.2.tar.gz
Algorithm Hash digest
SHA256 43698c260f3ec52320c6bfac8dd3e7c2be7d28e9e9f58edf4f916578114e82bf
MD5 2510f93942886f9d253bfbeccc9b41c8
BLAKE2b-256 c096ee850152791e8900a5478972ab415b837d37903ff6e45f0ff5ba8ccdc5d9

See more details on using hashes here.

File details

Details for the file xrootdpyfs-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: xrootdpyfs-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for xrootdpyfs-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c2fae96c7e8039c274aa5acc606cabc11648a20afa9aaabb275e01d69961e082
MD5 c42195ecef7df7835af280865cde5036
BLAKE2b-256 ae2c069484b2d26518bfbc9e4488371fbfa196e45e89f8f0f76c99727bdbc46d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page