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 |
afanfani |
1.3 |
self.DLSServer_ = 'lxgate10.cern.ch'
|
20 |
|
|
self.DLSServerPort_ = '18081'
|
21 |
|
|
#self.DLSServerPort_ = '18080'
|
22 |
afanfani |
1.1 |
|
23 |
|
|
# ####################################
|
24 |
|
|
def getReplicas(self):
|
25 |
|
|
"""
|
26 |
|
|
query DLS to get replicas
|
27 |
|
|
"""
|
28 |
afanfani |
1.3 |
##
|
29 |
|
|
cmd = self.DLSclient_+" --port "+self.DLSServerPort_+" --host "+self.DLSServer_+" --datablock "+self.fileblocks
|
30 |
afanfani |
1.1 |
sites = runCommand(cmd)
|
31 |
afanfani |
1.2 |
ListSites=string.split(string.strip(sites),'\n')
|
32 |
afanfani |
1.1 |
return ListSites
|