2 |
|
from crab_logger import Logger |
3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
< |
from BlackWhiteListParser import SEBlackWhiteListParser |
5 |
> |
from WMCore.SiteScreening.BlackWhiteListParser import SEBlackWhiteListParser |
6 |
|
import common |
7 |
|
import Scram |
8 |
|
|
18 |
|
|
19 |
|
self._params = {} |
20 |
|
self.cfg_params = cfg_params |
21 |
+ |
|
22 |
|
# init BlackWhiteListParser |
23 |
< |
self.blackWhiteListParser = SEBlackWhiteListParser(cfg_params) |
23 |
> |
seWhiteList = cfg_params.get('EDG.se_white_list',[]) |
24 |
> |
seBlackList = cfg_params.get('EDG.se_black_list',[]) |
25 |
> |
self.blackWhiteListParser = SEBlackWhiteListParser(seWhiteList, seBlackList, common.logger) |
26 |
|
|
27 |
|
### Temporary patch to automatically skip the ISB size check: |
28 |
|
server=self.cfg_params.get('CRAB.server_name',None) |
29 |
< |
size = 9.5 |
30 |
< |
if server: size = 99999 |
29 |
> |
size = 9.5 |
30 |
> |
if server or common.scheduler.name().upper() in ['LSF','CAF']: size = 99999 |
31 |
|
### D.S. |
32 |
|
self.MaxTarBallSize = float(self.cfg_params.get('EDG.maxtarballsize',size)) |
33 |
|
|
598 |
|
eventsPerJobRequested = self.eventsPerJob |
599 |
|
if (self.selectNumberOfJobs): |
600 |
|
totalEventsRequested = self.theNumberOfJobs * self.eventsPerJob |
601 |
< |
|
601 |
> |
|
602 |
|
# If user requested all the events in the dataset |
603 |
|
if (totalEventsRequested == -1): |
604 |
|
eventsRemaining=self.maxEvents |
609 |
|
# If user requested less events than are in the dataset |
610 |
|
else: |
611 |
|
eventsRemaining = totalEventsRequested |
612 |
< |
|
612 |
> |
|
613 |
|
# If user requested more events per job than are in the dataset |
614 |
|
if (self.selectEventsPerJob and eventsPerJobRequested > self.maxEvents): |
615 |
|
eventsPerJobRequested = self.maxEvents |
616 |
< |
|
616 |
> |
|
617 |
|
# For user info at end |
618 |
|
totalEventCount = 0 |
619 |
|
|
620 |
|
if (self.selectTotalNumberEvents and self.selectNumberOfJobs): |
621 |
|
eventsPerJobRequested = int(eventsRemaining/self.theNumberOfJobs) |
622 |
< |
|
622 |
> |
|
623 |
|
if (self.selectNumberOfJobs): |
624 |
|
common.logger.message("May not create the exact number_of_jobs requested.") |
625 |
< |
|
625 |
> |
|
626 |
|
if ( self.ncjobs == 'all' ) : |
627 |
|
totalNumberOfJobs = 999999999 |
628 |
|
else : |
629 |
|
totalNumberOfJobs = self.ncjobs |
630 |
< |
|
630 |
> |
|
631 |
|
blocks = blockSites.keys() |
632 |
|
blockCount = 0 |
633 |
|
# Backup variable in case self.maxEvents counted events in a non-included block |
634 |
|
numBlocksInDataset = len(blocks) |
635 |
< |
|
635 |
> |
|
636 |
|
jobCount = 0 |
637 |
|
list_of_lists = [] |
638 |
|
|
688 |
|
numEventsInFile = self.eventsbyfile[file] |
689 |
|
common.logger.debug(6, "File "+str(file)+" has "+str(numEventsInFile)+" events") |
690 |
|
# increase filesEventCount |
691 |
< |
filesEventCount += numEventsInFile |
691 |
> |
filesEventCount += numEventsInFile |
692 |
|
# Add file to current job |
693 |
|
parString += '\\\"' + file + '\\\"\,' |
694 |
|
newFile = 0 |
695 |
|
except KeyError: |
696 |
|
common.logger.message("File "+str(file)+" has unknown number of events: skipping") |
697 |
|
eventsPerJobRequested = min(eventsPerJobRequested, eventsRemaining) |
698 |
< |
#common.logger.message("AF filesEventCount %s - jobSkipEventCount %s "%(filesEventCount,jobSkipEventCount)) |
698 |
> |
#common.logger.message("AF filesEventCount %s - jobSkipEventCount %s "%(filesEventCount,jobSkipEventCount)) |
699 |
|
# if less events in file remain than eventsPerJobRequested |
700 |
|
if ( filesEventCount - jobSkipEventCount < eventsPerJobRequested): |
701 |
|
#AF |
769 |
|
screenOutput = "List of jobs and available destination sites:\n\n" |
770 |
|
|
771 |
|
#AF |
772 |
< |
#AF skip check on block with no sites |
773 |
< |
#AF |
772 |
> |
#AF skip check on block with no sites |
773 |
> |
#AF |
774 |
|
self.list_of_args = list_of_lists |
775 |
|
|
776 |
|
return |
992 |
|
common.logger.debug(5,"Files added to "+self.tgzNameWithPath+" : "+str(tar.getnames())) |
993 |
|
|
994 |
|
##### AdditionalFiles |
995 |
+ |
tar.dereference=True |
996 |
|
for file in self.additional_inbox_files: |
997 |
|
tar.add(file,string.split(file,'/')[-1]) |
998 |
+ |
tar.dereference=False |
999 |
|
common.logger.debug(5,"Files added to "+self.tgzNameWithPath+" : "+str(tar.getnames())) |
1000 |
|
|
1001 |
|
tar.close() |
1010 |
|
tarballinfo = os.stat(self.tgzNameWithPath) |
1011 |
|
if ( tarballinfo.st_size > self.MaxTarBallSize*1024*1024 ) : |
1012 |
|
msg = 'Input sandbox size of ' + str(float(tarballinfo.st_size)/1024.0/1024.0) + ' MB is larger than the allowed ' + str(self.MaxTarBallSize) \ |
1013 |
< |
+'MB input sandbox limit \n' |
1013 |
> |
+'MB input sandbox limit \n' |
1014 |
|
msg += ' and not supported by the direct GRID submission system.\n' |
1015 |
|
msg += ' Please use the CRAB server mode by setting server_name=<NAME> in section [CRAB] of your crab.cfg.\n' |
1016 |
|
msg += ' For further infos please see https://twiki.cern.ch/twiki/bin/view/CMS/CrabServer#CRABSERVER_for_Users' |
1094 |
|
txt += 'ApplicationFamily=cmsRun\n' |
1095 |
|
|
1096 |
|
else: |
1097 |
< |
self.primaryDataset = 'null' |
1097 |
> |
self.primaryDataset = 'null' |
1098 |
|
txt += 'DatasetPath=MCDataTier\n' |
1099 |
|
txt += 'PrimaryDataset=null\n' |
1100 |
|
txt += 'DataTier=null\n' |
1292 |
|
txt += 'fi\n' |
1293 |
|
file_list = [] |
1294 |
|
for fileWithSuffix in (self.output_file): |
1295 |
< |
file_list.append(numberFile(fileWithSuffix, '$NJob')) |
1295 |
> |
file_list.append(numberFile('$SOFTWARE_DIR/'+fileWithSuffix, '$NJob')) |
1296 |
|
|
1297 |
< |
txt += 'file_list="'+string.join(file_list,' ')+'"\n' |
1297 |
> |
txt += 'file_list="'+string.join(file_list,',')+'"\n' |
1298 |
|
txt += '\n' |
1299 |
|
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
1300 |
|
txt += 'echo ">>> current directory content:"\n' |
1399 |
|
publish_data = int(self.cfg_params.get('USER.publish_data',0)) |
1400 |
|
if (publish_data == 1): |
1401 |
|
|
1402 |
+ |
processedDataset = self.cfg_params['USER.publish_data_name'] |
1403 |
+ |
|
1404 |
|
txt += 'if [ $StageOutExitStatus -eq 0 ]; then\n' |
1405 |
< |
txt += ' FOR_LFN=$LFNBaseName/${PSETHASH}/\n' |
1405 |
> |
txt += ' FOR_LFN=$LFNBaseName\n' |
1406 |
|
txt += 'else\n' |
1407 |
|
txt += ' FOR_LFN=/copy_problems/ \n' |
1408 |
|
txt += ' SE=""\n' |
1411 |
|
|
1412 |
|
txt += 'echo ">>> Modify Job Report:" \n' |
1413 |
|
txt += 'chmod a+x $RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py\n' |
1414 |
< |
txt += 'ProcessedDataset= $procDataset \n' |
1414 |
> |
txt += 'ProcessedDataset='+processedDataset+'\n' |
1415 |
> |
#txt += 'ProcessedDataset=$procDataset \n' |
1416 |
|
txt += 'echo "ProcessedDataset = $ProcessedDataset"\n' |
1417 |
|
txt += 'echo "SE = $SE"\n' |
1418 |
|
txt += 'echo "SE_PATH = $SE_PATH"\n' |
1419 |
|
txt += 'echo "FOR_LFN = $FOR_LFN" \n' |
1420 |
|
txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n' |
1421 |
|
args = '$RUNTIME_AREA/crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier ' \ |
1422 |
< |
'$User -$ProcessedDataset-$PSETHASH $ApplicationFamily '+ \ |
1423 |
< |
' $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1424 |
< |
txt += 'echo "$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args) |
1425 |
< |
txt += '$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args) |
1422 |
> |
'$USER-$ProcessedDataset-$PSETHASH $ApplicationFamily '+ \ |
1423 |
> |
' $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH' |
1424 |
> |
txt += 'echo "$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args)+'"\n' |
1425 |
> |
txt += '$RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py '+str(args)+'\n' |
1426 |
|
txt += 'modifyReport_result=$?\n' |
1427 |
|
txt += 'if [ $modifyReport_result -ne 0 ]; then\n' |
1428 |
|
txt += ' modifyReport_result=70500\n' |
1488 |
|
txt += ' fi\n' |
1489 |
|
txt += ' elif [ $executable_exit_status -ne 0 ] || [ $executable_exit_status -ne 50015 ] || [ $executable_exit_status -ne 50017 ];then\n' |
1490 |
|
txt += ' echo ">>> Executable failed $executable_exit_status"\n' |
1491 |
+ |
txt += ' echo "ExeExitCode=$executable_exit_status" | tee -a $RUNTIME_AREA/$repo\n' |
1492 |
+ |
txt += ' echo "EXECUTABLE_EXIT_STATUS = $executable_exit_status"\n' |
1493 |
+ |
txt += ' job_exit_code=$executable_exit_status\n' |
1494 |
|
txt += ' func_exit\n' |
1495 |
|
txt += ' fi\n' |
1496 |
|
txt += '\n' |