75 |
|
self.dataset_to_import.append(dataset) |
76 |
|
### |
77 |
|
|
78 |
< |
self.import_all_parents = cfg_params.get('USER.publish_with_import_all_parents',0) |
78 |
> |
self.import_all_parents = cfg_params.get('USER.publish_with_import_all_parents',1) |
79 |
|
self.skipOcheck=cfg_params.get('CMSSW.publish_zero_event',0) |
80 |
|
|
81 |
|
self.SEName='' |
92 |
|
dbsWriter = DBSWriter(self.DBSURL,level='ERROR') |
93 |
|
|
94 |
|
try: |
95 |
< |
if (self.import_all_parents=='1'): |
95 |
> |
if (self.import_all_parents==1): |
96 |
|
common.logger.info("--->>> Importing all parents level") |
97 |
< |
dbsWriter.importDataset(globalDBS, datasetpath, self.DBSURL) |
97 |
> |
start = time.time() |
98 |
> |
common.logger.debug("start import time: " + str(start)) |
99 |
> |
### to skip the ProdCommon api exception in the case of block without location |
100 |
> |
### skipNoSiteError=True |
101 |
> |
#dbsWriter.importDataset(globalDBS, datasetpath, self.DBSURL, skipNoSiteError=True) |
102 |
> |
### calling dbs api directly |
103 |
> |
dbsWriter.dbs.migrateDatasetContents(globalDBS, self.DBSURL, datasetpath) |
104 |
> |
stop = time.time() |
105 |
> |
common.logger.debug("stop import time: " + str(stop)) |
106 |
> |
common.logger.info("--->>> duration of all parents import (sec): "+str(stop - start)) |
107 |
> |
|
108 |
|
else: |
109 |
|
common.logger.info("--->>> Importing only the datasetpath " + datasetpath) |
110 |
< |
dbsWriter.importDatasetWithoutParentage(globalDBS, datasetpath, self.DBSURL) |
110 |
> |
start = time.time() |
111 |
> |
#dbsWriter.importDatasetWithoutParentage(globalDBS, datasetpath, self.DBSURL, skipNoSiteError=True) |
112 |
> |
### calling dbs api directly |
113 |
> |
common.logger.debug("start import time: " + str(start)) |
114 |
> |
dbsWriter.dbs.migrateDatasetContents(globalDBS, self.DBSURL, datasetpath, noParentsReadOnly = True ) |
115 |
> |
stop = time.time() |
116 |
> |
common.logger.debug("stop import time: " + str(stop)) |
117 |
> |
common.logger.info("--->>> duration of first level parent import (sec): "+str(stop - start)) |
118 |
|
except DBSWriterError, ex: |
119 |
|
msg = "Error importing dataset to be processed into local DBS\n" |
120 |
|
msg += "Source Dataset: %s\n" % datasetpath |
121 |
|
msg += "Source DBS: %s\n" % globalDBS |
122 |
|
msg += "Destination DBS: %s\n" % self.DBSURL |
123 |
|
common.logger.info(msg) |
124 |
< |
common.logger.debug(str(ex)) |
124 |
> |
common.logger.info(str(ex)) |
125 |
|
return 1 |
126 |
|
return 0 |
127 |
< |
""" |
111 |
< |
print " patch for importParentDataset: datasetpath = ", datasetpath |
112 |
< |
try: |
113 |
< |
args={} |
114 |
< |
args['url']=self.DBSURL |
115 |
< |
args['mode']='POST' |
116 |
< |
block = "" |
117 |
< |
api = DbsApi(args) |
118 |
< |
#api.migrateDatasetContents(srcURL, dstURL, path, block , False) |
119 |
< |
api.migrateDatasetContents(globalDBS, self.DBSURL, datasetpath, block , False) |
120 |
< |
|
121 |
< |
except DbsException, ex: |
122 |
< |
print "Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage() ) |
123 |
< |
if ex.getErrorCode() not in (None, ""): |
124 |
< |
print "DBS Exception Error Code: ", ex.getErrorCode() |
125 |
< |
return 1 |
126 |
< |
print "Done" |
127 |
< |
return 0 |
128 |
< |
""" |
127 |
> |
|
128 |
|
def publishDataset(self,file): |
129 |
|
""" |
130 |
|
""" |
155 |
|
self.exit_status = '0' |
156 |
|
except IndexError: |
157 |
|
self.exit_status = '1' |
158 |
< |
msg = "Error: No file to publish in xml file"+file+" file" |
158 |
> |
msg = "Error: No EDM file to publish in xml file"+file+" file" |
159 |
|
common.logger.info(msg) |
160 |
|
return self.exit_status |
161 |
|
|
267 |
|
|
268 |
|
file_list = glob.glob(self.resDir+"crab_fjr*.xml") |
269 |
|
## Select only those fjr that are succesfull |
270 |
+ |
if (len(file_list)==0): |
271 |
+ |
common.logger.info("--->>> "+self.resDir+" empty: no file to publish on DBS") |
272 |
+ |
self.exit_status = '1' |
273 |
+ |
return self.exit_status |
274 |
+ |
|
275 |
|
good_list=[] |
276 |
|
for fjr in file_list: |
277 |
|
reports = readJobReport(fjr) |
335 |
|
return self.exit_status |
336 |
|
|
337 |
|
else: |
338 |
< |
common.logger.info("--->>> "+self.resDir+" empty: no file to publish on DBS") |
338 |
> |
common.logger.info("--->>> No valid files to publish on DBS. Your jobs do not report exit codes = 0") |
339 |
|
self.exit_status = '1' |
340 |
|
return self.exit_status |
341 |
|
|