Python SRB

SRB is a "Data Grid Management System (DGMS) that provides a hierarchical logical namespace to manage the organization of data (usually files)." SRB Home

A basic Python interface to SRB is available in the standard client SRB3_4_2client.tar.

== Installation Instructions: Linux==

Un-tar the client archive:

$ tar -xvf SRB3_4_2client.tar

If you are building on a 64bit system such as amd64, you must change the MY_CFLAG stanza at SRB3_4_2/mk/mk.common:101 from

MY_CFLAG+= -g

to

MY_CFLAG+= -g -fPIC

Now, configure and make:

$ cd SRB3_4_2
$ ./configure
$ make

Enter the SRB3_4_2/python subdir

cd python

Save this script as setup.py in the SRB3_4_2/python subdir

# PythonSRB distutils script 
# Source: http://plone.jcu.edu.au/hpc/staff/projects/apac/grid-ii/srb/srbpythonfolder/setup-linux.py/view
from distutils.core import setup, Extension

module1 = Extension('srb',
                    define_macros = [('_LARGEFILE_SOURCE', None), 
		                     ('_FILE_OFFSET_BITS','64'), 
				     ('_LARGEFILE64_SOURCE',None),
				     ('PARA_OPR','1'),
				     ('FED_MCAT',None),
				     ('PORTNAME_linux',None)
				     ],
		    include_dirs = ['/usr/include/python2.4','./include/','../src/include',
                                    '../src/catalog/include','../tape/include','../utilities/include',
                                    '../python/include'],
                    libraries = ['pthread',],
		    extra_link_args=['../obj/clAuth.o','../obj/clConnect.o','../obj/clExec.o',
                                     '../obj/clMisc.o','../obj/clStub.o','../obj/packMsg.o',
                                     '../obj/clGlobal.o','../obj/clChksum.o','../obj/mcatgeneral.o',
                                     '../obj/srb_perror.o','../obj/crypt1.o','../obj/srbSecureComm.o',
                                     '../obj/obf.o','../utilities/obj/srbClientUtil.o',
                                     '../utilities/obj/bunloadLib.o',],
                    sources = ['src/pysrb_util.c','src/py_srb.c'])

setup (name = 'srb',
       version = '3.4',
       description = 'Provides python bindings to SRB.',
       author = 'Bing Zhu',
       author_email = '',
       url = 'http://www.sdsc.edu/srb/',
       long_description = '''
SRB Python binding. The new SRB Python binding exposes some SRB client APIs which allow any Python program to access SRB systems via POSIX style file I/O calls, to query SRB system metadata for files, and to manipulate SRB systems such as creating and deleting a collection. A file, README.python, included in SRB source tree, provides an overview of SRB Python binding and an example of using SRB Python binding APIs. This has been part of the SRB release since 2.1.
''',
       ext_modules = [module1])

Use the setup script to build PythonSRB:

python setup.py build

Install in your site packages:

Global (as root)

python setup.py install

Prefix (local user location, if you do not have root access)

python setup.py install --prefix=$HOME/opt/srb

Note: for this method, you must add $HOME/opt/srb/lib64/python2.4/site-packages to your PYTHON_PATH, or in Python, your sys.path list.

Now you should be able to import srb in python:

$ python
>>> import srb