XrdPosixPreload + python

From: Brett Viren <bv_at_bnl.gov>
Date: Thu, 1 Jul 2010 11:49:01 -0400


Hi,

I'm trying to use libXrdPosixPreload and python to get a listing of a directory that is under Xrootd control. ROOT is 5.26/00b on x86_64-slc5-gcc43-dbg. The preloaded library works great with the usual "ls" program but Python's directory access functions fail. Python is 2.5.4.

Below I show my test setup.

Under bash, this works:

 LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so \  XROOTD_VMP=daya0001:/xrootd/ \
 /bin/ls root://daya0002//xrootd/

But, this doesn't:

 LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so \  XROOTD_VMP=daya0001:/xrootd/ \
 python xrootd.py ls root://daya0002//xrootd/

For good measure, inside the "xrootd.py" program I also set the LD_PRELOAD and XROOTD_VMP variables like this:

def preload():

    import os
    rootsys = os.environ['ROOTSYS']
    xrdpp = '%s/lib/libXrdPosixPreload.so'%rootsys

    print 'Preloading "%s"'%xrdpp
    os.environ['LD_PRELOAD'] = xrdpp
    os.environ['XROOTD_VMP'] = 'daya0001:/xrootd/'
    return

The "ls" sub-command runs this little function:

def ls(path):

    preload()
    import os
    return os.listdir(path)

But, it fails with:



Traceback (most recent call last):
  File "xrootd.py", line 56, in <module>     print func(*sys.argv[2:])
  File "xrootd.py", line 35, in ls
    return os.listdir(path)
OSError: [Errno 115] Operation now in progress: 'root://daya0002//xrootd/'

However, some things do work from Python. For example I can successfully check for the existence of a path with:

def exists(path):

    preload()
    import os
    return os.access(path,os.F_OK)

This:

 LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so \  XROOTD_VMP=daya0001:/xrootd/ \
 python xrootd.py exists root://daya0002//xrootd/MDC09b/output/MDCLED_RACF_DRY_D11003.root

prints "True" and:

 LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so \  XROOTD_VMP=daya0001:/xrootd/ \
 python xrootd.py exists root://daya0002//xrootd/bogus

gives "False" as it should.

So, anyone have any ideas?

Thanks!
-Brett.

Received on Thu Jul 01 2010 - 17:49:07 CEST

This archive was generated by hypermail 2.2.0 : Sat Jul 03 2010 - 23:50:01 CEST