5 |
|
|
6 |
|
# #################################### |
7 |
|
class DataDiscoveryError(exceptions.Exception): |
8 |
< |
def __init__(self, errorMessage): |
9 |
< |
args=errorMessage |
10 |
< |
exceptions.Exception.__init__(self, args) |
11 |
< |
pass |
12 |
< |
|
13 |
< |
def getErrorMessage(self): |
14 |
< |
""" Return exception error """ |
15 |
< |
return "%s" % (self.args) |
8 |
> |
def __init__(self, errorMessage): |
9 |
> |
args=errorMessage |
10 |
> |
exceptions.Exception.__init__(self, args) |
11 |
> |
pass |
12 |
> |
|
13 |
> |
def getErrorMessage(self): |
14 |
> |
""" Return exception error """ |
15 |
> |
return "%s" % (self.args) |
16 |
|
|
17 |
|
# #################################### |
18 |
|
class NotExistingDatasetError(exceptions.Exception): |
19 |
< |
def __init__(self, errorMessage): |
20 |
< |
args=errorMessage |
21 |
< |
exceptions.Exception.__init__(self, args) |
22 |
< |
pass |
23 |
< |
|
24 |
< |
def getErrorMessage(self): |
25 |
< |
""" Return exception error """ |
26 |
< |
return "%s" % (self.args) |
19 |
> |
def __init__(self, errorMessage): |
20 |
> |
args=errorMessage |
21 |
> |
exceptions.Exception.__init__(self, args) |
22 |
> |
pass |
23 |
> |
|
24 |
> |
def getErrorMessage(self): |
25 |
> |
""" Return exception error """ |
26 |
> |
return "%s" % (self.args) |
27 |
|
|
28 |
|
# #################################### |
29 |
|
class NoDataTierinProvenanceError(exceptions.Exception): |
30 |
< |
def __init__(self, errorMessage): |
31 |
< |
args=errorMessage |
32 |
< |
exceptions.Exception.__init__(self, args) |
33 |
< |
pass |
34 |
< |
|
35 |
< |
def getErrorMessage(self): |
36 |
< |
""" Return exception error """ |
37 |
< |
return "%s" % (self.args) |
30 |
> |
def __init__(self, errorMessage): |
31 |
> |
args=errorMessage |
32 |
> |
exceptions.Exception.__init__(self, args) |
33 |
> |
pass |
34 |
> |
|
35 |
> |
def getErrorMessage(self): |
36 |
> |
""" Return exception error """ |
37 |
> |
return "%s" % (self.args) |
38 |
|
|
39 |
|
# #################################### |
40 |
|
# class to find and extact info from published data |
42 |
|
def __init__(self, datasetPath, dataTiers, cfg_params): |
43 |
|
|
44 |
|
# Attributes |
45 |
< |
self.datasetPath = datasetPath |
45 |
> |
self.datasetPath = datasetPath |
46 |
|
self.dataTiers = dataTiers |
47 |
|
self.cfg_params = cfg_params |
48 |
|
|
63 |
|
dbs_instance="MCLocal/Writer" |
64 |
|
|
65 |
|
dbs = DBSInfo_EDM(dbs_instance) |
66 |
< |
self.datasets = dbs.getMatchingDatasets(self.datasetPath) |
67 |
< |
if len(self.datasets) == 0: |
68 |
< |
raise DataDiscoveryError("DatasetPath=%s unknown to DBS" %self.datasetPath) |
69 |
< |
if len(self.datasets) > 1: |
70 |
< |
raise DataDiscoveryError("DatasetPath=%s is ambiguous" %self.datasetPath) |
66 |
> |
self.datasets = dbs.getMatchingDatasets(self.datasetPath) |
67 |
> |
if len(self.datasets) == 0: |
68 |
> |
raise DataDiscoveryError("DatasetPath=%s unknown to DBS" %self.datasetPath) |
69 |
> |
if len(self.datasets) > 1: |
70 |
> |
raise DataDiscoveryError("DatasetPath=%s is ambiguous" %self.datasetPath) |
71 |
|
|
72 |
|
try: |
73 |
< |
self.dbsdataset = self.datasets[0].get('datasetPathName') |
73 |
> |
self.dbsdataset = self.datasets[0].get('datasetPathName') |
74 |
|
|
75 |
< |
self.evcinfo = dbs.getDatasetContents(self.dbsdataset) |
76 |
< |
self.blocksinfo = dbs.getDatasetFileBlocks(self.dbsdataset) |
75 |
> |
self.evcinfo = dbs.getDatasetContents(self.dbsdataset) |
76 |
> |
self.blocksinfo = dbs.getDatasetFileBlocks(self.dbsdataset) |
77 |
|
except DBSError, ex: |
78 |
< |
raise DataDiscoveryError(ex.getErrorMessage()) |
78 |
> |
raise DataDiscoveryError(ex.getErrorMessage()) |
79 |
|
|
80 |
|
if len(self.evcinfo) <= 0: |
81 |
< |
raise NotExistingDatasetError (("\nNo data for %s in DBS\nPlease check" |
82 |
< |
+ " dataset path variables in crab.cfg") |
83 |
< |
% self.dbsdataset) |
81 |
> |
raise NotExistingDatasetError (("\nNo data for %s in DBS\nPlease check" |
82 |
> |
+ " dataset path variables in crab.cfg") |
83 |
> |
% self.dbsdataset) |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
# ################################################# |
88 |
|
def getMaxEvents(self): |
89 |
|
""" |
90 |
< |
max events |
90 |
> |
max events |
91 |
|
""" |
92 |
|
## loop over the event collections |
93 |
|
nevts=0 |
94 |
|
for evc_evts in self.evcinfo.values(): |
95 |
< |
nevts=nevts+evc_evts |
95 |
> |
nevts=nevts+evc_evts |
96 |
|
|
97 |
|
return nevts |
98 |
|
|
99 |
|
# ################################################# |
100 |
|
def getEVC(self): |
101 |
|
""" |
102 |
< |
list the event collections structure by fileblock |
102 |
> |
list the event collections structure by fileblock |
103 |
|
""" |
104 |
|
print "To be used by a more complex job splitting... TODO later... " |
105 |
|
print "it requires changes in what's returned by DBSInfo.getDatasetContents and then fetchDBSInfo" |
107 |
|
# ################################################# |
108 |
|
def getFiles(self): |
109 |
|
""" |
110 |
< |
return files grouped by fileblock |
110 |
> |
return files grouped by fileblock |
111 |
|
""" |
112 |
|
return self.blocksinfo |
113 |
|
|