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

Comparing COMP/CRAB/python/SchedulerLsf.py (file contents):
Revision 1.14 by spiga, Wed Jun 11 10:03:07 2008 UTC vs.
Revision 1.22 by gcodispo, Mon Sep 8 12:50:07 2008 UTC

# Line 4 | Line 4 | from crab_exceptions import *
4   from crab_util import *
5   from crab_logger import Logger
6   import common
7 + from LFNBaseName import *
8  
9   import os,string
10  
# Line 38 | Line 39 | class SchedulerLsf(SchedulerLocal) :
39          self.rfioName =  cfg_params.get(self.name().upper()+'.rfio_server','')
40  
41          params = { 'cpCmd'  : self.cpCmd, \
42 <                   'rfipName' : self.rfioName
42 >                   'rfioName' : self.rfioName
43                   }
44          return  params
45  
# Line 46 | Line 47 | class SchedulerLsf(SchedulerLocal) :
47          """
48          Returns parameter scheduler-specific, to use with BOSS .
49          """
49        index = int(common._db.nJobs()) - 1
50          sched_param= ''
51  
52 <        for i in range(index): # Add loop DS
52 >        if (self.queue):
53 >            sched_param += '-q '+self.queue +' '
54 >            if (self.res): sched_param += ' -R '+self.res +' '
55  
56 <            sched_param= ''
55 <            if (self.queue):
56 <                sched_param += '-q '+self.queue +' '
57 <                if (self.res): sched_param += ' -R '+self.res +' '
58 <            pass
59 <
60 <        sched_param+='-cwd '+ str(self.outputDir)  + ' '
56 >        # sched_param+='-cwd '+ str(self.outputDir)  + ' '
57          return sched_param
58 +  
59 +    def listMatch(self, dest, full):
60 +        """
61 +        """
62 +        if len(dest)!=0:
63 +            sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')]
64 +        else:    
65 +            sites = [str(getLocalDomain(self))]  
66 +        return sites    
67  
68      def loggingInfo(self, id):
69          """ return logging info about job nj """
# Line 86 | Line 91 | class SchedulerLsf(SchedulerLocal) :
91  
92          return txt
93  
94 +    def wsCopyOutput_tmp(self,pool=None):
95 +        #########################################################################
96 +        ### Temporary we added this function to be used by
97 +        ### SchedulerLsf and SchedulerCaf to have a copy function based on cmscp
98 +        ### This function overwrite the wsCopyOutput written in SchedulerLocal
99 +        ### and used by CondorLocal
100 +        #########################################################################
101 +        """
102 +        Write a CopyResults part of a job script, e.g.
103 +        to copy produced output into a storage element.
104 +        """
105 +        txt = '\n'
106 +        if not self.copy_data: return txt
107 +
108 +        if int(self.publish_data) == 1:
109 +                ### FEDE FOR NEW LFN ####
110 +                #self.path_add = PFNportion(self.publish_data_name,LocalUser=True) +'_${PSETHASH}/'
111 +                self.path_add = PFNportion(self.primaryDataset, self.publish_data_name,LocalUser=True) +'/${PSETHASH}/'
112 +                #########################
113 +                self.SE_path = self.SE_path + self.path_add
114 +      
115 +        txt += '#\n'
116 +        txt += '# COPY OUTPUT FILE TO '+self.SE_path+ '\n'
117 +        txt += '#\n\n'
118 +
119 +        if (pool):
120 +            txt += 'export STAGE_SVCCLASS='+str(pool)+'\n'
121 +            
122 +        if int(self.publish_data) == 1:
123 +            txt += 'export SE='+self.SE+'\n'
124 +            
125 +        txt += 'export SE_PATH='+self.SE_path+'\n'
126 +
127 +        txt += 'export TIME_STAGEOUT_INI=`date +%s` \n'
128 +        txt += '# Verify is the SE path exists '+self.SE_path+'\n'
129 +        txt += '#\n\n'
130 +        txt += 'verifySePath ' + self.SE_path + '\n'
131 +        txt += 'if [ $exit_verifySePath -eq 0 ]; then\n'
132 +        txt += '    echo ">>> Copy output files from WN = `hostname` to SE_PATH = $SE_PATH :"\n'
133 +        txt += '    copy_exit_status=0\n'
134 +        txt += '    for out_file in $file_list ; do\n'
135 +        txt += '        if [ -e $SOFTWARE_DIR/$out_file ] ; then\n'
136 +        txt += '            echo "Trying to copy output file to $SE_PATH"\n'
137 +        txt += '            cmscp $middleware $SOFTWARE_DIR/$out_file $out_file ${SE_PATH}\n'
138 +        txt += '            if [ $cmscp_exit_status -ne 0 ]; then\n'
139 +        txt += '                echo "Problem copying $out_file to $SE_PATH"\n'
140 +        txt += '                copy_exit_status=$cmscp_exit_status\n'
141 +        txt += '            else\n'
142 +        txt += '                echo "output copied into $SE/$SE_PATH directory"\n'
143 +        txt += '            fi\n'
144 +        txt += '        else\n'
145 +        txt += '            copy_exit_status=60302\n'
146 +        txt += '            echo "StageOutExitStatus = $copy_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
147 +        txt += '            echo "StageOutExitStatusReason = file to copy not found" | tee -a $RUNTIME_AREA/$repo\n'
148 +        txt += '        fi\n'
149 +        txt += '    done\n'
150 +        txt += '    if [ $copy_exit_status -ne 0 ]; then\n'
151 +        txt += '        SE=""\n'
152 +        txt += '        SE_PATH=""\n'
153 +        txt += '        job_exit_code=$copy_exit_status\n'
154 +        txt += '    fi\n'
155 +        txt += 'fi\n'
156 +        txt += 'export TIME_STAGEOUT_END=`date +%s` \n'
157 +        txt += 'let "TIME_STAGEOUT = TIME_STAGEOUT_END - TIME_STAGEOUT_INI" \n'
158 +
159 +        return txt
160 +
161 +    def wsCopyOutput(self):
162 +        pool=None
163 +        txt=self.wsCopyOutput_tmp(pool)
164 +        return txt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines