2 |
|
from crab_logger import Logger |
3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
< |
from BlackWhiteListParser import BlackWhiteListParser |
5 |
> |
from BlackWhiteListParser import SEBlackWhiteListParser |
6 |
|
import common |
7 |
|
import Scram |
8 |
|
from LFNBaseName import * |
14 |
|
JobType.__init__(self, 'CMSSW') |
15 |
|
common.logger.debug(3,'CMSSW::__init__') |
16 |
|
self.skip_blocks = skip_blocks |
17 |
< |
|
17 |
> |
|
18 |
|
self.argsList = [] |
19 |
|
|
20 |
|
self._params = {} |
21 |
|
self.cfg_params = cfg_params |
22 |
|
# init BlackWhiteListParser |
23 |
< |
self.blackWhiteListParser = BlackWhiteListParser(cfg_params) |
23 |
> |
self.blackWhiteListParser = SEBlackWhiteListParser(cfg_params) |
24 |
|
|
25 |
< |
self.MaxTarBallSize = float(self.cfg_params.get('EDG.maxtarballsize',9.5)) |
25 |
> |
### Temporary patch to automatically skip the ISB size check: |
26 |
> |
server=self.cfg_params.get('CRAB.server_name',None) |
27 |
> |
size = 9.5 |
28 |
> |
if server: size = 99999 |
29 |
> |
### D.S. |
30 |
> |
self.MaxTarBallSize = float(self.cfg_params.get('EDG.maxtarballsize',size)) |
31 |
|
|
32 |
|
# number of jobs requested to be created, limit obj splitting |
33 |
|
self.ncjobs = ncjobs |
65 |
|
if not cfg_params.has_key('CMSSW.datasetpath'): |
66 |
|
msg = "Error: datasetpath not defined " |
67 |
|
raise CrabException(msg) |
68 |
< |
|
68 |
> |
|
69 |
|
### Temporary: added to remove input file control in the case of PU |
70 |
< |
if not cfg_params.has_key('USER.dataset_pu'): |
71 |
< |
self.dataset_pu = 'NONE' |
67 |
< |
else: |
68 |
< |
self.dataset_pu = cfg_params['USER.dataset_pu'] |
69 |
< |
#### |
70 |
< |
|
70 |
> |
self.dataset_pu = cfg_params.get('CMSSW.dataset_pu', None) |
71 |
> |
|
72 |
|
tmp = cfg_params['CMSSW.datasetpath'] |
73 |
|
log.debug(6, "CMSSW::CMSSW(): datasetPath = "+tmp) |
74 |
|
if string.lower(tmp)=='none': |
125 |
|
msg ="Error. script_exe not defined" |
126 |
|
raise CrabException(msg) |
127 |
|
|
128 |
< |
# use parent files... |
128 |
> |
# use parent files... |
129 |
|
self.useParent = self.cfg_params.get('CMSSW.use_parent',False) |
130 |
|
|
131 |
|
## additional input files |
202 |
|
tmp.strip() |
203 |
|
self.incrementSeeds.append(tmp) |
204 |
|
|
205 |
< |
## Old method of dealing with seeds |
206 |
< |
## FUTURE: This is for old CMSSW and old CRAB. Can throw exceptions after a couple of CRAB releases and then |
206 |
< |
## remove |
207 |
< |
self.sourceSeed = cfg_params.get('CMSSW.pythia_seed',None) |
208 |
< |
if self.sourceSeed: |
209 |
< |
print "pythia_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds." |
210 |
< |
self.incrementSeeds.append('sourceSeed') |
211 |
< |
self.incrementSeeds.append('theSource') |
212 |
< |
|
205 |
> |
## FUTURE: Can remove in CRAB 2.4.0 |
206 |
> |
self.sourceSeed = cfg_params.get('CMSSW.pythia_seed',None) |
207 |
|
self.sourceSeedVtx = cfg_params.get('CMSSW.vtx_seed',None) |
208 |
< |
if self.sourceSeedVtx: |
215 |
< |
print "vtx_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds." |
216 |
< |
self.incrementSeeds.append('VtxSmeared') |
217 |
< |
|
218 |
< |
self.sourceSeedG4 = cfg_params.get('CMSSW.g4_seed',None) |
219 |
< |
if self.sourceSeedG4: |
220 |
< |
print "g4_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds." |
221 |
< |
self.incrementSeeds.append('g4SimHits') |
222 |
< |
|
208 |
> |
self.sourceSeedG4 = cfg_params.get('CMSSW.g4_seed',None) |
209 |
|
self.sourceSeedMix = cfg_params.get('CMSSW.mix_seed',None) |
210 |
< |
if self.sourceSeedMix: |
211 |
< |
print "mix_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds." |
212 |
< |
self.incrementSeeds.append('mix') |
210 |
> |
if self.sourceSeed or self.sourceSeedVtx or self.sourceSeedG4 or self.sourceSeedMix: |
211 |
> |
msg = 'pythia_seed, vtx_seed, g4_seed, and mix_seed are no longer valid settings. You must use increment_seeds or preserve_seeds' |
212 |
> |
raise CrabException(msg) |
213 |
|
|
214 |
|
self.firstRun = cfg_params.get('CMSSW.first_run',None) |
215 |
|
|
230 |
– |
|
216 |
|
# Copy/return |
217 |
|
self.copy_data = int(cfg_params.get('USER.copy_data',0)) |
218 |
|
self.return_data = int(cfg_params.get('USER.return_data',0)) |
252 |
|
## If present, add TFileService to output files |
253 |
|
if not int(cfg_params.get('CMSSW.skip_TFileService_output',0)): |
254 |
|
tfsOutput = PsetEdit.getTFileService() |
255 |
< |
if tfsOutput: |
255 |
> |
if tfsOutput: |
256 |
|
if tfsOutput in self.output_file: |
257 |
|
common.logger.debug(5,"Output from TFileService "+tfsOutput+" already in output files") |
258 |
|
else: |
264 |
|
## If present and requested, add PoolOutputModule to output files |
265 |
|
if int(cfg_params.get('CMSSW.get_edm_output',0)): |
266 |
|
edmOutput = PsetEdit.getPoolOutputModule() |
267 |
< |
if edmOutput: |
267 |
> |
if edmOutput: |
268 |
|
if edmOutput in self.output_file: |
269 |
|
common.logger.debug(5,"Output from PoolOutputModule "+edmOutput+" already in output files") |
270 |
|
else: |
275 |
|
except CrabException: |
276 |
|
msg='Error while manipulating ParameterSet: exiting...' |
277 |
|
raise CrabException(msg) |
278 |
< |
## Prepare inputSandbox TarBall (only the first time) |
278 |
> |
## Prepare inputSandbox TarBall (only the first time) |
279 |
|
self.tgzNameWithPath = self.getTarBall(self.executable) |
280 |
|
|
281 |
|
def DataDiscoveryAndLocation(self, cfg_params): |
483 |
|
if self.useParent: |
484 |
|
fullParentString = pString[:-2] |
485 |
|
list_of_lists.append([fullString,fullParentString,str(eventsPerJobRequested),str(jobSkipEventCount)]) |
486 |
< |
else: |
486 |
> |
else: |
487 |
|
list_of_lists.append([fullString,str(eventsPerJobRequested),str(jobSkipEventCount)]) |
488 |
|
common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.") |
489 |
|
self.jobDestination.append(blockSites[block]) |
881 |
|
txt += 'DatasetPath='+self.datasetPath+'\n' |
882 |
|
|
883 |
|
datasetpath_split = self.datasetPath.split("/") |
884 |
< |
|
884 |
> |
### FEDE FOR NEW LFN ### |
885 |
> |
self.primaryDataset = datasetpath_split[1] |
886 |
> |
######################## |
887 |
|
txt += 'PrimaryDataset='+datasetpath_split[1]+'\n' |
888 |
|
txt += 'DataTier='+datasetpath_split[2]+'\n' |
889 |
|
txt += 'ApplicationFamily=cmsRun\n' |
890 |
|
|
891 |
|
else: |
892 |
|
txt += 'DatasetPath=MCDataTier\n' |
893 |
+ |
### FEDE FOR NEW LFN ### |
894 |
+ |
self.primaryDataset = 'null' |
895 |
+ |
######################## |
896 |
|
txt += 'PrimaryDataset=null\n' |
897 |
|
txt += 'DataTier=null\n' |
898 |
|
txt += 'ApplicationFamily=MCDataTier\n' |
902 |
|
txt += 'cp $RUNTIME_AREA/'+pset+' .\n' |
903 |
|
if (self.datasetPath): # standard job |
904 |
|
txt += 'InputFiles=${args[1]}; export InputFiles\n' |
905 |
< |
if (self.useParent): |
905 |
> |
if (self.useParent): |
906 |
|
txt += 'ParentFiles=${args[2]}; export ParentFiles\n' |
907 |
|
txt += 'MaxEvents=${args[3]}; export MaxEvents\n' |
908 |
|
txt += 'SkipEvents=${args[4]}; export SkipEvents\n' |
933 |
|
txt += 'cat ' + psetName + '\n' |
934 |
|
txt += 'echo "****** end ' + psetName + ' ********"\n' |
935 |
|
txt += '\n' |
936 |
< |
txt += 'PSETHASH=`edmConfigHash < ' + psetName + '` \n' |
936 |
> |
if (self.CMSSW_major >= 2 and self.CMSSW_minor >= 1) or (self.CMSSW_major >= 3): |
937 |
> |
txt += 'PSETHASH=`edmConfigHash ' + psetName + '` \n' |
938 |
> |
else: |
939 |
> |
txt += 'PSETHASH=`edmConfigHash < ' + psetName + '` \n' |
940 |
|
txt += 'echo "PSETHASH = $PSETHASH" \n' |
941 |
|
txt += '\n' |
942 |
|
return txt |
1064 |
|
txt = '\n#Written by cms_cmssw::wsRenameOutput\n' |
1065 |
|
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
1066 |
|
txt += 'echo ">>> current directory content:"\n' |
1067 |
< |
if self.debug_wrapper: |
1067 |
> |
if self.debug_wrapper: |
1068 |
|
txt += 'ls -Al\n' |
1069 |
|
txt += '\n' |
1070 |
|
|
1096 |
|
txt += '\n' |
1097 |
|
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
1098 |
|
txt += 'echo ">>> current directory content:"\n' |
1099 |
< |
if self.debug_wrapper: |
1099 |
> |
if self.debug_wrapper: |
1100 |
|
txt += 'ls -Al\n' |
1101 |
|
txt += '\n' |
1102 |
|
txt += 'cd $RUNTIME_AREA\n' |
1118 |
|
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
1119 |
|
|
1120 |
|
req = req + ' && (other.GlueHostNetworkAdapterOutboundIP)' |
1121 |
< |
if common.scheduler.name() == "glitecoll": |
1121 |
> |
if ( common.scheduler.name() == "glitecoll" ) or ( common.scheduler.name() == "glite"): |
1122 |
|
req += ' && other.GlueCEStateStatus == "Production" ' |
1123 |
|
|
1124 |
|
return req |
1197 |
|
publish_data = int(self.cfg_params.get('USER.publish_data',0)) |
1198 |
|
if (publish_data == 1): |
1199 |
|
processedDataset = self.cfg_params['USER.publish_data_name'] |
1200 |
< |
LFNBaseName = LFNBase(processedDataset) |
1200 |
> |
if (self.primaryDataset == 'null'): |
1201 |
> |
self.primaryDataset = processedDataset |
1202 |
> |
if (common.scheduler.name().upper() == "CAF" or common.scheduler.name().upper() == "LSF"): |
1203 |
> |
### FEDE FOR NEW LFN ### |
1204 |
> |
LFNBaseName = LFNBase(self.primaryDataset, processedDataset, LocalUser=True) |
1205 |
> |
self.user = getUserName(LocalUser=True) |
1206 |
> |
######################## |
1207 |
> |
else : |
1208 |
> |
### FEDE FOR NEW LFN ### |
1209 |
> |
LFNBaseName = LFNBase(self.primaryDataset, processedDataset) |
1210 |
> |
self.user = getUserName() |
1211 |
> |
######################## |
1212 |
|
|
1213 |
|
txt += 'if [ $copy_exit_status -eq 0 ]; then\n' |
1214 |
< |
txt += ' FOR_LFN=%s_${PSETHASH}/\n'%(LFNBaseName) |
1214 |
> |
### FEDE FOR NEW LFN ### |
1215 |
> |
#txt += ' FOR_LFN=%s_${PSETHASH}/\n'%(LFNBaseName) |
1216 |
> |
txt += ' FOR_LFN=%s/${PSETHASH}/\n'%(LFNBaseName) |
1217 |
> |
######################## |
1218 |
|
txt += 'else\n' |
1219 |
|
txt += ' FOR_LFN=/copy_problems/ \n' |
1220 |
|
txt += ' SE=""\n' |
1229 |
|
txt += 'echo "SE_PATH = $SE_PATH"\n' |
1230 |
|
txt += 'echo "FOR_LFN = $FOR_LFN" \n' |
1231 |
|
txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n' |
1232 |
< |
txt += 'echo "$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py $RUNTIME_AREA/crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1233 |
< |
txt += '$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py $RUNTIME_AREA/crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n' |
1232 |
> |
### FEDE FOR NEW LFN ### |
1233 |
> |
txt += 'echo "$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py $RUNTIME_AREA/crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier ' + self.user + '-$ProcessedDataset-$PSETHASH $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1234 |
> |
txt += '$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py $RUNTIME_AREA/crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier ' + self.user + '-$ProcessedDataset-$PSETHASH $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n' |
1235 |
> |
######################## |
1236 |
|
txt += 'modifyReport_result=$?\n' |
1237 |
|
txt += 'if [ $modifyReport_result -ne 0 ]; then\n' |
1238 |
|
txt += ' modifyReport_result=70500\n' |
1258 |
|
txt += ' executable_exit_status=`python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --exitcode`\n' |
1259 |
|
txt += ' if [ $executable_exit_status -eq 50115 ];then\n' |
1260 |
|
txt += ' echo ">>> crab_fjr.xml contents: "\n' |
1261 |
< |
txt += ' cat $RUNTIME_AREA/crab_fjr_NJob.xml\n' |
1261 |
> |
txt += ' cat $RUNTIME_AREA/crab_fjr_$NJob.xml\n' |
1262 |
|
txt += ' echo "Wrong FrameworkJobReport --> does not contain useful info. ExitStatus: $executable_exit_status"\n' |
1263 |
|
txt += ' elif [ $executable_exit_status -eq -999 ];then\n' |
1264 |
|
txt += ' echo "ExitStatus from FrameworkJobReport not available. not available. Using exit code of executable from command line."\n' |
1270 |
|
txt += ' fi\n' |
1271 |
|
#### Patch to check input data reading for CMSSW16x Hopefully we-ll remove it asap |
1272 |
|
|
1273 |
< |
if (self.datasetPath and self.dataset_pu == 'NONE'): |
1273 |
> |
txt += ' if [ $executable_exit_status -eq 0 ];then\n' |
1274 |
> |
txt += ' echo ">>> Executable succeded $executable_exit_status"\n' |
1275 |
> |
if (self.datasetPath and not (self.dataset_pu or self.useParent)) : |
1276 |
|
# VERIFY PROCESSED DATA |
1266 |
– |
txt += ' if [ $executable_exit_status -eq 0 ];then\n' |
1277 |
|
txt += ' echo ">>> Verify list of processed files:"\n' |
1278 |
|
txt += ' echo $InputFiles |tr -d \'\\\\\' |tr \',\' \'\\n\'|tr -d \'"\' > input-files.txt\n' |
1279 |
|
txt += ' python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --lfn > processed-files.txt\n' |
1297 |
|
txt += ' echo " ==> list of processed files from crab_fjr.xml differs from list in pset.cfg"\n' |
1298 |
|
txt += ' echo " ==> diff input-files.txt processed-files.txt"\n' |
1299 |
|
txt += ' fi\n' |
1300 |
< |
txt += ' fi\n' |
1301 |
< |
txt += '\n' |
1300 |
> |
txt += ' elif [ $executable_exit_status -ne 0 ] || [ $executable_exit_status -ne 50015 ] || [ $executable_exit_status -ne 50017 ];then\n' |
1301 |
> |
txt += ' echo ">>> Executable failed $executable_exit_status"\n' |
1302 |
> |
txt += ' func_exit\n' |
1303 |
> |
txt += ' fi\n' |
1304 |
> |
txt += '\n' |
1305 |
|
txt += 'else\n' |
1306 |
|
txt += ' echo "CRAB FrameworkJobReport crab_fjr.xml is not available, using exit code of executable from command line."\n' |
1307 |
|
txt += 'fi\n' |