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.22 by gcodispo, Mon Sep 8 12:50:07 2008 UTC vs.
Revision 1.23 by spiga, Sun Sep 21 10:46:13 2008 UTC

# Line 27 | Line 27 | class SchedulerLsf(SchedulerLocal) :
27          self.environment_unique_identifier = "https://"+common.scheduler.name()+":/${LSB_BATCH_JID}-"+ \
28              string.replace(common._db.queryTask('name'),"_","-")
29  
30 +        self.pool = cfg_params.get('USER.storage_pool',None)
31          return
32  
33      def realSchedParams(self,cfg_params):
# Line 71 | Line 72 | class SchedulerLsf(SchedulerLocal) :
72          cmd_out = runCommand(cmd)
73          return cmd_out
74  
75 +    def wsCopyOutput(self):
76 +        txt=self.wsCopyOutput_comm(self.pool)
77 +        return txt
78 +
79      def wsExitFunc(self):
80          """
81          """
# Line 90 | Line 95 | class SchedulerLsf(SchedulerLocal) :
95          txt += '}\n'
96  
97          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