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.215 by slacapra, Wed Jun 11 17:55:30 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 +
64 +        ### Temporary: added to remove input file control in the case of PU
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 95 | Line 99 | class Cmssw(JobType):
99          self.output_file_sandbox.append(self.fjrFileName)
100  
101          # other output files to be returned via sandbox or copied to SE
102 +        outfileflag = False
103          self.output_file = []
104          tmp = cfg_params.get('CMSSW.output_file',None)
105          if tmp :
106              self.output_file = [x.strip() for x in tmp.split(',')]
107 <        else:
108 <            log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n")
109 <        pass
107 >            outfileflag = True #output found
108 >        #else:
109 >        #    log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n")
110  
111          # script_exe file as additional file in inputSandbox
112          self.scriptExe = cfg_params.get('USER.script_exe',None)
# Line 115 | 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 192 | 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
197 <        ## remove
198 <        self.sourceSeed = cfg_params.get('CMSSW.pythia_seed',None)
199 <        if self.sourceSeed:
200 <            print "pythia_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds."
201 <            self.incrementSeeds.append('sourceSeed')
202 <            self.incrementSeeds.append('theSource')
203 <
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:
206 <            print "vtx_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds."
207 <            self.incrementSeeds.append('VtxSmeared')
208 <
209 <        self.sourceSeedG4 = cfg_params.get('CMSSW.g4_seed',None)
210 <        if self.sourceSeedG4:
211 <            print "g4_seed is a deprecated parameter. Use preserve_seeds or increment_seeds in the future.\n","Added to increment_seeds."
212 <            self.incrementSeeds.append('g4SimHits')
213 <
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  
221
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 258 | 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:
254 +                                outfileflag = True #output found
255                                  self.output_file.append(tfsOutput)
256                                  common.logger.message("Adding "+tfsOutput+" to output files (from TFileService)")
257 +                            pass
258 +                        pass
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:
263 +                            if edmOutput in self.output_file:
264 +                                common.logger.debug(5,"Output from PoolOutputModule "+edmOutput+" already in output files")
265 +                            else:
266 +                                self.output_file.append(edmOutput)
267 +                                common.logger.message("Adding "+edmOutput+" to output files (from PoolOutputModule)")
268 +                            pass
269 +                        pass
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 475 | 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 791 | Line 794 | class Cmssw(JobType):
794              common.logger.debug(5,"Files added to "+self.tgzNameWithPath+" : "+str(tar.getnames()))
795  
796              tar.close()
797 +        except IOError:
798 +            raise CrabException('Could not create tar-ball '+self.tgzNameWithPath)
799          except tarfile.TarError:
800              raise CrabException('Could not create tar-ball '+self.tgzNameWithPath)
801  
# Line 871 | 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 887 | 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 918 | 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 1046 | 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 1078 | 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 1100 | 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 1179 | 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 1190 | Line 1217 | class Cmssw(JobType):
1217              txt += 'fi\n'
1218  
1219              txt += 'echo ">>> Modify Job Report:" \n'
1220 <            txt += 'chmod a+x $SOFTWARE_DIR/ProdCommon/ProdCommon/FwkJobRep/ModifyJobReport.py\n'
1220 >            txt += 'chmod a+x $RUNTIME_AREA/ProdCommon/FwkJobRep/ModifyJobReport.py\n'
1221              txt += 'ProcessedDataset='+processedDataset+'\n'
1222              txt += 'echo "ProcessedDataset = $ProcessedDataset"\n'
1223              txt += 'echo "SE = $SE"\n'
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 "$SOFTWARE_DIR/ProdCommon/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 += '$SOFTWARE_DIR/ProdCommon/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 1224 | 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 1236 | 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:
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