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.49 by slacapra, Thu Oct 5 15:32:20 2006 UTC vs.
Revision 1.55 by slacapra, Wed Nov 22 14:57:26 2006 UTC

# Line 36 | Line 36 | class Cmssw(JobType):
36          self.pset = ''      #scrip use case Da  
37          self.datasetPath = '' #scrip use case Da
38  
39 +        # set FJR file name
40 +        self.fjrFileName = 'crab_fjr.xml'
41 +
42          self.version = self.scram.getSWVersion()
43 +        common.taskDB.setDict('codeVersion',self.version)
44          self.setParam_('application', self.version)
45  
46          ### collect Data cards
# Line 94 | Line 98 | class Cmssw(JobType):
98              raise CrabException("PSet file missing. Cannot run cmsRun ")
99  
100          # output files
101 +        ## stuff which must be returned always via sandbox
102 +        self.output_file_sandbox = []
103 +
104 +        # add fjr report by default via sandbox
105 +        self.output_file_sandbox.append(self.fjrFileName)
106 +
107 +        # other output files to be returned via sandbox or copied to SE
108          try:
109              self.output_file = []
110  
111 +
112              tmp = cfg_params['CMSSW.output_file']
113              if tmp != '':
114                  tmpOutFiles = string.split(cfg_params['CMSSW.output_file'],',')
# Line 106 | Line 118 | class Cmssw(JobType):
118                      self.output_file.append(tmp)
119                      pass
120              else:
121 <                log.message("No output file defined: only stdout/err will be available")
121 >                log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available")
122                  pass
123              pass
124          except KeyError:
125 <            log.message("No output file defined: only stdout/err will be available")
125 >            log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available")
126              pass
127  
128          # script_exe file as additional file in inputSandbox
# Line 132 | Line 144 | class Cmssw(JobType):
144          try:
145              tmpAddFiles = string.split(cfg_params['USER.additional_input_files'],',')
146              for tmp in tmpAddFiles:
147 +                tmp = string.strip(tmp)
148                  dirname = ''
149                  if not tmp[0]=="/": dirname = "."
150                  files = glob.glob(os.path.join(dirname, tmp))
# Line 236 | Line 249 | class Cmssw(JobType):
249                          self.PsetEdit.pythiaSeed("INPUT")
250                          if (self.sourceSeedVtx) :
251                              self.PsetEdit.pythiaSeedVtx("INPUTVTX")
252 +                # add FrameworkJobReport to parameter-set
253 +                self.PsetEdit.addCrabFJR(self.fjrFileName)
254                  self.PsetEdit.psetWriter(self.configFilename())
255              except:
256                  msg='Error while manipuliating ParameterSet: exiting...'
# Line 656 | Line 671 | class Cmssw(JobType):
671          dataDir = 'src/Data/'
672          if os.path.isdir(swArea+'/'+dataDir):
673              filesToBeTarred.append(dataDir)
674 <
674 >
675 >        ## copy ProdAgent dir to swArea
676 >        cmd = '\cp -rf ' + os.environ['CRABDIR'] + '/ProdAgentApi ' + swArea
677 >        cmd_out = runCommand(cmd)
678 >        if cmd_out != '':
679 >            common.logger.message('ProdAgentApi directory could not be copied to local CMSSW project directory.')
680 >            common.logger.message('No FrameworkJobreport parsing is possible on the WorkerNode.')
681 >
682 >        ## Now check if the Data dir is present
683 >        paDir = 'ProdAgentApi'
684 >        if os.path.isdir(swArea+'/'+paDir):
685 >            filesToBeTarred.append(paDir)
686 >
687          ## Create the tar-ball
688          if len(filesToBeTarred)>0:
689              cwd = os.getcwd()
# Line 864 | Line 891 | class Cmssw(JobType):
891              txt += 'else \n'
892              txt += '   echo "Successful untar" \n'
893              txt += 'fi \n'
894 +            txt += '\n'
895 +            txt += 'echo "Include ProdAgentApi in PYTHONPATH"\n'
896 +            txt += 'if [ -z "$PYTHONPATH" ]; then\n'
897 +            txt += '   export PYTHONPATH=ProdAgentApi\n'
898 +            txt += 'else\n'
899 +            txt += '   export PYTHONPATH=ProdAgentApi:${PYTHONPATH}\n'
900 +            txt += 'fi\n'
901 +            txt += '\n'
902 +
903              pass
904          
905          return txt
# Line 891 | Line 927 | class Cmssw(JobType):
927          Returns a list of filenames to be put in JDL input sandbox.
928          """
929          inp_box = []
930 <        # dict added to delete duplicate from input sandbox file list
931 <        seen = {}
930 >        # # dict added to delete duplicate from input sandbox file list
931 >        # seen = {}
932          ## code
933          if os.path.isfile(self.tgzNameWithPath):
934              inp_box.append(self.tgzNameWithPath)
# Line 910 | Line 946 | class Cmssw(JobType):
946          """
947          out_box = []
948  
913        stdout=common.job_list[nj].stdout()
914        stderr=common.job_list[nj].stderr()
915
949          ## User Declared output files
950 <        for out in self.output_file:
950 >        for out in (self.output_file+self.output_file_sandbox):
951              n_out = nj + 1
952              out_box.append(self.numberFile_(out,str(n_out)))
953          return out_box
921        return []
954  
955      def prepareSteeringCards(self):
956          """
# Line 934 | Line 966 | class Cmssw(JobType):
966          txt = '\n'
967          txt += '# directory content\n'
968          txt += 'ls \n'
969 <        file_list = ''
970 <        for fileWithSuffix in self.output_file:
969 >
970 >        for fileWithSuffix in (self.output_file+self.output_file_sandbox):
971              output_file_num = self.numberFile_(fileWithSuffix, '$NJob')
940            file_list=file_list+output_file_num+' '
972              txt += '\n'
973              txt += '# check output file\n'
974              txt += 'ls '+fileWithSuffix+'\n'
975              txt += 'ls_result=$?\n'
945            #txt += 'exe_result=$?\n'
976              txt += 'if [ $ls_result -ne 0 ] ; then\n'
977              txt += '   echo "ERROR: Problem with output file"\n'
948            #txt += '   echo "JOB_EXIT_STATUS = $exe_result"\n'
949            #txt += '   echo "JobExitCode=60302" | tee -a $RUNTIME_AREA/$repo\n'
950            #txt += '   dumpStatus $RUNTIME_AREA/$repo\n'
951            ### OLI_DANIELE
978              if common.scheduler.boss_scheduler_name == 'condor_g':
979                  txt += '    if [ $middleware == OSG ]; then \n'
980                  txt += '        echo "prepare dummy output file"\n'
# Line 959 | Line 985 | class Cmssw(JobType):
985              txt += 'fi\n'
986        
987          txt += 'cd $RUNTIME_AREA\n'
962        file_list=file_list[:-1]
963        txt += 'file_list="'+file_list+'"\n'
988          txt += 'cd $RUNTIME_AREA\n'
989          ### OLI_DANIELE
990          txt += 'if [ $middleware == OSG ]; then\n'  
# Line 978 | Line 1002 | class Cmssw(JobType):
1002          txt += '    fi\n'
1003          txt += 'fi\n'
1004          txt += '\n'
1005 +
1006 +        file_list = ''
1007 +        ## Add to filelist only files to be possibly copied to SE
1008 +        for fileWithSuffix in self.output_file:
1009 +            output_file_num = self.numberFile_(fileWithSuffix, '$NJob')
1010 +            file_list=file_list+output_file_num+' '
1011 +        file_list=file_list[:-1]
1012 +        txt += 'file_list="'+file_list+'"\n'
1013 +
1014          return txt
1015  
1016      def numberFile_(self, file, txt):

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines