Exemplo n.º 1
0
            self.printd('ERROR: %s' % str(e))
            return ('UNKNOWN', 'Error opening local file.')

        req = {'surls'          : srms,
               'defaultsetype'  : 'srmv'+self.svcVer,
               'setype'         : 'srmv'+self.svcVer,
               'timeout'        : self._timeouts['srm_connect'],
               'srmv2_lslevels' : 0,
               'no_bdii_check'  : 1
               }
        self.printd('Using gfal_ls().')
        self.printd('Parameters:\n%s' % '\n'.join(
                        ['  %s: %s' % (x,str(y)) for x,y in req.items()]))
        errmsg = ''
        try:
            (rc, gfalobj, errmsg) = gfal.gfal_init(req)
        except MemoryError, e:
            try: gfal.gfal_internal_free(gfalobj)
            except StandardError: pass
            summary = 'error initialising GFAL: %s' % str(e)
            self.printd('ERROR: %s' % summary)
            return ('UNKNOWN', summary)
        else:
            if rc != 0:
                summary = 'problem initialising GFAL: %s' % errmsg
                self.printd('ERROR: %s' % summary)
                return ('UNKNOWN', summary)

        self.print_time()
        self.printd('Listing storage url(s).')
        try:
Exemplo n.º 2
0
    surls.append(m.sub('srm://srm.grid.sara.nl:8443/srm/managerv2?SFN=/pnfs',strip(u)))


req={}

# Set the timeout to 24 hours
# gfal_set_timeout_srm  Sets  the  SRM  timeout, used when doing an asyn-
# chronous SRM request. The request will be aborted if it is still queued
# after 24 hours.
gfal.gfal_set_timeout_srm(86400)

req.update({'surls':surls})
req.update({'setype':'srmv2'})
req.update({'no_bdii_check':1})
req.update({'protocols':['gsiftp']})

#Set the time that the file stays pinned on disk for a week (604800 sec)
req.update({'srmv2_desiredpintime':604800})

returncode,object,err=gfal.gfal_init(req)
if returncode != 0:
        sys.stderr.write(err+'\n')
        sys.exit(1)

returncode,object,err=gfal.gfal_prestage(object)
if returncode != 0:
    sys.stderr.write(err+'\n')
    sys.exit(1)
del req

Exemplo n.º 3
0
f=open('files','r')
urls=f.readlines()
f.close()

surls=[]
for u in urls:
    surls.append(m.sub('srm://srm.grid.sara.nl:8443/srm/managerv2?SFN=/pnfs',strip(u)))
#print(surls)
mx=len(surls)
#print(mx)
i=0

while i<mx:
    req={}
    mxi=min(i+nf,mx)
    s=surls[i:mxi]
    req.update({'surls':s})
    req.update({'setype':'srmv2'})
    req.update({'no_bdii_check':1})
    req.update({'srmv2_lslevels':1})
    req.update({'protocols':['gsiftp']})
    a,b,c=gfal.gfal_init(req)
    a,b,c=gfal.gfal_ls(b)
    a,b,c=gfal.gfal_get_results(b)
    for j in range(0,len(c)):
       print(c[j]['surl']+" "+c[j]['locality'])
#       print(c[j]['surl']+" "+c[j]['\- Checksum value'])
    i=i+nf
    time.sleep(1)

Exemplo n.º 4
0
    surls.append(
        m.sub('srm://srm.grid.sara.nl:8443/srm/managerv2?SFN=/pnfs', strip(u)))
#print(surls)

req = {}

# Set the timeout to 24 hours
# gfal_set_timeout_srm  Sets  the  SRM  timeout, used when doing an asyn-
# chronous SRM request. The request will be aborted if it is still queued
# after 24 hours.
gfal.gfal_set_timeout_srm(86400)

req.update({'surls': surls})
req.update({'setype': 'srmv2'})
req.update({'no_bdii_check': 1})
req.update({'protocols': ['gsiftp']})
# Decision factor
#Set the time that the file stays pinned on disk for a week (604800 sec)
req.update({'srmv2_desiredpintime': 604800})

returncode, object, err = gfal.gfal_init(req)
if returncode != 0:
    sys.stderr.write(err + '\n')
    sys.exit(1)

returncode, object, err = gfal.gfal_prestage(object)
if returncode != 0:
    sys.stderr.write(err + '\n')
    sys.exit(1)
del req
Exemplo n.º 5
0
 def __init__(self, request):
     rc, self.gfal, errmsg = gfal.gfal_init(request)
     if rc < 0:
         raise RequestError(errmsg)
Exemplo n.º 6
0
m=re.compile('/pnfs')
nf=100

f=open('files','r')
urls=f.readlines()
f.close()

surls=[]
for u in urls:
    surls.append(m.sub('srm://srm.grid.sara.nl:8443/srm/managerv2?SFN=/pnfs',strip(u)))

mx=len(surls)

i=0
while i<mx:
    req={}
    mxi=min(i+nf,mx)
    s=surls[i:mxi]
    req.update({'surls':s})
    req.update({'setype':'srmv2'})
    req.update({'no_bdii_check':1})
    req.update({'srmv2_lslevels':1})
    req.update({'protocols':['gsiftp']})
    a,b,c=gfal.gfal_init(req)
    a,b,c=gfal.gfal_ls(b)
    a,b,c=gfal.gfal_get_results(b)
    for j in range(0,len(c)):
       print c[j]['surl']+" "+c[j]['locality']
    i=i+nf
    time.sleep(1)
Exemplo n.º 7
0
 def __init__(self,request):
     rc, self.gfal, errmsg = gfal.gfal_init(request)
     if rc < 0:
         raise RequestError(errmsg)