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

Comparing COMP/CRAB/python/SchedulerEdg.py (file contents):
Revision 1.64 by gutsche, Tue Jun 27 02:31:31 2006 UTC vs.
Revision 1.73.2.5.2.2 by fanzago, Mon Aug 21 15:08:24 2006 UTC

# Line 48 | Line 48 | class SchedulerEdg(Scheduler):
48  
49          try:
50              self.EDG_ce_black_list = cfg_params['EDG.ce_black_list']
51            #print "self.EDG_ce_black_list = ", self.EDG_ce_black_list
51          except KeyError:
52              self.EDG_ce_black_list  = ''
53  
54          try:
55              self.EDG_ce_white_list = cfg_params['EDG.ce_white_list']
57            #print "self.EDG_ce_white_list = ", self.EDG_ce_white_list
56          except KeyError: self.EDG_ce_white_list = ''
57  
58          try: self.VO = cfg_params['EDG.virtual_organization']
# Line 65 | Line 63 | class SchedulerEdg(Scheduler):
63  
64          try:
65               self.copy_input_data = common.analisys_common_info['copy_input_data']
68             #print "self.copy_input_data = ", self.copy_input_data
66          except KeyError: self.copy_input_data = 0
67  
68          try:
# Line 139 | Line 136 | class SchedulerEdg(Scheduler):
136          except KeyError: self.EDG_cpu_time = ''
137  
138          # Add EDG_WL_LOCATION to the python path
142
139          try:
140              path = os.environ['EDG_WL_LOCATION']
141          except:
# Line 158 | Line 154 | class SchedulerEdg(Scheduler):
154          except:
155              self._taskId = ''
156  
157 +        try: self.jobtypeName = cfg_params['CRAB.jobtype']
158 +        except KeyError: self.jobtypeName = ''
159 +
160 +        try: self.schedulerName = cfg_params['CRAB.scheduler']
161 +        except KeyError: self.scheduler = ''
162 +
163          return
164      
165  
# Line 165 | Line 167 | class SchedulerEdg(Scheduler):
167          """
168          Returns file with scheduler-specific parameters
169          """
168      
170          if (self.edg_config and self.edg_config_vo != ''):
171              self.param='sched_param.clad'
172              param_file = open(common.work_space.shareDir()+'/'+self.param, 'w')
# Line 215 | Line 216 | class SchedulerEdg(Scheduler):
216          txt += '    dumpStatus $RUNTIME_AREA/$repo \n'
217          txt += '    rm -f $RUNTIME_AREA/$repo \n'
218          txt += '    echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
218        txt += '    echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
219          txt += '    echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
220          txt += '    exit 1 \n'
221          txt += 'fi \n'
# Line 224 | Line 224 | class SchedulerEdg(Scheduler):
224          txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
225          txt += 'rm -f $RUNTIME_AREA/$repo \n'
226          txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
227        txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
227          txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
228          
229          txt += '\n\n'
# Line 294 | Line 293 | class SchedulerEdg(Scheduler):
293          txt += '        dumpStatus $RUNTIME_AREA/$repo \n'
294          txt += '        rm -f $RUNTIME_AREA/$repo \n'
295          txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
297        txt += '        echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
296          txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
297          txt += '        exit 1 \n'
298          txt += '    fi \n'
# Line 325 | Line 323 | class SchedulerEdg(Scheduler):
323   ### changed by georgia (put a loop copying more than one input files per jobs)          
324             txt += '   for input_file in $cur_file_list \n'
325             txt += '   do \n'
326 <           txt += '    lcg-cp --vo $VO lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
327 <           txt += '    copy_input_exit_status=$?\n'
328 <           txt += '    echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
329 <           txt += '    if [ $copy_input_exit_status -ne 0 ]; then \n'
330 <           txt += '       echo "Problems with copying to WN" \n'
331 <           txt += '    else \n'
332 <           txt += '       echo "input copied into WN" \n'
333 <           txt += '    fi \n'
326 >           #### FEDE
327 >           #txt += '      echo "which lcg-cp" \n'
328 >           #txt += '      which lcg-cp \n'
329 >           #########
330 >           txt += '      lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
331 >           txt += '      copy_input_exit_status=$?\n'
332 >           txt += '      echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
333 >           txt += '      if [ $copy_input_exit_status -ne 0 ]; then \n'
334 >           txt += '         echo "Problems with copying to WN" \n'
335 >           txt += '      else \n'
336 >           txt += '         echo "input copied into WN" \n'
337 >           txt += '      fi \n'
338             txt += '   done \n'
339   ### copy a set of PU ntuples (same for each jobs -- but accessed randomly)
340             txt += '   for file in $cur_pu_list \n'
341             txt += '   do \n'
342 <           txt += '    lcg-cp --vo $VO lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
343 <           txt += '    copy_input_exit_status=$?\n'
344 <           txt += '    echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
345 <           txt += '    if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
346 <           txt += '       echo "Problems with copying pu to WN" \n'
347 <           txt += '    else \n'
348 <           txt += '       echo "input pu files copied into WN" \n'
349 <           txt += '    fi \n'
342 >           #### FEDE
343 >           #txt += '      echo "which lcg-cp" \n'
344 >           #txt += '      which lcg-cp \n'
345 >           #########
346 >           txt += '      lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
347 >           txt += '      copy_input_pu_exit_status=$?\n'
348 >           txt += '      echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
349 >           txt += '      if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
350 >           txt += '         echo "Problems with copying pu to WN" \n'
351 >           txt += '      else \n'
352 >           txt += '         echo "input pu files copied into WN" \n'
353 >           txt += '      fi \n'
354             txt += '   done \n'
355             txt += '   \n'
356             txt += '   ### Check SCRATCH space available on WN : \n'
# Line 363 | Line 369 | class SchedulerEdg(Scheduler):
369             txt += '#\n'
370             txt += '#   Copy output to SE = $SE\n'
371             txt += '#\n'
372 <           txt += 'if [ $exe_result -eq 0 ]; then\n'
372 >           #txt += 'if [ $exe_result -eq 0 ]; then\n'
373 >           txt += '    if [ $middleware == OSG ]; then\n'
374 >           txt += '        echo "X509_USER_PROXY = $X509_USER_PROXY"\n'
375 >           txt += '        echo "source $OSG_APP/glite/setup_glite_ui.sh"\n'
376 >           txt += '        source $OSG_APP/glite/setup_glite_ui.sh\n'
377 >           txt += '        export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n'
378 >           txt += '        echo "export X509_CERT_DIR=$X509_CERT_DIR"\n'
379 >           txt += '    fi \n'
380             txt += '    for out_file in $file_list ; do\n'
381 <           txt += '        echo "Trying to copy output file to $SE "\n'
382 <           ## OLI_Daniele globus-* for OSG, lcg-* for LCG
383 <           txt += '        if [ $middleware == OSG ]; then\n'
384 <           txt += '           echo "globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
385 <           txt += '           globus-url-copy file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1 \n'
373 <           txt += '           copy_exit_status=$? \n'
374 <           txt += '        elif [ $middleware == LCG ]; then \n'
375 <           txt += '           echo "lcg-cp --vo cms -t 1200 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
376 <           txt += '           lcg-cp --vo cms -t 1200 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1\n'
377 <           txt += '           copy_exit_status=$? \n'
378 <           txt += '        fi \n'
379 <           txt += '        echo "COPY_EXIT_STATUS = $copy_exit_status"\n'
381 >           txt += '        echo "Trying to copy output file to $SE using lcg-cp"\n'
382 >           txt += '        echo "lcg-cp --vo $VO -t 1200 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
383 >           txt += '        exitstring=`lcg-cp --vo $VO -t 1200 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
384 >           txt += '        copy_exit_status=$?\n'
385 >           txt += '        echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n'
386             txt += '        echo "STAGE_OUT = $copy_exit_status"\n'
387             txt += '        if [ $copy_exit_status -ne 0 ]; then\n'
388 <           txt += '            echo "Problems with SE = $SE"\n'
388 >           txt += '            echo "Possible problem with SE = $SE"\n'
389             txt += '            echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
390             txt += '            echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
391 +           txt += '            echo "lcg-cp failed, attempting srmcp"\n'
392 +           txt += '            echo "mkdir -p $HOME/.srmconfig"\n'
393 +           txt += '            mkdir -p $HOME/.srmconfig\n'
394 +           txt += '            if [ $middleware == LCG ]; then\n'
395 +           txt += '               echo "srmcp -retry_num 5 -retry_timeout 240000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n'
396 +           txt += '               exitstring=`srmcp -retry_num 5 -retry_timeout 240000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n'
397 +           txt += '            elif [ $middleware == OSG ]; then\n'
398 +           txt += '               echo "srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n'
399 +           txt += '               exitstring=`srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n'
400 +           txt += '            fi \n'
401 +           txt += '            copy_exit_status=$?\n'
402 +           txt += '            echo "COPY_EXIT_STATUS for srm = $copy_exit_status"\n'
403 +           txt += '            echo "STAGE_OUT = $copy_exit_status"\n'
404 +           txt += '            if [ $copy_exit_status -ne 0 ]; then\n'
405 +           txt += '               echo "Problems with SE = $SE"\n'
406 +           txt += '               echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
407 +           txt += '               echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
408 +           txt += '               echo "lcg-cp and srm failed"\n'
409 +           txt += '               echo "If storage_path in your config file contains a ? you may need a \? instead."\n'
410 +           txt += '            else\n'
411 +           txt += '               echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
412 +           txt += '               echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
413 +           txt += '               echo "output copied into $SE/$SE_PATH directory"\n'
414 +           txt += '               echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
415 +           txt += '               echo "srmcp succeeded"\n'
416 +           txt += '            fi\n'
417             txt += '        else\n'
418             txt += '            echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
419             txt += '            echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
420             txt += '            echo "output copied into $SE/$SE_PATH directory"\n'
421             txt += '            echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
422 +           txt += '            echo "lcg-cp succeeded"\n'
423             txt += '         fi\n'
424             txt += '     done\n'
425 <           txt += 'fi\n'
425 >           #txt += 'fi\n'
426          return txt
427  
428      def wsRegisterOutput(self):
# Line 409 | Line 442 | class SchedulerEdg(Scheduler):
442             txt += '#\n'
443             txt += '#  Register output to LFC\n'
444             txt += '#\n'
445 <           txt += '   if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
445 >           #txt += '   if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
446 >           txt += '   if [ $copy_exit_status -eq 0 ]; then\n'
447             txt += '      for out_file in $file_list ; do\n'
448             txt += '         echo "Trying to register the output file into LFC"\n'
449 <           txt += '         echo "lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file"\n'
450 <           txt += '         lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file 2>&1 \n'
449 >           #### FEDE
450 >           #txt += '         echo "which lcg-rf" \n'
451 >           #txt += '         which lcg-rf \n'
452 >           #########
453 >           txt += '         echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1"\n'
454 >           txt += '         lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1 \n'
455             txt += '         register_exit_status=$?\n'
456             txt += '         echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
457             txt += '         echo "STAGE_OUT = $register_exit_status"\n'
458             txt += '         if [ $register_exit_status -ne 0 ]; then \n'
459             txt += '            echo "Problems with the registration to LFC" \n'
460             txt += '            echo "Try with srm protocol" \n'
461 <           txt += '            echo "lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file"\n'
462 <           txt += '            lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file 2>&1 \n'
461 >           #### FEDE
462 >           #txt += '            echo "which lcg-rf" \n'
463 >           #txt += '            which lcg-rf \n'
464 >           #########
465 >           txt += '            echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1"\n'
466 >           txt += '            lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1 \n'
467             txt += '            register_exit_status=$?\n'
468             txt += '            echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
469             txt += '            echo "STAGE_OUT = $register_exit_status"\n'
# Line 433 | Line 475 | class SchedulerEdg(Scheduler):
475             txt += '         fi \n'
476             txt += '         echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
477             txt += '      done\n'
478 <           txt += '   elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n'
478 >           #txt += '   elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n'
479 >           txt += '   else \n'
480             txt += '      echo "Trying to copy output file to CloseSE"\n'
481             txt += '      CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n'
482             txt += '      for out_file in $file_list ; do\n'
483 <           txt += '         echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n'
484 <           txt += '         lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file 2>&1 \n'
483 >           #### FEDE
484 >           #txt += '         echo "which lcg-cr" \n'
485 >           #txt += '         which lcg-cr \n'
486 >           #########
487 >           txt += '         echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1" \n'
488 >           txt += '         lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1 \n'
489             txt += '         register_exit_status=$?\n'
490             txt += '         echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
491             txt += '         echo "STAGE_OUT = $register_exit_status"\n'
492             txt += '         if [ $register_exit_status -ne 0 ]; then \n'
493 <           txt += '            echo "Problems with CloseSE" \n'
493 >           txt += '            echo "Problems with CloseSE or Catalog" \n'
494             txt += '         else \n'
495             txt += '            echo "The program was successfully executed"\n'
496             txt += '            echo "SE = $CLOSE_SE"\n'
# Line 451 | Line 498 | class SchedulerEdg(Scheduler):
498             txt += '         fi \n'
499             txt += '         echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
500             txt += '      done\n'
501 <           txt += '   else\n'
502 <           txt += '      echo "Problem with the executable"\n'
501 >           #txt += '   else\n'
502 >           #txt += '      echo "Problem with the executable"\n'
503             txt += '   fi \n'
504 +           txt += '   exit_status=$register_exit_status\n'
505             txt += 'fi \n'
506          return txt
507  
# Line 472 | Line 520 | class SchedulerEdg(Scheduler):
520          Check the compatibility of available resources
521          """
522          self.checkProxy()
523 <        jdl = common.job_list[nj].jdlFilename()
524 <        cmd = 'edg-job-list-match ' + self.configOpt_() + jdl
523 >        jdl = common.work_space.shareDir()+"fake.jdl"
524 >        cmd = 'edg-job-list-match ' + self.configOpt_() + str(jdl)
525          cmd_out = runCommand(cmd,0,10)
526          if not cmd_out:
527              raise CrabException("ERROR: "+cmd+" failed!")
# Line 642 | Line 690 | class SchedulerEdg(Scheduler):
690          cmd = 'edg-job-cancel --noint ' + id
691          cmd_out = runCommand(cmd)
692          return cmd_out
693 <
694 <    def createSchScript(self, nj):
695 <        """
696 <        Create a JDL-file for EDG.
693 >
694 >    def createFakeJdl(self,nj):  # TMP Just waiting listmatch functionalitly  
695 >                                  # implementation into BOSS4   Daniele
696 >        """                          
697 >        Create a fake jdl considering
698 >        only requirements  
699          """
650
700          job = common.job_list[nj]
701          jbt = job.type()
653        inp_sandbox = jbt.inputSandbox(nj)
654        out_sandbox = jbt.outputSandbox(nj)
702          inp_storage_subdir = ''
703          
657        title = '# This JDL was generated by '+\
658                common.prog_name+' (version '+common.prog_version_str+')\n'
659        jt_string = ''
660
661
704          
705          SPL = inp_storage_subdir
706          if ( SPL and SPL[-1] != '/' ) : SPL = SPL + '/'
707  
708 <        jdl_fname = job.jdlFilename()
667 <        jdl = open(jdl_fname, 'w')
668 <        jdl.write(title)
708 >        jdl = open(common.work_space.shareDir()+"fake.jdl","w")
709  
710          script = job.scriptFilename()
711          jdl.write('Executable = "' + os.path.basename(script) +'";\n')
672        jdl.write(jt_string)
673
674        ### only one .sh  JDL has arguments:
675
676        ### Fabio
677        jdl.write('Arguments = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'";\n')
678        inp_box = 'InputSandbox = { '
679        inp_box = inp_box + '"' + script + '",'
680
681        if inp_sandbox != None:
682            for fl in inp_sandbox:
683                inp_box = inp_box + ' "' + fl + '",'
684                pass
685            pass
686
687        #if common.use_jam:
688        #   inp_box = inp_box+' "'+common.bin_dir+'/'+common.run_jam+'",'
689
690        # Marco (VERY TEMPORARY ML STUFF)
691        inp_box = inp_box+' "' + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + '", "' +\
692                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + '", "'+\
693                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + '", "'+\
694                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + '", "'+\
695                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + '"'
696        # End Marco
697
698        if (not jbt.additional_inbox_files == []):
699            inp_box = inp_box + ', '
700            for addFile in jbt.additional_inbox_files:
701                addFile = os.path.abspath(addFile)
702                inp_box = inp_box+' "'+addFile+'",'
703                pass
704
705        if inp_box[-1] == ',' : inp_box = inp_box[:-1]
706        inp_box = inp_box + ' };\n'
707        jdl.write(inp_box)
708
709        jdl.write('StdOutput     = "' + job.stdout() + '";\n')
710        jdl.write('StdError      = "' + job.stderr() + '";\n')
711        
712        
713        if job.stdout() == job.stderr():
714          out_box = 'OutputSandbox = { "' + \
715                    job.stdout() + '", ".BrokerInfo",'
716        else:
717          out_box = 'OutputSandbox = { "' + \
718                    job.stdout() + '", "' + \
719                    job.stderr() + '", ".BrokerInfo",'
720
721        if int(self.return_data) == 1:
722            if out_sandbox != None:
723                for fl in out_sandbox:
724                    out_box = out_box + ' "' + fl + '",'
725                    pass
726                pass
727            pass
728                                                                                                                                                            
729        if out_box[-1] == ',' : out_box = out_box[:-1]
730        out_box = out_box + ' };'
731        jdl.write(out_box+'\n')
732
712  
713          req='Requirements = '
714          noreq=req
# Line 790 | Line 769 | class SchedulerEdg(Scheduler):
769  
770          jdl.close()
771          return
772 +        
773 +
774 +    def createXMLSchScript(self, nj):
775 +        """
776 +        Create a XML-file for BOSS4.
777 +        """
778 +        job = common.job_list[nj]
779 +        jbt = job.type()
780 +
781 +        inp_sandbox = jbt.inputSandbox(nj)
782 +        out_sandbox = jbt.outputSandbox(nj)
783 +  
784 +        title = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
785 +        jt_string = ''
786 +        
787 +        xml_fname = str(self.jobtypeName)+'.xml'
788 +        xml = open(common.work_space.shareDir()+'/'+xml_fname, 'a')
789 +
790 +        #TaskName  
791 +        dir = string.split(common.work_space.topDir(), '/')
792 +        taskName = dir[len(dir)-2]
793 +  
794 +        to_writeReq = ''
795 +        to_write = ''
796 +        req=' '
797 +        req = req + jbt.getRequirements()
798 +        if self.EDG_requirements:
799 +            if (req == ' '):
800 +                req = req + self.EDG_requirements
801 +            else:
802 +                req = req +  ' && ' + self.EDG_requirements
803 +        if self.EDG_ce_white_list:
804 +            ce_white_list = string.split(self.EDG_ce_white_list,',')
805 +            for i in range(len(ce_white_list)):
806 +                if i == 0:
807 +                    if (req == ' '):
808 +                        req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
809 +                    else:
810 +                        req = req +  ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
811 +                    pass
812 +                else:
813 +                    req = req +  ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
814 +            req = req + ')'
815 +        
816 +        if self.EDG_ce_black_list:
817 +            ce_black_list = string.split(self.EDG_ce_black_list,',')
818 +            for ce in ce_black_list:
819 +                if (req == ' '):
820 +                    req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
821 +                else:
822 +                    req = req +  ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))'
823 +                pass
824 +        if self.EDG_clock_time:
825 +            if (req == ' '):
826 +                req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
827 +            else:
828 +                req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
829 +
830 +        if self.EDG_cpu_time:
831 +            if (req == ' '):
832 +                req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
833 +            else:
834 +                req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
835 +        if (req != ' '):
836 +            req = req + '\n'
837 +            to_writeReq = req
838 +                                                                                                                                                            
839 +
840 +        if ( self.EDG_retry_count ):              
841 +            to_write = to_write + 'RetryCount = "'+self.EDG_retry_count+'"\n'
842 +            pass
843 +
844 +        to_write = to_write + 'MyProxyServer = "&quot;' + self.proxyServer + '&quot;"\n'
845 +        to_write = to_write + 'VirtualOrganisation = "&quot;' + self.VO + '&quot;"\n'
846 +
847 +
848 +        #TaskName  
849 +        dir = string.split(common.work_space.topDir(), '/')
850 +        taskName = dir[len(dir)-2]
851 +
852 +        if nj == 0:
853 +            xml.write(str(title))
854 +            xml.write('<task name="' +str(taskName)+'">\n')
855 +            xml.write(jt_string)
856 +            #Here it must pass the extra Tags.. (into Task & out of chain)  
857 +            if (to_writeReq != ''):
858 +                xml.write('<extraTags>\n')
859 +                xml.write('<Requirements>\n')
860 +                xml.write('<![CDATA[\n')
861 +                xml.write(to_writeReq)
862 +                xml.write(']]>\n')
863 +                xml.write('</Requirements>\n')
864 +                xml.write('</extraTags>\n')
865 +                pass
866 +
867 +            if (to_write != ''):
868 +                xml.write('<extraTags\n')
869 +                xml.write(to_write)
870 +                xml.write('/>\n')
871 +                pass
872 +            pass
873 +  
874 +        xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n')
875 +        xml.write(jt_string)
876 +
877 +        #executable
878 +        script = job.scriptFilename()
879 +        xml.write('<program exec="' + os.path.basename(script) +'"\n')
880 +        xml.write(jt_string)
881 +    
882 +          
883 +        ### only one .sh  JDL has arguments:
884 +        ### Fabio
885 +        xml.write('args = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'"\n')
886 +        xml.write('program_types="crabjob"\n')
887 +        inp_box = 'infiles="'
888 +        inp_box = inp_box + '' + script + ','
889 +
890 +        if inp_sandbox != None:
891 +            for fl in inp_sandbox:
892 +                inp_box = inp_box + '' + fl + ','
893 +                pass
894 +            pass
895 +
896 +        # Marco (VERY TEMPORARY ML STUFF)
897 +        inp_box = inp_box + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + ',' +\
898 +                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\
899 +                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\
900 +                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\
901 +                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py')
902 +        # End Marco
903 +
904 +        if (not jbt.additional_inbox_files == []):
905 +            inp_box = inp_box + ', '
906 +            for addFile in jbt.additional_inbox_files:
907 +                addFile = os.path.abspath(addFile)
908 +                inp_box = inp_box+''+addFile+','
909 +                pass
910 +
911 +        if inp_box[-1] == ',' : inp_box = inp_box[:-1]
912 +        inp_box = inp_box + ' "\n'
913 +        xml.write(inp_box)
914 +
915 +        xml.write('stderr="' + job.stderr() + '"\n')
916 +        xml.write('stdout="' + job.stdout() + '"\n')
917 +        
918 +        
919 +        if job.stdout() == job.stderr():
920 +          out_box = 'outfiles="' + \
921 +                    job.stdout() + ',.BrokerInfo,'
922 +        else:
923 +          out_box = 'outfiles="' + \
924 +                    job.stdout() + ',' + \
925 +                    job.stderr() + ',.BrokerInfo,'
926 +
927 +        if int(self.return_data) == 1:
928 +            if out_sandbox != None:
929 +                for fl in out_sandbox:
930 +                    out_box = out_box + '' + fl + ','
931 +                    pass
932 +                pass
933 +            pass
934 +                                                                                                                                                            
935 +        if out_box[-1] == ',' : out_box = out_box[:-1]
936 +        out_box = out_box + '"'
937 +        xml.write(out_box+'\n')
938 +
939 +        xml.write('group="'+taskName+'"\n')
940 +        xml.write('BossAttr="[crabjob.INTERNAL_ID=' + str(nj+1) +']"\n')
941 +
942 +        
943 +      
944 +        xml.write('/>\n')
945 +        xml.write('</chain>\n')
946 +
947 +        if int(nj) == int(common.jobDB.nJobs()-1): xml.write('</task>\n')
948 +
949 +
950 +        xml.close()
951 +
952 +        return
953 +
954 +
955  
956      def checkProxy(self):
957          """
# Line 804 | Line 966 | class SchedulerEdg(Scheduler):
966          #cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00'
967          #cmd = 'voms-proxy-info -timeleft'
968          mustRenew = 0
969 <        timeLeftLocal = runCommand('voms-proxy-info -timeleft')
969 >        timeLeftLocal = runCommand('voms-proxy-info -timeleft 2>/dev/null')
970          timeLeftServer = -999
971          if not timeLeftLocal or int(timeLeftLocal) <= 0 or not isInt(timeLeftLocal):
972              mustRenew = 1
973          else:
974 <            timeLeftServer = runCommand('voms-proxy-info -actimeleft | head -1')
974 >            timeLeftServer = runCommand('voms-proxy-info -actimeleft 2>/dev/null | head -1')
975              if not timeLeftServer or not isInt(timeLeftServer):
976                  mustRenew = 1
977              elif timeLeftLocal<minTimeLeft or timeLeftServer<minTimeLeft:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines