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

Comparing COMP/CRAB/python/SchedulerRcondor.py (file contents):
Revision 1.3 by belforte, Thu Jul 26 22:42:14 2012 UTC vs.
Revision 1.6 by belforte, Tue Aug 7 23:05:18 2012 UTC

# Line 30 | Line 30 | class SchedulerRcondor(SchedulerGrid) :
30  
31      def __init__(self):
32          SchedulerGrid.__init__(self,"RCONDOR")
33 +        self.rcondorHost   = os.getenv('RCONDOR_HOST')
34          self.datasetPath   = None
35          self.selectNoInput = None
36          self.OSBsize = 50*1000*1000 # 50 MB
# Line 98 | Line 99 | class SchedulerRcondor(SchedulerGrid) :
99  
100          seDest = task.jobs[i-1]['dlsDestination']
101  
102 +        if seDest == [''] :
103 +            seDest = self.blackWhiteListParser.expandList("T") # all of SiteDB
104 +
105          seString=self.blackWhiteListParser.cleanForBlackWhiteList(seDest)
102        print "SB: SE destinations AfterBlak and White: ", seString
106  
107          jobParams += '+DESIRED_SEs = "'+seString+'"; '
108 +        myschedName = self.rcondorHost
109 +        jobParams += '+Glidein_MonitorID = "https://'+ myschedName + '//$(Cluster).$(Process)"; '
110 +
111 +        if (self.EDG_clock_time):
112 +            jobParams += '+MaxWallTimeMins = '+self.EDG_clock_time+'; '
113 +        else:
114 +            jobParams += '+MaxWallTimeMins = %d; ' % (60*24)
115 +
116 +        common._db.updateTask_({'jobType':jobParams})
117 +
118 +
119 +        return jobParams
120 +
121 +
122 +    def realSchedParams(self, cfg_params):
123 +        """
124 +        Return dictionary with specific parameters, to use with real scheduler
125 +        is called when scheduler is initialized in Boss, i.e. at each crab command
126 +        """
127 +
128 +        tmpDir = os.path.join(common.work_space.shareDir(),'.condor_temp')
129 +        tmpDir = os.path.join(common.work_space.shareDir(),'.condor_temp')
130 +        jobDir = common.work_space.jobDir()
131 +
132 +        taskDir=common.work_space.topDir().split('/')[-2]
133 +        rcondorDir ='%s/.rcondor/%s/mount/' % (os.getenv('HOME'),self.rcondorHost)
134  
135          if (self.EDG_clock_time):
136              jobParams += '+MaxWallTimeMins = '+self.EDG_clock_time+'; '
# Line 125 | Line 154 | class SchedulerRcondor(SchedulerGrid) :
154          jobDir = common.work_space.jobDir()
155  
156          taskDir=common.work_space.topDir().split('/')[-2]
157 <        rcondorDir ='%s/.rcondor/%s/mount/' % (os.getenv('HOME'),os.getenv('RCONDOR_HOST'))
157 >        rcondorDir ='%s/.rcondor/%s/mount/' % (os.getenv('HOME'),self.rcondorHost)
158          tmpDir = os.path.join(rcondorDir,taskDir)
159          tmpDir = os.path.join(tmpDir,'condor_temp')
160          
# Line 176 | Line 205 | class SchedulerRcondor(SchedulerGrid) :
205          txt += 'func_exit() { \n'
206          txt += self.wsExitFunc_common()
207  
179        #txt += '    cp  ${out_files}.tgz $_CONDOR_SCRATCH_DIR/\n'
180        #txt += '    cp  CMSSW_$NJob.stdout $_CONDOR_SCRATCH_DIR/\n'
181        #txt += '    cp  CMSSW_$NJob.stderr $_CONDOR_SCRATCH_DIR/\n'
182        #txt += '    cp  Watchdog_$NJob.log.gz  $_CONDOR_SCRATCH_DIR/\n'
183        #txt += '    cp  crab_fjr_$NJob.xml $_CONDOR_SCRATCH_DIR/\n'
184
185        
186        ### specific Glite check for OSB
208          txt += '    tar zcvf ${out_files}.tgz  ${final_list}\n'
209          txt += '    tmp_size=`ls -gGrta ${out_files}.tgz | awk \'{ print $3 }\'`\n'
210          txt += '    rm ${out_files}.tgz\n'
# Line 227 | Line 248 | class SchedulerRcondor(SchedulerGrid) :
248              common._db.updateTask_(taskReq)
249  
250  
230 # presa di brutto da SchedulerGrid.py
231 """
232
233    def wsSetupEnvironment(self):
234
235        #Returns part of a job script which does scheduler-specific work.
236
237        taskId =common._db.queryTask('name')
238        index = int(common._db.nJobs())
239        job = common.job_list[index-1]
240        jbt = job.type()
241        if not self.environment_unique_identifier:
242            try :
243                self.environment_unique_identifier = self.envUniqueID()
244            except :
245                raise CrabException('environment_unique_identifier not set')
246
247        # start with wrapper timing
248        txt  = 'export TIME_WRAP_INI=`date +%s` \n'
249        txt += 'export TIME_STAGEOUT=-2 \n\n'
250        txt += '# '+self.name()+' specific stuff\n'
251        txt += '# strip arguments\n'
252        txt += 'echo "strip arguments"\n'
253        txt += 'args=("$@")\n'
254        txt += 'nargs=$#\n'
255        txt += 'shift $nargs\n'
256        txt += "# job number (first parameter for job wrapper)\n"
257        txt += "NJob=${args[0]}; export NJob\n"
258        txt += "NResub=${args[1]}; export NResub\n"
259        txt += "NRand=`getRandSeed`; export NRand\n"
260        # append random code
261        txt += 'OutUniqueID=_$NRand\n'
262        txt += 'OutUniqueID=_$NResub$OutUniqueID\n'
263        txt += 'OutUniqueID=$NJob$OutUniqueID; export OutUniqueID\n'
264        txt += 'CRAB_UNIQUE_JOB_ID=%s_${OutUniqueID}; export CRAB_UNIQUE_JOB_ID\n' % taskId
265        txt += 'echo env var CRAB_UNIQUE_JOB_ID set to: ${CRAB_UNIQUE_JOB_ID}\n'
266        # if we want to prepend
267        #txt += 'OutUniqueID=_$NResub\n'
268        #txt += 'OutUniqueID=_$NJob$OutUniqueID\n'
269        #txt += 'OutUniqueID=$NRand$OutUniqueID; export OutUniqueID\n'
270
271        txt += "out_files=out_files_${NJob}; export out_files\n"
272        txt += "echo $out_files\n"
273        txt += jbt.outList()
274      #  txt += 'if [ $JobRunCount ] && [ `expr $JobRunCount - 1` -gt 0 ] && [ $Glidein_MonitorID ]; then \n'
275        txt += 'if [ $Glidein_MonitorID ]; then \n'
276 #        txt += '   attempt=`expr $JobRunCount - 1` \n'
277 #        txt += '   MonitorJobID=${NJob}_${Glidein_MonitorID}__${attempt}\n'
278 #        txt += '   SyncGridJobId=${Glidein_MonitorID}__${attempt}\n'
279        txt += '   MonitorJobID=${NJob}_${Glidein_MonitorID}\n'
280        txt += '   SyncGridJobId=${Glidein_MonitorID}\n'
281        txt += 'else \n'
282        txt += '   MonitorJobID=${NJob}_'+self.environment_unique_identifier+'\n'
283        txt += '   SyncGridJobId='+self.environment_unique_identifier+'\n'
284        txt += 'fi\n'
285        txt += 'MonitorID='+taskId+'\n'
286        txt += 'echo "MonitorJobID=$MonitorJobID" > $RUNTIME_AREA/$repo \n'
287        txt += 'echo "SyncGridJobId=$SyncGridJobId" >> $RUNTIME_AREA/$repo \n'
288        txt += 'echo "MonitorID=$MonitorID" >> $RUNTIME_AREA/$repo\n'
289
290        txt += 'echo ">>> GridFlavour discovery: " \n'
291        txt += 'if [ $OSG_GRID ]; then \n'
292        txt += '    middleware=OSG \n'
293        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
294        txt += '        SyncCE="$OSG_JOB_CONTACT"; \n'
295        txt += '        echo "SyncCE=$SyncCE" >> $RUNTIME_AREA/$repo ;\n'
296        txt += '    else\n'
297        txt += '        echo "not reporting SyncCE";\n'
298        txt += '    fi\n';
299        txt += '    echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n'
300        txt += '    echo "source OSG GRID setup script" \n'
301        txt += '    source $OSG_GRID/setup.sh \n'
302        txt += 'elif [ $NORDUGRID_CE ]; then \n' # We look for $NORDUGRID_CE before $VO_CMS_SW_DIR,
303        txt += '    middleware=ARC \n'           # because the latter is defined for ARC too
304        txt += '    echo "SyncCE=${NORDUGRID_CE}:2811/nordugrid-GE-${QUEUE:-queue}" >> $RUNTIME_AREA/$repo \n'
305        txt += '    echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n'
306        txt += 'elif [ $VO_CMS_SW_DIR ]; then \n'
307        txt += '    middleware=LCG \n'
308        txt += '    if  [ $GLIDEIN_Gatekeeper ]; then \n'
309        txt += '        echo "SyncCE=`echo $GLIDEIN_Gatekeeper | sed -e s/:2119//`" >> $RUNTIME_AREA/$repo \n'
310        txt += '    else \n'
311        txt += '        echo "SyncCE=`glite-brokerinfo getCE`" >> $RUNTIME_AREA/$repo \n'
312        txt += '    fi \n'
313        txt += '    echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n'
314        txt += 'else \n'
315        txt += '    echo "ERROR ==> GridFlavour not identified" \n'
316        txt += '    job_exit_code=10030 \n'
317        txt += '    func_exit \n'
318        txt += 'fi \n'
319
320        txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
321        txt += '\n\n'
322
323
324        txt += 'export VO='+self.VO+'\n'
325        txt += 'if [ $middleware == LCG ]; then\n'
326        txt += '   if  [ $GLIDEIN_Gatekeeper ]; then\n'
327        txt += '       CloseCEs=$GLIDEIN_Gatekeeper \n'
328        txt += '   else\n'
329        txt += '       CloseCEs=`glite-brokerinfo getCE`\n'
330        txt += '   fi\n'
331        txt += '   echo "CloseCEs = $CloseCEs"\n'
332        txt += '   CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
333        txt += '   echo "CE = $CE"\n'
334        txt += 'elif [ $middleware == OSG ]; then \n'
335        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
336        txt += '        CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n'
337        txt += '    else \n'
338        txt += '        echo "ERROR ==> OSG mode in setting CE name from OSG_JOB_CONTACT" \n'
339        txt += '        job_exit_code=10099\n'
340        txt += '        func_exit\n'
341        txt += '    fi \n'
342        txt += 'elif [ $middleware == ARC ]; then \n'
343        txt += '    echo "CE = $NORDUGRID_CE"\n'
344        txt += 'fi \n'
345
346        return txt
347 """

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines