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.73 by gutsche, Sun Apr 8 18:39:51 2007 UTC vs.
Revision 1.101 by fanzago, Thu Jun 28 14:54:43 2007 UTC

# Line 3 | Line 3 | from crab_logger import Logger
3   from crab_exceptions import *
4   from crab_util import *
5   import common
6 import PsetManipulator  
7 import DataDiscovery
8 import DataDiscovery_DBS2
9 import DataLocation
6   import Scram
7  
8   import os, string, re, shutil, glob
# Line 16 | Line 12 | class Cmssw(JobType):
12          JobType.__init__(self, 'CMSSW')
13          common.logger.debug(3,'CMSSW::__init__')
14  
19        # Marco.
15          self._params = {}
16          self.cfg_params = cfg_params
17  
18          try:
19              self.MaxTarBallSize = float(self.cfg_params['EDG.maxtarballsize'])
20          except KeyError:
21 <            self.MaxTarBallSize = 100.0
21 >            self.MaxTarBallSize = 9.5
22  
23          # number of jobs requested to be created, limit obj splitting
24          self.ncjobs = ncjobs
# Line 36 | Line 31 | class Cmssw(JobType):
31          self.executable = ''
32          self.executable_arch = self.scram.getArch()
33          self.tgz_name = 'default.tgz'
34 +        self.additional_tgz_name = 'additional.tgz'
35          self.scriptName = 'CMSSW.sh'
36          self.pset = ''      #scrip use case Da  
37          self.datasetPath = '' #scrip use case Da
# Line 51 | Line 47 | class Cmssw(JobType):
47  
48          ## get DBS mode
49          try:
50 <            self.use_dbs_2 = int(self.cfg_params['CMSSW.use_dbs_2'])
50 >            self.use_dbs_1 = int(self.cfg_params['CMSSW.use_dbs_1'])
51          except KeyError:
52 <            self.use_dbs_2 = 0
52 >            self.use_dbs_1 = 0
53              
54          try:
55              tmp =  cfg_params['CMSSW.datasetpath']
# Line 74 | Line 70 | class Cmssw(JobType):
70              self.setParam_('dataset', 'None')
71              self.setParam_('owner', 'None')
72          else:
73 <            datasetpath_split = self.datasetPath.split("/")
74 <            self.setParam_('dataset', datasetpath_split[1])
75 <            self.setParam_('owner', datasetpath_split[-1])
76 <
73 >            try:
74 >                datasetpath_split = self.datasetPath.split("/")
75 >                # standard style
76 >                if self.use_dbs_1 == 1 :
77 >                    self.setParam_('dataset', datasetpath_split[1])
78 >                    self.setParam_('owner', datasetpath_split[-1])
79 >                else:
80 >                    self.setParam_('dataset', datasetpath_split[1])
81 >                    self.setParam_('owner', datasetpath_split[2])
82 >            except:
83 >                self.setParam_('dataset', self.datasetPath)
84 >                self.setParam_('owner', self.datasetPath)
85 >                
86          self.setTaskid_()
87          self.setParam_('taskId', self.cfg_params['taskId'])
88  
# Line 127 | Line 132 | class Cmssw(JobType):
132                      self.output_file.append(tmp)
133                      pass
134              else:
135 <                log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available")
135 >                log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n")
136                  pass
137              pass
138          except KeyError:
139 <            log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available")
139 >            log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n")
140              pass
141  
142          # script_exe file as additional file in inputSandbox
# Line 157 | Line 162 | class Cmssw(JobType):
162                  tmp = string.strip(tmp)
163                  dirname = ''
164                  if not tmp[0]=="/": dirname = "."
165 <                files = glob.glob(os.path.join(dirname, tmp))
165 >                files = []
166 >                if string.find(tmp,"*")>-1:
167 >                    files = glob.glob(os.path.join(dirname, tmp))
168 >                    if len(files)==0:
169 >                        raise CrabException("No additional input file found with this pattern: "+tmp)
170 >                else:
171 >                    files.append(tmp)
172                  for file in files:
173                      if not os.path.exists(file):
174                          raise CrabException("Additional input file not found: "+file)
175                      pass
176 <                    storedFile = common.work_space.shareDir()+file
176 >                    fname = string.split(file, '/')[-1]
177 >                    storedFile = common.work_space.pathForTgz()+'share/'+fname
178                      shutil.copyfile(file, storedFile)
179                      self.additional_inbox_files.append(string.strip(storedFile))
180                  pass
# Line 222 | Line 234 | class Cmssw(JobType):
234          except KeyError:
235              self.sourceSeedVtx = None
236              common.logger.debug(5,"No vertex seed given")
237 +
238 +        try:
239 +            self.sourceSeedG4 = int(cfg_params['CMSSW.g4_seed'])
240 +        except KeyError:
241 +            self.sourceSeedG4 = None
242 +            common.logger.debug(5,"No g4 sim hits seed given")
243 +
244 +        try:
245 +            self.sourceSeedMix = int(cfg_params['CMSSW.mix_seed'])
246 +        except KeyError:
247 +            self.sourceSeedMix = None
248 +            common.logger.debug(5,"No mix seed given")
249 +
250          try:
251              self.firstRun = int(cfg_params['CMSSW.first_run'])
252          except KeyError:
253              self.firstRun = None
254              common.logger.debug(5,"No first run given")
255          if self.pset != None: #CarlosDaniele
256 <            self.PsetEdit = PsetManipulator.PsetManipulator(self.pset) #Daniele Pset
256 >            ver = string.split(self.version,"_")
257 >            if (int(ver[1])>=1 and int(ver[2])>=5):
258 >                import PsetManipulator150 as pp
259 >            else:
260 >                import PsetManipulator as pp
261 >            PsetEdit = pp.PsetManipulator(self.pset) #Daniele Pset
262  
263          #DBSDLS-start
264          ## Initialize the variables that are extracted from DBS/DLS and needed in other places of the code
# Line 250 | Line 280 | class Cmssw(JobType):
280                  self.jobSplittingForScript()
281              else:
282                  self.jobSplittingNoInput()
283 <        else:
283 >        else:
284              self.jobSplittingByBlocks(blockSites)
285  
286          # modify Pset
# Line 258 | Line 288 | class Cmssw(JobType):
288              try:
289                  if (self.datasetPath): # standard job
290                      # allow to processa a fraction of events in a file
291 <                    self.PsetEdit.inputModule("INPUT")
292 <                    self.PsetEdit.maxEvent("INPUTMAXEVENTS")
293 <                    self.PsetEdit.skipEvent("INPUTSKIPEVENTS")
291 >                    PsetEdit.inputModule("INPUT")
292 >                    PsetEdit.maxEvent("INPUTMAXEVENTS")
293 >                    PsetEdit.skipEvent("INPUTSKIPEVENTS")
294                  else:  # pythia like job
295 <                    self.PsetEdit.maxEvent(self.eventsPerJob)
295 >                    PsetEdit.maxEvent(self.eventsPerJob)
296                      if (self.firstRun):
297 <                        self.PsetEdit.pythiaFirstRun("INPUTFIRSTRUN")  #First Run
297 >                        PsetEdit.pythiaFirstRun("INPUTFIRSTRUN")  #First Run
298                      if (self.sourceSeed) :
299 <                        self.PsetEdit.pythiaSeed("INPUT")
299 >                        PsetEdit.pythiaSeed("INPUT")
300                          if (self.sourceSeedVtx) :
301 <                            self.PsetEdit.pythiaSeedVtx("INPUTVTX")
301 >                            PsetEdit.vtxSeed("INPUTVTX")
302 >                        if (self.sourceSeedG4) :
303 >                            self.PsetEdit.g4Seed("INPUTG4")
304 >                        if (self.sourceSeedMix) :
305 >                            self.PsetEdit.mixSeed("INPUTMIX")
306                  # add FrameworkJobReport to parameter-set
307 <                self.PsetEdit.addCrabFJR(self.fjrFileName)
308 <                self.PsetEdit.psetWriter(self.configFilename())
307 >                PsetEdit.addCrabFJR(self.fjrFileName)
308 >                PsetEdit.psetWriter(self.configFilename())
309              except:
310                  msg='Error while manipuliating ParameterSet: exiting...'
311                  raise CrabException(msg)
312  
313      def DataDiscoveryAndLocation(self, cfg_params):
314  
315 +        import DataDiscovery
316 +        import DataDiscovery_DBS2
317 +        import DataLocation
318          common.logger.debug(10,"CMSSW::DataDiscoveryAndLocation()")
319  
320          datasetPath=self.datasetPath
321  
322          ## Contact the DBS
323 <        common.logger.message("Contacting DBS...")
323 >        common.logger.message("Contacting Data Discovery Services ...")
324          try:
325  
326 <            if self.use_dbs_2 == 1 :
290 <                self.pubdata=DataDiscovery_DBS2.DataDiscovery_DBS2(datasetPath, cfg_params)
291 <            else :
326 >            if self.use_dbs_1 == 1 :
327                  self.pubdata=DataDiscovery.DataDiscovery(datasetPath, cfg_params)
328 +            else :
329 +                self.pubdata=DataDiscovery_DBS2.DataDiscovery_DBS2(datasetPath, cfg_params)
330              self.pubdata.fetchDBSInfo()
331  
332          except DataDiscovery.NotExistingDatasetError, ex :
# Line 311 | Line 348 | class Cmssw(JobType):
348              msg = 'ERROR ***: failed Data Discovery in DBS :  %s'%ex.getErrorMessage()
349              raise CrabException(msg)
350  
314        ## get list of all required data in the form of dbs paths  (dbs path = /dataset/datatier/owner)
315        common.logger.message("Required data are :"+self.datasetPath)
316
351          self.filesbyblock=self.pubdata.getFiles()
352          self.eventsbyblock=self.pubdata.getEventsPerBlock()
353          self.eventsbyfile=self.pubdata.getEventsPerFile()
354  
355          ## get max number of events
356          self.maxEvents=self.pubdata.getMaxEvents() ##  self.maxEvents used in Creator.py
323        common.logger.message("The number of available events is %s\n"%self.maxEvents)
357  
325        common.logger.message("Contacting DLS...")
358          ## Contact the DLS and build a list of sites hosting the fileblocks
359          try:
360              dataloc=DataLocation.DataLocation(self.filesbyblock.keys(),cfg_params)
# Line 340 | Line 372 | class Cmssw(JobType):
372                  allSites.append(oneSite)
373          allSites = self.uniquelist(allSites)
374  
375 <        common.logger.message("Sites ("+str(len(allSites))+") hosting part/all of dataset: "+str(allSites))
376 <        common.logger.debug(6, "List of Sites: "+str(allSites))
375 >        # screen output
376 >        common.logger.message("Requested dataset: " + datasetPath + " has " + str(self.maxEvents) + " events in " + str(len(self.filesbyblock.keys())) + " blocks.\n")
377 >
378          return sites
379      
380      def jobSplittingByBlocks(self, blockSites):
# Line 403 | Line 436 | class Cmssw(JobType):
436          jobCount = 0
437          list_of_lists = []
438  
439 +        # list tracking which jobs are in which jobs belong to which block
440 +        jobsOfBlock = {}
441 +
442          # ---- Iterate over the blocks in the dataset until ---- #
443          # ---- we've met the requested total # of events    ---- #
444          while ( (eventsRemaining > 0) and (blockCount < numBlocksInDataset) and (jobCount < totalNumberOfJobs)):
# Line 457 | Line 493 | class Cmssw(JobType):
493                              common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(filesEventCount - jobSkipEventCount)+" events (last file in block).")
494                              self.jobDestination.append(blockSites[block])
495                              common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount]))
496 +                            # fill jobs of block dictionary
497 +                            if block in jobsOfBlock.keys() :
498 +                                jobsOfBlock[block].append(jobCount+1)
499 +                            else:
500 +                                jobsOfBlock[block] = [jobCount+1]
501                              # reset counter
502                              jobCount = jobCount + 1
503                              totalEventCount = totalEventCount + filesEventCount - jobSkipEventCount
# Line 480 | Line 521 | class Cmssw(JobType):
521                          common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.")
522                          self.jobDestination.append(blockSites[block])
523                          common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount]))
524 +                        if block in jobsOfBlock.keys() :
525 +                            jobsOfBlock[block].append(jobCount+1)
526 +                        else:
527 +                            jobsOfBlock[block] = [jobCount+1]
528                          # reset counter
529                          jobCount = jobCount + 1
530                          totalEventCount = totalEventCount + eventsPerJobRequested
# Line 500 | Line 545 | class Cmssw(JobType):
545                          common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.")
546                          self.jobDestination.append(blockSites[block])
547                          common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount]))
548 +                        if block in jobsOfBlock.keys() :
549 +                            jobsOfBlock[block].append(jobCount+1)
550 +                        else:
551 +                            jobsOfBlock[block] = [jobCount+1]
552                          # increase counter
553                          jobCount = jobCount + 1
554                          totalEventCount = totalEventCount + eventsPerJobRequested
# Line 517 | Line 566 | class Cmssw(JobType):
566          self.ncjobs = self.total_number_of_jobs = jobCount
567          if (eventsRemaining > 0 and jobCount < totalNumberOfJobs ):
568              common.logger.message("Could not run on all requested events because some blocks not hosted at allowed sites.")
569 <        common.logger.message("\n"+str(jobCount)+" job(s) can run on "+str(totalEventCount)+" events.\n")
569 >        common.logger.message(str(jobCount)+" job(s) can run on "+str(totalEventCount)+" events.\n")
570          
571 +        # screen output
572 +        screenOutput = "List of jobs and available destination sites:\n\n"
573 +
574 +        blockCounter = 0
575 +        for block in jobsOfBlock.keys():
576 +            blockCounter += 1
577 +            screenOutput += "Block %5i: jobs %20s: sites: %s\n" % (blockCounter,spanRanges(jobsOfBlock[block]),','.join(blockSites[block]))
578 +
579 +        common.logger.message(screenOutput)
580 +
581          self.list_of_args = list_of_lists
582          return
583  
# Line 563 | Line 622 | class Cmssw(JobType):
622              ## Since there is no input, any site is good
623             # self.jobDestination.append(["Any"])
624              self.jobDestination.append([""]) #must be empty to write correctly the xml
625 <            args=''
625 >            args=[]
626              if (self.firstRun):
627                      ## pythia first run
628                  #self.list_of_args.append([(str(self.firstRun)+str(i))])
629 <                args=args+(str(self.firstRun)+str(i))
629 >                args.append(str(self.firstRun)+str(i))
630              else:
631                  ## no first run
632                  #self.list_of_args.append([str(i)])
633 <                args=args+str(i)
633 >                args.append(str(i))
634              if (self.sourceSeed):
635 +                args.append(str(self.sourceSeed)+str(i))
636                  if (self.sourceSeedVtx):
637 <                    ## pythia + vtx random seed
638 <                    #self.list_of_args.append([
639 <                    #                          str(self.sourceSeed)+str(i),
640 <                    #                          str(self.sourceSeedVtx)+str(i)
641 <                    #                          ])
642 <                    args=args+str(',')+str(self.sourceSeed)+str(i)+str(',')+str(self.sourceSeedVtx)+str(i)
643 <                else:
644 <                    ## only pythia random seed
645 <                    #self.list_of_args.append([(str(self.sourceSeed)+str(i))])
646 <                    args=args +str(',')+str(self.sourceSeed)+str(i)
647 <            else:
648 <                ## no random seed
589 <                if str(args)=='': args=args+(str(self.firstRun)+str(i))
590 <            arguments=args.split(',')
591 <            if len(arguments)==3:self.list_of_args.append([str(arguments[0]),str(arguments[1]),str(arguments[2])])
592 <            elif len(arguments)==2:self.list_of_args.append([str(arguments[0]),str(arguments[1])])
593 <            else :self.list_of_args.append([str(arguments[0])])
637 >                    ## + vtx random seed
638 >                    args.append(str(self.sourceSeedVtx)+str(i))
639 >                if (self.sourceSeedG4):
640 >                    ## + G4 random seed
641 >                    args.append(str(self.sourceSeedG4)+str(i))
642 >                if (self.sourceSeedMix):    
643 >                    ## + Mix random seed
644 >                    args.append(str(self.sourceSeedMix)+str(i))
645 >                pass
646 >            pass
647 >            self.list_of_args.append(args)
648 >        pass
649              
650 <     #   print self.list_of_args
650 >        # print self.list_of_args
651  
652          return
653  
# Line 687 | Line 742 | class Cmssw(JobType):
742          try: # create tar ball
743              tar = tarfile.open(self.tgzNameWithPath, "w:gz")
744              ## First find the executable
745 <            if (executable != ''):
745 >            if (self.executable != ''):
746                  exeWithPath = self.scram.findFile_(executable)
747                  if ( not exeWithPath ):
748                      raise CrabException('User executable '+executable+' not found')
# Line 697 | Line 752 | class Cmssw(JobType):
752                      # the exe is private, so we must ship
753                      common.logger.debug(5,"Exe "+exeWithPath+" to be tarred")
754                      path = swArea+'/'
755 <                    exe = string.replace(exeWithPath, path,'')
756 <                    tar.add(path+exe,executable)
755 >                    # distinguish case when script is in user project area or given by full path somewhere else
756 >                    if exeWithPath.find(path) >= 0 :
757 >                        exe = string.replace(exeWithPath, path,'')
758 >                        tar.add(path+exe,os.path.basename(executable))
759 >                    else :
760 >                        tar.add(exeWithPath,os.path.basename(executable))
761                      pass
762                  else:
763                      # the exe is from release, we'll find it on WN
# Line 729 | Line 788 | class Cmssw(JobType):
788              pa = os.environ['CRABDIR'] + '/' + 'ProdAgentApi'
789              if os.path.isdir(pa):
790                  tar.add(pa,paDir)
791 +
792 +            ### FEDE FOR DBS PUBLICATION
793 +            ## Add PRODCOMMON dir to tar
794 +            prodcommonDir = 'ProdCommon'
795 +            prodcommonPath = os.environ['CRABDIR'] + '/' + 'ProdCommon'
796 +            if os.path.isdir(prodcommonPath):
797 +                tar.add(prodcommonPath,prodcommonDir)
798 +            #############################    
799          
800              common.logger.debug(5,"Files added to "+self.tgzNameWithPath+" : "+str(tar.getnames()))
801              tar.close()
# Line 754 | Line 821 | class Cmssw(JobType):
821          
822          return
823          
824 +    def additionalInputFileTgz(self):
825 +        """
826 +        Put all additional files into a tar ball and return its name
827 +        """
828 +        import tarfile
829 +        tarName=  common.work_space.pathForTgz()+'share/'+self.additional_tgz_name
830 +        tar = tarfile.open(tarName, "w:gz")
831 +        for file in self.additional_inbox_files:
832 +            tar.add(file,string.split(file,'/')[-1])
833 +        common.logger.debug(5,"Files added to "+self.additional_tgz_name+" : "+str(tar.getnames()))
834 +        tar.close()
835 +        return tarName
836 +
837      def wsSetupEnvironment(self, nj):
838          """
839          Returns part of a job script which prepares
# Line 771 | Line 851 | class Cmssw(JobType):
851          txt += '    echo "Created working directory: $WORKING_DIR"\n'
852          txt += '    if [ ! -d $WORKING_DIR ] ;then\n'
853          txt += '        echo "SET_CMS_ENV 10016 ==> OSG $WORKING_DIR could not be created on WN `hostname`"\n'
854 <        txt += '        echo "JOB_EXIT_STATUS = 10016"\n'
855 <        txt += '        echo "JobExitCode=10016" | tee -a $RUNTIME_AREA/$repo\n'
856 <        txt += '        dumpStatus $RUNTIME_AREA/$repo\n'
854 >        txt += '    echo "JOB_EXIT_STATUS = 10016"\n'
855 >        txt += '    echo "JobExitCode=10016" | tee -a $RUNTIME_AREA/$repo\n'
856 >        txt += '    dumpStatus $RUNTIME_AREA/$repo\n'
857          txt += '        rm -f $RUNTIME_AREA/$repo \n'
858          txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
859          txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
# Line 789 | Line 869 | class Cmssw(JobType):
869          scram = self.scram.commandName()
870          txt += '\n\n'
871          txt += 'echo "### SPECIFIC JOB SETUP ENVIRONMENT ###"\n'
872 +        txt += 'echo "Setting SCRAM_ARCH='+self.executable_arch+'"\n'
873 +        txt += 'export SCRAM_ARCH='+self.executable_arch+'\n'
874          txt += scram+' project CMSSW '+self.version+'\n'
875          txt += 'status=$?\n'
876          txt += 'if [ $status != 0 ] ; then\n'
# Line 805 | Line 887 | class Cmssw(JobType):
887          txt += '        cd $RUNTIME_AREA\n'
888          txt += '        /bin/rm -rf $WORKING_DIR\n'
889          txt += '        if [ -d $WORKING_DIR ] ;then\n'
890 <        txt += '            echo "SET_CMS_ENV 10018 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after CMSSW CMSSW_0_6_1 not found on `hostname`"\n'
891 <        txt += '            echo "JOB_EXIT_STATUS = 10018"\n'
892 <        txt += '            echo "JobExitCode=10018" | tee -a $RUNTIME_AREA/$repo\n'
893 <        txt += '            dumpStatus $RUNTIME_AREA/$repo\n'
890 >        txt += '            echo "SET_CMS_ENV 10018 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after CMSSW CMSSW_0_6_1 not found on `hostname`"\n'
891 >        txt += '            echo "JOB_EXIT_STATUS = 10018"\n'
892 >        txt += '            echo "JobExitCode=10018" | tee -a $RUNTIME_AREA/$repo\n'
893 >        txt += '            dumpStatus $RUNTIME_AREA/$repo\n'
894          txt += '            rm -f $RUNTIME_AREA/$repo \n'
895          txt += '            echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
896          txt += '            echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
# Line 817 | Line 899 | class Cmssw(JobType):
899          txt += '   exit 1 \n'
900          txt += 'fi \n'
901          txt += 'echo "CMSSW_VERSION =  '+self.version+'"\n'
820        txt += 'export SCRAM_ARCH='+self.executable_arch+'\n'
902          txt += 'cd '+self.version+'\n'
903 +        ########## FEDE FOR DBS2 ######################
904 +        txt += 'SOFTWARE_DIR=`pwd`\n'
905 +        txt += 'echo SOFTWARE_DIR=$SOFTWARE_DIR \n'
906 +        ###############################################
907          ### needed grep for bug in scramv1 ###
908          txt += scram+' runtime -sh\n'
909          txt += 'eval `'+scram+' runtime -sh | grep -v SCRAMRT_LSB_JOBNAME`\n'
# Line 844 | Line 929 | class Cmssw(JobType):
929          txt += '        cd $RUNTIME_AREA\n'
930          txt += '        /bin/rm -rf $WORKING_DIR\n'
931          txt += '        if [ -d $WORKING_DIR ] ;then\n'
932 <        txt += '            echo "SET_EXE_ENV 50114 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after Too few arguments for CRAB job wrapper"\n'
933 <        txt += '            echo "JOB_EXIT_STATUS = 50114"\n'
934 <        txt += '            echo "JobExitCode=50114" | tee -a $RUNTIME_AREA/$repo\n'
935 <        txt += '            dumpStatus $RUNTIME_AREA/$repo\n'
932 >        txt += '            echo "SET_EXE_ENV 50114 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after Too few arguments for CRAB job wrapper"\n'
933 >        txt += '            echo "JOB_EXIT_STATUS = 50114"\n'
934 >        txt += '            echo "JobExitCode=50114" | tee -a $RUNTIME_AREA/$repo\n'
935 >        txt += '            dumpStatus $RUNTIME_AREA/$repo\n'
936          txt += '            rm -f $RUNTIME_AREA/$repo \n'
937          txt += '            echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
938          txt += '            echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
# Line 859 | Line 944 | class Cmssw(JobType):
944  
945          # Prepare job-specific part
946          job = common.job_list[nj]
947 +        ### FEDE FOR DBS OUTPUT PUBLICATION
948 +        if (self.datasetPath):
949 +            txt += '\n'
950 +            txt += 'DatasetPath='+self.datasetPath+'\n'
951 +
952 +            datasetpath_split = self.datasetPath.split("/")
953 +            
954 +            txt += 'PrimaryDataset='+datasetpath_split[1]+'\n'
955 +            txt += 'DataTier='+datasetpath_split[2]+'\n'
956 +            #txt += 'ProcessedDataset='+datasetpath_split[3]+'\n'
957 +            txt += 'ApplicationFamily=cmsRun\n'
958 +
959 +        else:
960 +            txt += 'DatasetPath=MCDataTier\n'
961 +            txt += 'PrimaryDataset=null\n'
962 +            txt += 'DataTier=null\n'
963 +            #txt += 'ProcessedDataset=null\n'
964 +            txt += 'ApplicationFamily=MCDataTier\n'
965          if self.pset != None: #CarlosDaniele
966              pset = os.path.basename(job.configFilename())
967              txt += '\n'
968 +            txt += 'cp  $RUNTIME_AREA/'+pset+' .\n'
969              if (self.datasetPath): # standard job
970                  #txt += 'InputFiles=$2\n'
971                  txt += 'InputFiles=${args[1]}\n'
972                  txt += 'MaxEvents=${args[2]}\n'
973                  txt += 'SkipEvents=${args[3]}\n'
974                  txt += 'echo "Inputfiles:<$InputFiles>"\n'
975 <                txt += 'sed "s#{\'INPUT\'}#$InputFiles#" $RUNTIME_AREA/'+pset+' > pset_tmp_1.cfg\n'
975 >                txt += 'sed "s#{\'INPUT\'}#$InputFiles#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
976                  txt += 'echo "MaxEvents:<$MaxEvents>"\n'
977 <                txt += 'sed "s#INPUTMAXEVENTS#$MaxEvents#" pset_tmp_1.cfg > pset_tmp_2.cfg\n'
977 >                txt += 'sed "s#INPUTMAXEVENTS#$MaxEvents#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
978                  txt += 'echo "SkipEvents:<$SkipEvents>"\n'
979 <                txt += 'sed "s#INPUTSKIPEVENTS#$SkipEvents#" pset_tmp_2.cfg > pset.cfg\n'
979 >                txt += 'sed "s#INPUTSKIPEVENTS#$SkipEvents#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
980              else:  # pythia like job
981 <                if (self.sourceSeed):
982 <                    txt += 'FirstRun=${args[1]}\n'
981 >                seedIndex=1
982 >                if (self.firstRun):
983 >                    txt += 'FirstRun=${args['+str(seedIndex)+']}\n'
984                      txt += 'echo "FirstRun: <$FirstRun>"\n'
985 <                    txt += 'sed "s#\<INPUTFIRSTRUN\>#$FirstRun#" $RUNTIME_AREA/'+pset+' > tmp_1.cfg\n'
986 <                else:
987 <                    txt += '# Copy untouched pset\n'
883 <                    txt += 'cp $RUNTIME_AREA/'+pset+' tmp_1.cfg\n'
985 >                    txt += 'sed "s#\<INPUTFIRSTRUN\>#$FirstRun#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
986 >                    seedIndex=seedIndex+1
987 >
988                  if (self.sourceSeed):
989 < #                    txt += 'Seed=$2\n'
990 <                    txt += 'Seed=${args[2]}\n'
991 <                    txt += 'echo "Seed: <$Seed>"\n'
992 <                    txt += 'sed "s#\<INPUT\>#$Seed#" tmp_1.cfg > tmp_2.cfg\n'
989 >                    txt += 'Seed=${args['+str(seedIndex)+']}\n'
990 >                    txt += 'sed "s#\<INPUT\>#$Seed#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
991 >                    seedIndex=seedIndex+1
992 >                    ## the following seeds are not always present
993                      if (self.sourceSeedVtx):
994 < #                        txt += 'VtxSeed=$3\n'
891 <                        txt += 'VtxSeed=${args[3]}\n'
994 >                        txt += 'VtxSeed=${args['+str(seedIndex)+']}\n'
995                          txt += 'echo "VtxSeed: <$VtxSeed>"\n'
996 <                        txt += 'sed "s#INPUTVTX#$VtxSeed#" tmp_2.cfg > pset.cfg\n'
997 <                    else:
998 <                        txt += 'mv tmp_2.cfg pset.cfg\n'
999 <                else:
1000 <                    txt += 'mv tmp_1.cfg pset.cfg\n'
1001 <                   # txt += '# Copy untouched pset\n'
1002 <                   # txt += 'cp $RUNTIME_AREA/'+pset+' pset.cfg\n'
1003 <
996 >                        txt += 'sed "s#\<INPUTVTX\>#$VtxSeed#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
997 >                        seedIndex += 1
998 >                    if (self.sourceSeedG4):
999 >                        txt += 'G4Seed=${args['+str(seedIndex)+']}\n'
1000 >                        txt += 'echo "G4Seed: <$G4Seed>"\n'
1001 >                        txt += 'sed "s#\<INPUTG4\>#$G4Seed#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
1002 >                        seedIndex += 1
1003 >                    if (self.sourceSeedMix):
1004 >                        txt += 'mixSeed=${args['+str(seedIndex)+']}\n'
1005 >                        txt += 'echo "MixSeed: <$mixSeed>"\n'
1006 >                        txt += 'sed "s#\<INPUTMIX\>#$mixSeed#" '+pset+' > tmp && mv -f tmp '+pset+'\n'
1007 >                        seedIndex += 1
1008 >                    pass
1009 >                pass
1010 >            txt += 'mv -f '+pset+' pset.cfg\n'
1011  
1012          if len(self.additional_inbox_files) > 0:
1013 <            for file in self.additional_inbox_files:
1014 <                relFile = file.split("/")[-1]
1015 <                txt += 'if [ -e $RUNTIME_AREA/'+relFile+' ] ; then\n'
906 <                txt += '   cp $RUNTIME_AREA/'+relFile+' .\n'
907 <                txt += '   chmod +x '+relFile+'\n'
908 <                txt += 'fi\n'
1013 >            txt += 'if [ -e $RUNTIME_AREA/'+self.additional_tgz_name+' ] ; then\n'
1014 >            txt += '  tar xzvf $RUNTIME_AREA/'+self.additional_tgz_name+'\n'
1015 >            txt += 'fi\n'
1016              pass
1017  
1018          if self.pset != None: #CarlosDaniele
# Line 916 | Line 1023 | class Cmssw(JobType):
1023              txt += 'cat pset.cfg\n'
1024              txt += 'echo "****** end pset.cfg ********"\n'
1025              txt += '\n'
1026 +            ### FEDE FOR DBS OUTPUT PUBLICATION
1027 +            txt += 'PSETHASH=`EdmConfigHash < pset.cfg` \n'
1028 +            txt += 'echo "PSETHASH = $PSETHASH" \n'
1029 +            ##############
1030 +            txt += '\n'
1031              # txt += 'echo "***** cat pset1.cfg *********"\n'
1032              # txt += 'cat pset1.cfg\n'
1033              # txt += 'echo "****** end pset1.cfg ********"\n'
# Line 957 | Line 1069 | class Cmssw(JobType):
1069              txt += '   echo "Successful untar" \n'
1070              txt += 'fi \n'
1071              txt += '\n'
1072 <            txt += 'echo "Include ProdAgentApi in PYTHONPATH"\n'
1072 >            txt += 'echo "Include ProdAgentApi and PRODCOMMON in PYTHONPATH"\n'
1073              txt += 'if [ -z "$PYTHONPATH" ]; then\n'
1074 <            txt += '   export PYTHONPATH=ProdAgentApi\n'
1074 >            #### FEDE FOR DBS OUTPUT PUBLICATION
1075 >            txt += '   export PYTHONPATH=$SOFTWARE_DIR/ProdAgentApi:$SOFTWARE_DIR/ProdCommon\n'
1076 >            #txt += '   export PYTHONPATH=`pwd`/ProdAgentApi:`pwd`/ProdCommon\n'
1077 >            #txt += '   export PYTHONPATH=ProdAgentApi\n'
1078              txt += 'else\n'
1079 <            txt += '   export PYTHONPATH=ProdAgentApi:${PYTHONPATH}\n'
1079 >            txt += '   export PYTHONPATH=$SOFTWARE_DIR/ProdAgentApi:$SOFTWARE_DIR/ProdCommon:${PYTHONPATH}\n'
1080 >            #txt += '   export PYTHONPATH=`pwd`/ProdAgentApi:`pwd`/ProdCommon:${PYTHONPATH}\n'
1081 >            #txt += '   export PYTHONPATH=ProdAgentApi:${PYTHONPATH}\n'
1082 >            txt += 'echo "PYTHONPATH=$PYTHONPATH"\n'
1083 >            ###################  
1084              txt += 'fi\n'
1085              txt += '\n'
1086  
# Line 1003 | Line 1122 | class Cmssw(JobType):
1122          if not self.pset is None:
1123              inp_box.append(common.work_space.pathForTgz() + 'job/' + self.configFilename())
1124          ## additional input files
1125 <        for file in self.additional_inbox_files:
1126 <            inp_box.append(file)
1125 >        tgz = self.additionalInputFileTgz()
1126 >        inp_box.append(tgz)
1127          return inp_box
1128  
1129      def outputSandbox(self, nj):
# Line 1041 | Line 1160 | class Cmssw(JobType):
1160              txt += 'ls '+fileWithSuffix+'\n'
1161              txt += 'ls_result=$?\n'
1162              txt += 'if [ $ls_result -ne 0 ] ; then\n'
1163 +            txt += '   exit_status=60302\n'
1164              txt += '   echo "ERROR: Problem with output file"\n'
1165              if common.scheduler.boss_scheduler_name == 'condor_g':
1166                  txt += '    if [ $middleware == OSG ]; then \n'
# Line 1048 | Line 1168 | class Cmssw(JobType):
1168                  txt += '        echo "Processing of job output failed" > $RUNTIME_AREA/'+output_file_num+'\n'
1169                  txt += '    fi \n'
1170              txt += 'else\n'
1171 <            txt += '   cp '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n'
1171 >            ### FEDE FOR DBS OUTPUT PUBLICATION
1172 >            txt += '   mv '+fileWithSuffix+' $RUNTIME_AREA\n'
1173 >            txt += '   cp $RUNTIME_AREA/'+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n'
1174 >            #################################
1175              txt += 'fi\n'
1176        
1177          txt += 'cd $RUNTIME_AREA\n'
1178 <        txt += 'cd $RUNTIME_AREA\n'
1178 >        #### FEDE this is the cleanEnv function
1179          ### OLI_DANIELE
1180 <        txt += 'if [ $middleware == OSG ]; then\n'  
1181 <        txt += '    cd $RUNTIME_AREA\n'
1182 <        txt += '    echo "Remove working directory: $WORKING_DIR"\n'
1183 <        txt += '    /bin/rm -rf $WORKING_DIR\n'
1184 <        txt += '    if [ -d $WORKING_DIR ] ;then\n'
1185 <        txt += '        echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n'
1186 <        txt += '        echo "JOB_EXIT_STATUS = 60999"\n'
1187 <        txt += '        echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n'
1188 <        txt += '        dumpStatus $RUNTIME_AREA/$repo\n'
1189 <        txt += '        rm -f $RUNTIME_AREA/$repo \n'
1190 <        txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
1191 <        txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
1192 <        txt += '    fi\n'
1193 <        txt += 'fi\n'
1194 <        txt += '\n'
1180 >        #txt += 'if [ $middleware == OSG ]; then\n'  
1181 >        #txt += '    cd $RUNTIME_AREA\n'
1182 >        #txt += '    echo "Remove working directory: $WORKING_DIR"\n'
1183 >        #txt += '    /bin/rm -rf $WORKING_DIR\n'
1184 >        #txt += '    if [ -d $WORKING_DIR ] ;then\n'
1185 >        #txt += '        echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n'
1186 >        #txt += '        echo "JOB_EXIT_STATUS = 60999"\n'
1187 >        #txt += '        echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n'
1188 >        #txt += '        dumpStatus $RUNTIME_AREA/$repo\n'
1189 >        #txt += '        rm -f $RUNTIME_AREA/$repo \n'
1190 >        #txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
1191 >        #txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
1192 >        #txt += '    fi\n'
1193 >        #txt += 'fi\n'
1194 >        #txt += '\n'
1195  
1196          file_list = ''
1197          ## Add to filelist only files to be possibly copied to SE
# Line 1088 | Line 1211 | class Cmssw(JobType):
1211          # take away last extension
1212          name = p[0]
1213          for x in p[1:-1]:
1214 <           name=name+"."+x
1214 >            name=name+"."+x
1215          # add "_txt"
1216          if len(p)>1:
1217 <          ext = p[len(p)-1]
1218 <          result = name + '_' + txt + "." + ext
1217 >            ext = p[len(p)-1]
1218 >            result = name + '_' + txt + "." + ext
1219          else:
1220 <          result = name + '_' + txt
1220 >            result = name + '_' + txt
1221          
1222          return result
1223  
# Line 1107 | Line 1230 | class Cmssw(JobType):
1230              req='Member("VO-cms-' + \
1231                   self.version + \
1232                   '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
1233 +        # if self.executable_arch:
1234 +        #     req='Member("VO-cms-' + \
1235 +        #          self.executable_arch + \
1236 +        #          '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
1237  
1238          req = req + ' && (other.GlueHostNetworkAdapterOutboundIP)'
1239  
# Line 1126 | Line 1253 | class Cmssw(JobType):
1253          txt += '   echo "### SETUP CMS OSG  ENVIRONMENT ###"\n'
1254          txt += '   if [ -f $GRID3_APP_DIR/cmssoft/cmsset_default.sh ] ;then\n'
1255          txt += '      # Use $GRID3_APP_DIR/cmssoft/cmsset_default.sh to setup cms software\n'
1256 +        txt += '       export SCRAM_ARCH='+self.executable_arch+'\n'
1257          txt += '       source $GRID3_APP_DIR/cmssoft/cmsset_default.sh '+self.version+'\n'
1258          txt += '   elif [ -f $OSG_APP/cmssoft/cms/cmsset_default.sh ] ;then\n'
1259          txt += '      # Use $OSG_APP/cmssoft/cms/cmsset_default.sh to setup cms software\n'
1260 +        txt += '       export SCRAM_ARCH='+self.executable_arch+'\n'
1261          txt += '       source $OSG_APP/cmssoft/cms/cmsset_default.sh '+self.version+'\n'
1262          txt += '   else\n'
1263          txt += '       echo "SET_CMS_ENV 10020 ==> ERROR $GRID3_APP_DIR/cmssoft/cmsset_default.sh and $OSG_APP/cmssoft/cms/cmsset_default.sh file not found"\n'
# Line 1144 | Line 1273 | class Cmssw(JobType):
1273          txt += '       cd $RUNTIME_AREA\n'
1274          txt += '       /bin/rm -rf $WORKING_DIR\n'
1275          txt += '       if [ -d $WORKING_DIR ] ;then\n'
1276 <        txt += '            echo "SET_CMS_ENV 10017 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after $GRID3_APP_DIR/cmssoft/cmsset_default.sh and $OSG_APP/cmssoft/cms/cmsset_default.sh file not found"\n'
1277 <        txt += '            echo "JOB_EXIT_STATUS = 10017"\n'
1278 <        txt += '            echo "JobExitCode=10017" | tee -a $RUNTIME_AREA/$repo\n'
1279 <        txt += '            dumpStatus $RUNTIME_AREA/$repo\n'
1280 <        txt += '            rm -f $RUNTIME_AREA/$repo \n'
1281 <        txt += '            echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
1282 <        txt += '            echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
1276 >        txt += '           echo "SET_CMS_ENV 10017 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after $GRID3_APP_DIR/cmssoft/cmsset_default.sh and $OSG_APP/cmssoft/cms/cmsset_default.sh file not found"\n'
1277 >        txt += '           echo "JOB_EXIT_STATUS = 10017"\n'
1278 >        txt += '           echo "JobExitCode=10017" | tee -a $RUNTIME_AREA/$repo\n'
1279 >        txt += '           dumpStatus $RUNTIME_AREA/$repo\n'
1280 >        txt += '           rm -f $RUNTIME_AREA/$repo \n'
1281 >        txt += '           echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
1282 >        txt += '           echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
1283          txt += '       fi\n'
1284          txt += '\n'
1285          txt += '       exit 1\n'
# Line 1209 | Line 1338 | class Cmssw(JobType):
1338          txt += '   echo "### END SETUP CMS LCG ENVIRONMENT ###"\n'
1339          return txt
1340  
1341 +    ### FEDE FOR DBS OUTPUT PUBLICATION
1342 +    def modifyReport(self, nj):
1343 +        """
1344 +        insert the part of the script that modifies the FrameworkJob Report
1345 +        """
1346 +
1347 +        txt = ''
1348 +        txt += 'echo "Modify Job Report" \n'
1349 +        #txt += 'chmod a+x $RUNTIME_AREA/'+self.version+'/ProdAgentApi/FwkJobRep/ModifyJobReport.py\n'
1350 +        ################ FEDE FOR DBS2 #############################################
1351 +        txt += 'chmod a+x $SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py\n'
1352 +        #############################################################################
1353 +        try:
1354 +            publish_data = int(self.cfg_params['USER.publish_data'])          
1355 +        except KeyError:
1356 +            publish_data = 0
1357 +
1358 +        txt += 'if [ -z "$SE" ]; then\n'
1359 +        txt += '    SE="" \n'
1360 +        txt += 'fi \n'
1361 +        txt += 'if [ -z "$SE_PATH" ]; then\n'
1362 +        txt += '    SE_PATH="" \n'
1363 +        txt += 'fi \n'
1364 +        txt += 'echo "SE = $SE"\n'
1365 +        txt += 'echo "SE_PATH = $SE_PATH"\n'
1366 +
1367 +        if (publish_data == 1):  
1368 +            #processedDataset = self.cfg_params['USER.processed_datasetname']
1369 +            processedDataset = self.cfg_params['USER.publish_data_name']
1370 +            txt += 'ProcessedDataset='+processedDataset+'\n'
1371 +            #### LFN=/store/user/<user>/processedDataset_PSETHASH
1372 +            txt += 'if [ "$SE_PATH" == "" ]; then\n'
1373 +            #### FEDE: added slash in LFN ##############
1374 +            txt += '    FOR_LFN=/copy_problems/ \n'
1375 +            txt += 'else \n'
1376 +            txt += '    tmp=`echo $SE_PATH | awk -F \'store\' \'{print$2}\'` \n'
1377 +            #####  FEDE TO BE CHANGED, BECAUSE STORE IS HARDCODED!!!! ########
1378 +            txt += '    FOR_LFN=/store$tmp \n'
1379 +            txt += 'fi \n'
1380 +            txt += 'echo "ProcessedDataset = $ProcessedDataset"\n'
1381 +            txt += 'echo "FOR_LFN = $FOR_LFN" \n'
1382 +        else:
1383 +            txt += 'ProcessedDataset=no_data_to_publish \n'
1384 +            #### FEDE: added slash in LFN ##############
1385 +            txt += 'FOR_LFN=/local/ \n'
1386 +            txt += 'echo "ProcessedDataset = $ProcessedDataset"\n'
1387 +            txt += 'echo "FOR_LFN = $FOR_LFN" \n'
1388 +        txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n'
1389 +        #txt += 'echo "$RUNTIME_AREA/'+self.version+'/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n'
1390 +        txt += 'echo "$SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n'
1391 +        txt += '$SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n'
1392 +        #txt += '$RUNTIME_AREA/'+self.version+'/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n'
1393 +        txt += 'modifyReport_result=$?\n'
1394 +        txt += 'echo modifyReport_result = $modifyReport_result\n'
1395 +        txt += 'if [ $modifyReport_result -ne 0 ]; then\n'
1396 +        txt += '    exit_status=1\n'
1397 +        txt += '    echo "ERROR: Problem with ModifyJobReport"\n'
1398 +        txt += 'else\n'
1399 +        txt += '    mv NewFrameworkJobReport.xml crab_fjr_$NJob.xml\n'
1400 +        txt += 'fi\n'
1401 +        return txt
1402 +
1403 +    def cleanEnv(self):
1404 +        ### OLI_DANIELE
1405 +        txt = ''
1406 +        txt += 'if [ $middleware == OSG ]; then\n'  
1407 +        txt += '    cd $RUNTIME_AREA\n'
1408 +        txt += '    echo "Remove working directory: $WORKING_DIR"\n'
1409 +        txt += '    /bin/rm -rf $WORKING_DIR\n'
1410 +        txt += '    if [ -d $WORKING_DIR ] ;then\n'
1411 +        txt += '              echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n'
1412 +        txt += '              echo "JOB_EXIT_STATUS = 60999"\n'
1413 +        txt += '              echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n'
1414 +        txt += '              dumpStatus $RUNTIME_AREA/$repo\n'
1415 +        txt += '        rm -f $RUNTIME_AREA/$repo \n'
1416 +        txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
1417 +        txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
1418 +        txt += '    fi\n'
1419 +        txt += 'fi\n'
1420 +        txt += '\n'
1421 +        return txt
1422 +
1423      def setParam_(self, param, value):
1424          self._params[param] = value
1425  
# Line 1221 | Line 1432 | class Cmssw(JobType):
1432      def getTaskid(self):
1433          return self._taskId
1434  
1224 #######################################################################
1435      def uniquelist(self, old):
1436          """
1437          remove duplicates from a list

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines