Oscar's notes on XRootD access to Grid storage
It seems that at least in CMS (and at CERN, due to EOS), the most supported and
standarized way to access the storage space in the Grid (and others, like EOS)
is XRootD. The traditional commands based on srm
and gfal tools are still working, but the XRootD commands
should be preferred when available.
Here I document the main tools for achieving the goals. It should be noted that
the main difficulty with XRootD is the need most of the time of the
correct name for the locations. Sometimes this can be avoided
using xrd[fs] but not always. In the examples below one can find the correct names to be used.
Basic handling of files
- To list the content of a directory or the existence of a file:
xrd eoscms dirlist /eos/cms/store/user/oglez
xrd eoscms.cern.ch ls /eos/cms/store/user/oglez
xrd gaexrdoor.ciemat.es ls /store/user/oglez
where it should be noted that the CIEMAT area does not recognize the full path,
but the one for EOS allows both of them.
It seems that xrd and xrdfs are basically the same command.
- To create a directory (creating needed parents by default!):
xrd eoscms mkdir /eos/cms/store/user/oglez/test
that does not work at CIEMAT because only read-premission is allowed (?). The
use of the traditional tools is required for write actions.
- To change the permissions:
xrd eoscms chmod /eos/cms/store/user/oglez 7 7 5
- To copy a file:
xrdcp test.test root://eoscms//eos/cms/store/user/oglez/test/test.txt
xrd eoscms cp /eos/cms/store/user/oglez/test.txt /eos/cms/store/user/oglez/test.txt
Note that the last one assumes that the indicated directory are in
root://eoscms/, so it is only convenient when changing stuff (e.g. rename
using xrd eoscms rm since xrd eoscms mv is not supported). the use of xrdfs is not allowed for copy, it seems.
- To view a file:
xrd eoscms cat /eos/cms/store/user/oglez/test.txt
- To delete a file or a directory:
xrd eoscms rm [-r] /eos/cms/store/user/oglez/test
xrd eoscms rmdir /eos/cms/store/user/oglez/test
- To check whether a file is online (available?)
xrd eoscms isfileonline /eos/cms/store/user/oglez/test.txt
Opening ROOT files from the Grid
Opening a ROOT file located in the Grid is trivial using the XrootD protocol:
TFile *file = TFile::Open("root://eoscms//eos/cms/store/user/oglez/test.root");
TFile *file = TFile::Open("root://gaexrdoor.ciemat.es//store/user/oglez/test.root");
Using a file in the Grid inside a local CMS job is similar:
fileNames = cms.untracked.vstring("root://eoscms//eos/cms/store/caf/user/oglez/...")
It should be noted that a documented/archived official CMS file can be accessed with a generic "direction":
fileNames = cms.untracked.vstring("root://cms-xrd-global.cern.ch//store/...")
which of course also works in the usual ROOT.
XRootD and the Grid interaction
In principle XRootD is the default way of accessing the files in the
Grid these days, at least in which respect the interaction with EOS. It should
be noted that this does not imply to use the XRootD
commands... in fact one can use the GFal tools using
the XRootD protocol, as in the examples:
gfal-copy root://gaexrdoor.ciemat.es//store/user/oglez/hola.txt .
gfal-copy hola.txt root://eoscms.cern.ch//store/user/oglez/hola.cv .
On the other hand it should be remarked that the T2_ES_CIEMAT allows the
read-access using this XRootD protocol, but not for write-access. It
is unfortunate, and it may be changed in the future, but for writing in the
T2_ES_CIEMAT one needs the SRM protocol.
Comments about the web page: Oscar González