1 |
afanfani |
1.1 |
#!/usr/bin/env python
|
2 |
|
|
import sys, os, commands,string, re
|
3 |
|
|
from crab_util import *
|
4 |
|
|
import common
|
5 |
|
|
|
6 |
|
|
class DLSError:
|
7 |
|
|
def __init__(self, fileblocks):
|
8 |
|
|
print '\nERROR accessing DLS for fileblock '+fileblocks+'\n'
|
9 |
|
|
pass
|
10 |
|
|
|
11 |
|
|
##############################################################################
|
12 |
|
|
# Class to extract info from DLS
|
13 |
|
|
##############################################################################
|
14 |
|
|
|
15 |
|
|
class DLSInfo:
|
16 |
|
|
def __init__(self, fileblocks):
|
17 |
|
|
self.fileblocks = fileblocks
|
18 |
|
|
self.DLSclient_ = 'DLSAPI/dls-get-se '
|
19 |
|
|
self.DLSServer_ = 'cmsbogw.bo.infn.it'
|
20 |
|
|
|
21 |
|
|
# ####################################
|
22 |
|
|
def getReplicas(self):
|
23 |
|
|
"""
|
24 |
|
|
query DLS to get replicas
|
25 |
|
|
"""
|
26 |
|
|
##
|
27 |
|
|
cmd = self.DLSclient_+" --host "+self.DLSServer_+" --datablock "+self.fileblocks
|
28 |
|
|
#print cmd
|
29 |
|
|
sites = runCommand(cmd)
|
30 |
|
|
ListSites=string.split(sites,'\n')
|
31 |
|
|
return ListSites
|