ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/cms_cmssw.py
(Generate patch)

Comparing COMP/CRAB/python/cms_cmssw.py (file contents):
Revision 1.221 by fanzago, Wed Jun 18 14:02:42 2008 UTC vs.
Revision 1.231 by spiga, Mon Aug 25 16:13:05 2008 UTC

# Line 2 | Line 2 | from JobType import JobType
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 *
# Line 14 | Line 14 | class Cmssw(JobType):
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))
26  
# Line 60 | Line 60 | class Cmssw(JobType):
60          if not cfg_params.has_key('CMSSW.datasetpath'):
61              msg = "Error: datasetpath not defined "
62              raise CrabException(msg)
63 <        
63 >
64          ### Temporary: added to remove input file control in the case of PU
65 <        if not cfg_params.has_key('USER.dataset_pu'):
66 <            self.dataset_pu = 'NONE'
67 <        else:
68 <            self.dataset_pu = cfg_params['USER.dataset_pu']
69 <        ####    
70 <        
65 >        self.dataset_pu = cfg_params.get('CMSSW.dataset_pu', None)
66 >
67          tmp =  cfg_params['CMSSW.datasetpath']
68          log.debug(6, "CMSSW::CMSSW(): datasetPath = "+tmp)
69          if string.lower(tmp)=='none':
# Line 124 | Line 120 | class Cmssw(JobType):
120              msg ="Error. script_exe  not defined"
121              raise CrabException(msg)
122  
123 <        # use parent files...
123 >        # use parent files...
124          self.useParent = self.cfg_params.get('CMSSW.use_parent',False)
125  
126          ## additional input files
# Line 201 | Line 197 | class Cmssw(JobType):
197                  tmp.strip()
198                  self.incrementSeeds.append(tmp)
199  
200 <        ## Old method of dealing with seeds
201 <        ## 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 <
200 >        ## FUTURE: Can remove in CRAB 2.4.0
201 >        self.sourceSeed    = cfg_params.get('CMSSW.pythia_seed',None)
202          self.sourceSeedVtx = cfg_params.get('CMSSW.vtx_seed',None)
203 <        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 <
203 >        self.sourceSeedG4  = cfg_params.get('CMSSW.g4_seed',None)
204          self.sourceSeedMix = cfg_params.get('CMSSW.mix_seed',None)
205 <        if self.sourceSeedMix:
206 <            print "mix_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds."
207 <            self.incrementSeeds.append('mix')
205 >        if self.sourceSeed or self.sourceSeedVtx or self.sourceSeedG4 or self.sourceSeedMix:
206 >            msg = 'pythia_seed, vtx_seed, g4_seed, and mix_seed are no longer valid settings. You must use increment_seeds or preserve_seeds'
207 >            raise CrabException(msg)
208  
209          self.firstRun = cfg_params.get('CMSSW.first_run',None)
210  
230
211          # Copy/return
212          self.copy_data = int(cfg_params.get('USER.copy_data',0))
213          self.return_data = int(cfg_params.get('USER.return_data',0))
# Line 267 | Line 247 | class Cmssw(JobType):
247                      ## If present, add TFileService to output files
248                      if not int(cfg_params.get('CMSSW.skip_TFileService_output',0)):
249                          tfsOutput = PsetEdit.getTFileService()
250 <                        if tfsOutput:
250 >                        if tfsOutput:
251                              if tfsOutput in self.output_file:
252                                  common.logger.debug(5,"Output from TFileService "+tfsOutput+" already in output files")
253                              else:
# Line 279 | Line 259 | class Cmssw(JobType):
259                      ## If present and requested, add PoolOutputModule to output files
260                      if int(cfg_params.get('CMSSW.get_edm_output',0)):
261                          edmOutput = PsetEdit.getPoolOutputModule()
262 <                        if edmOutput:
262 >                        if edmOutput:
263                              if edmOutput in self.output_file:
264                                  common.logger.debug(5,"Output from PoolOutputModule "+edmOutput+" already in output files")
265                              else:
# Line 290 | Line 270 | class Cmssw(JobType):
270                  except CrabException:
271                      msg='Error while manipulating ParameterSet: exiting...'
272                      raise CrabException(msg)
273 <            ## Prepare inputSandbox TarBall (only the first time)  
273 >            ## Prepare inputSandbox TarBall (only the first time)
274              self.tgzNameWithPath = self.getTarBall(self.executable)
275  
276      def DataDiscoveryAndLocation(self, cfg_params):
# Line 498 | Line 478 | class Cmssw(JobType):
478                          if self.useParent:
479                              fullParentString = pString[:-2]
480                              list_of_lists.append([fullString,fullParentString,str(eventsPerJobRequested),str(jobSkipEventCount)])
481 <                        else:
481 >                        else:
482                              list_of_lists.append([fullString,str(eventsPerJobRequested),str(jobSkipEventCount)])
483                          common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.")
484                          self.jobDestination.append(blockSites[block])
# Line 896 | Line 876 | class Cmssw(JobType):
876              txt += 'DatasetPath='+self.datasetPath+'\n'
877  
878              datasetpath_split = self.datasetPath.split("/")
879 <
879 >            ### FEDE FOR NEW LFN ###
880 >            self.primaryDataset = datasetpath_split[1]
881 >            ########################
882              txt += 'PrimaryDataset='+datasetpath_split[1]+'\n'
883              txt += 'DataTier='+datasetpath_split[2]+'\n'
884              txt += 'ApplicationFamily=cmsRun\n'
885  
886          else:
887              txt += 'DatasetPath=MCDataTier\n'
888 +            ### FEDE FOR NEW LFN ###
889 +            self.primaryDataset = 'null'
890 +            ########################
891              txt += 'PrimaryDataset=null\n'
892              txt += 'DataTier=null\n'
893              txt += 'ApplicationFamily=MCDataTier\n'
# Line 912 | Line 897 | class Cmssw(JobType):
897              txt += 'cp  $RUNTIME_AREA/'+pset+' .\n'
898              if (self.datasetPath): # standard job
899                  txt += 'InputFiles=${args[1]}; export InputFiles\n'
900 <                if (self.useParent):  
900 >                if (self.useParent):
901                      txt += 'ParentFiles=${args[2]}; export ParentFiles\n'
902                      txt += 'MaxEvents=${args[3]}; export MaxEvents\n'
903                      txt += 'SkipEvents=${args[4]}; export SkipEvents\n'
# Line 943 | Line 928 | class Cmssw(JobType):
928                  txt += 'cat ' + psetName + '\n'
929                  txt += 'echo "****** end ' + psetName + ' ********"\n'
930                  txt += '\n'
931 <            txt += 'PSETHASH=`edmConfigHash < ' + psetName + '` \n'
931 >            if (self.CMSSW_major >= 2 and self.CMSSW_minor >= 1) or (self.CMSSW_major >= 3):
932 >                txt += 'PSETHASH=`edmConfigHash ' + psetName + '` \n'
933 >            else:
934 >                txt += 'PSETHASH=`edmConfigHash < ' + psetName + '` \n'
935              txt += 'echo "PSETHASH = $PSETHASH" \n'
936              txt += '\n'
937          return txt
# Line 1071 | Line 1059 | class Cmssw(JobType):
1059          txt = '\n#Written by cms_cmssw::wsRenameOutput\n'
1060          txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n'
1061          txt += 'echo ">>> current directory content:"\n'
1062 <        if self.debug_wrapper:
1062 >        if self.debug_wrapper:
1063              txt += 'ls -Al\n'
1064          txt += '\n'
1065  
# Line 1103 | Line 1091 | class Cmssw(JobType):
1091          txt += '\n'
1092          txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n'
1093          txt += 'echo ">>> current directory content:"\n'
1094 <        if self.debug_wrapper:
1094 >        if self.debug_wrapper:
1095              txt += 'ls -Al\n'
1096          txt += '\n'
1097          txt += 'cd $RUNTIME_AREA\n'
# Line 1125 | Line 1113 | class Cmssw(JobType):
1113                   '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
1114  
1115          req = req + ' && (other.GlueHostNetworkAdapterOutboundIP)'
1116 <        if common.scheduler.name() == "glitecoll":
1116 >        if ( common.scheduler.name() == "glitecoll" ) or ( common.scheduler.name() == "glite"):
1117              req += ' && other.GlueCEStateStatus == "Production" '
1118  
1119          return req
# Line 1204 | Line 1192 | class Cmssw(JobType):
1192          publish_data = int(self.cfg_params.get('USER.publish_data',0))
1193          if (publish_data == 1):
1194              processedDataset = self.cfg_params['USER.publish_data_name']
1195 <            LFNBaseName = LFNBase(processedDataset)
1195 >            if (self.primaryDataset == 'null'):
1196 >                 self.primaryDataset = processedDataset
1197 >            if (common.scheduler.name().upper() == "CAF" or common.scheduler.name().upper() == "LSF"):
1198 >                ### FEDE FOR NEW LFN ###
1199 >                LFNBaseName = LFNBase(self.primaryDataset, processedDataset, LocalUser=True)
1200 >                self.user = getUserName(LocalUser=True)
1201 >                ########################
1202 >            else :
1203 >                ### FEDE FOR NEW LFN ###
1204 >                LFNBaseName = LFNBase(self.primaryDataset, processedDataset)
1205 >                self.user = getUserName()
1206 >                ########################
1207  
1208              txt += 'if [ $copy_exit_status -eq 0 ]; then\n'
1209 <            txt += '    FOR_LFN=%s_${PSETHASH}/\n'%(LFNBaseName)
1209 >            ### FEDE FOR NEW LFN ###
1210 >            #txt += '    FOR_LFN=%s_${PSETHASH}/\n'%(LFNBaseName)
1211 >            txt += '    FOR_LFN=%s/${PSETHASH}/\n'%(LFNBaseName)
1212 >            ########################
1213              txt += 'else\n'
1214              txt += '    FOR_LFN=/copy_problems/ \n'
1215              txt += '    SE=""\n'
# Line 1222 | Line 1224 | class Cmssw(JobType):
1224              txt += 'echo "SE_PATH = $SE_PATH"\n'
1225              txt += 'echo "FOR_LFN = $FOR_LFN" \n'
1226              txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n'
1227 <            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'
1228 <            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'
1227 >            ### FEDE FOR NEW LFN ###
1228 >            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'
1229 >            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'
1230 >            ########################
1231              txt += 'modifyReport_result=$?\n'
1232              txt += 'if [ $modifyReport_result -ne 0 ]; then\n'
1233              txt += '    modifyReport_result=70500\n'
# Line 1249 | Line 1253 | class Cmssw(JobType):
1253          txt += '        executable_exit_status=`python $RUNTIME_AREA/parseCrabFjr.py --input $RUNTIME_AREA/crab_fjr_$NJob.xml --exitcode`\n'
1254          txt += '        if [ $executable_exit_status -eq 50115 ];then\n'
1255          txt += '            echo ">>> crab_fjr.xml contents: "\n'
1256 <        txt += '            cat $RUNTIME_AREA/crab_fjr_NJob.xml\n'
1256 >        txt += '            cat $RUNTIME_AREA/crab_fjr_$NJob.xml\n'
1257          txt += '            echo "Wrong FrameworkJobReport --> does not contain useful info. ExitStatus: $executable_exit_status"\n'
1258          txt += '        elif [ $executable_exit_status -eq -999 ];then\n'
1259          txt += '            echo "ExitStatus from FrameworkJobReport not available. not available. Using exit code of executable from command line."\n'
# Line 1261 | Line 1265 | class Cmssw(JobType):
1265          txt += '    fi\n'
1266            #### Patch to check input data reading for CMSSW16x Hopefully we-ll remove it asap
1267  
1268 <        if (self.datasetPath and self.dataset_pu == 'NONE'):
1268 >        if (self.datasetPath and not (self.dataset_pu or self.useParent) :
1269            # VERIFY PROCESSED DATA
1270              txt += '    if [ $executable_exit_status -eq 0 ];then\n'
1271              txt += '      echo ">>> Verify list of processed files:"\n'

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines