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 |
105 |
|
seString=self.blackWhiteListParser.cleanForBlackWhiteList(seDest) |
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+'; ' |
130 |
|
jobDir = common.work_space.jobDir() |
131 |
|
|
132 |
|
taskDir=common.work_space.topDir().split('/')[-2] |
133 |
< |
rcondorDir ='%s/.rcondor/%s/mount/' % (os.getenv('HOME'),os.getenv('RCONDOR_HOST')) |
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+'; ' |
137 |
> |
else: |
138 |
> |
jobParams += '+MaxWallTimeMins = %d; ' % (60*24) |
139 |
> |
|
140 |
> |
common._db.updateTask_({'jobType':jobParams}) |
141 |
> |
|
142 |
> |
|
143 |
> |
return jobParams |
144 |
> |
|
145 |
> |
|
146 |
> |
def realSchedParams(self, cfg_params): |
147 |
> |
""" |
148 |
> |
Return dictionary with specific parameters, to use with real scheduler |
149 |
> |
is called when scheduler is initialized in Boss, i.e. at each crab command |
150 |
> |
""" |
151 |
> |
|
152 |
> |
tmpDir = os.path.join(common.work_space.shareDir(),'.condor_temp') |
153 |
> |
tmpDir = os.path.join(common.work_space.shareDir(),'.condor_temp') |
154 |
> |
jobDir = common.work_space.jobDir() |
155 |
> |
|
156 |
> |
taskDir=common.work_space.topDir().split('/')[-2] |
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 |
|
|
205 |
|
txt += 'func_exit() { \n' |
206 |
|
txt += self.wsExitFunc_common() |
207 |
|
|
181 |
– |
#txt += ' cp ${out_files}.tgz $_CONDOR_SCRATCH_DIR/\n' |
182 |
– |
#txt += ' cp CMSSW_$NJob.stdout $_CONDOR_SCRATCH_DIR/\n' |
183 |
– |
#txt += ' cp CMSSW_$NJob.stderr $_CONDOR_SCRATCH_DIR/\n' |
184 |
– |
#txt += ' cp Watchdog_$NJob.log.gz $_CONDOR_SCRATCH_DIR/\n' |
185 |
– |
#txt += ' cp crab_fjr_$NJob.xml $_CONDOR_SCRATCH_DIR/\n' |
186 |
– |
|
187 |
– |
|
188 |
– |
### 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' |
248 |
|
common._db.updateTask_(taskReq) |
249 |
|
|
250 |
|
|
232 |
– |
# presa di brutto da SchedulerGrid.py |
233 |
– |
""" |
234 |
– |
|
235 |
– |
def wsSetupEnvironment(self): |
236 |
– |
|
237 |
– |
#Returns part of a job script which does scheduler-specific work. |
238 |
– |
|
239 |
– |
taskId =common._db.queryTask('name') |
240 |
– |
index = int(common._db.nJobs()) |
241 |
– |
job = common.job_list[index-1] |
242 |
– |
jbt = job.type() |
243 |
– |
if not self.environment_unique_identifier: |
244 |
– |
try : |
245 |
– |
self.environment_unique_identifier = self.envUniqueID() |
246 |
– |
except : |
247 |
– |
raise CrabException('environment_unique_identifier not set') |
248 |
– |
|
249 |
– |
# start with wrapper timing |
250 |
– |
txt = 'export TIME_WRAP_INI=`date +%s` \n' |
251 |
– |
txt += 'export TIME_STAGEOUT=-2 \n\n' |
252 |
– |
txt += '# '+self.name()+' specific stuff\n' |
253 |
– |
txt += '# strip arguments\n' |
254 |
– |
txt += 'echo "strip arguments"\n' |
255 |
– |
txt += 'args=("$@")\n' |
256 |
– |
txt += 'nargs=$#\n' |
257 |
– |
txt += 'shift $nargs\n' |
258 |
– |
txt += "# job number (first parameter for job wrapper)\n" |
259 |
– |
txt += "NJob=${args[0]}; export NJob\n" |
260 |
– |
txt += "NResub=${args[1]}; export NResub\n" |
261 |
– |
txt += "NRand=`getRandSeed`; export NRand\n" |
262 |
– |
# append random code |
263 |
– |
txt += 'OutUniqueID=_$NRand\n' |
264 |
– |
txt += 'OutUniqueID=_$NResub$OutUniqueID\n' |
265 |
– |
txt += 'OutUniqueID=$NJob$OutUniqueID; export OutUniqueID\n' |
266 |
– |
txt += 'CRAB_UNIQUE_JOB_ID=%s_${OutUniqueID}; export CRAB_UNIQUE_JOB_ID\n' % taskId |
267 |
– |
txt += 'echo env var CRAB_UNIQUE_JOB_ID set to: ${CRAB_UNIQUE_JOB_ID}\n' |
268 |
– |
# if we want to prepend |
269 |
– |
#txt += 'OutUniqueID=_$NResub\n' |
270 |
– |
#txt += 'OutUniqueID=_$NJob$OutUniqueID\n' |
271 |
– |
#txt += 'OutUniqueID=$NRand$OutUniqueID; export OutUniqueID\n' |
272 |
– |
|
273 |
– |
txt += "out_files=out_files_${NJob}; export out_files\n" |
274 |
– |
txt += "echo $out_files\n" |
275 |
– |
txt += jbt.outList() |
276 |
– |
# txt += 'if [ $JobRunCount ] && [ `expr $JobRunCount - 1` -gt 0 ] && [ $Glidein_MonitorID ]; then \n' |
277 |
– |
txt += 'if [ $Glidein_MonitorID ]; then \n' |
278 |
– |
# txt += ' attempt=`expr $JobRunCount - 1` \n' |
279 |
– |
# txt += ' MonitorJobID=${NJob}_${Glidein_MonitorID}__${attempt}\n' |
280 |
– |
# txt += ' SyncGridJobId=${Glidein_MonitorID}__${attempt}\n' |
281 |
– |
txt += ' MonitorJobID=${NJob}_${Glidein_MonitorID}\n' |
282 |
– |
txt += ' SyncGridJobId=${Glidein_MonitorID}\n' |
283 |
– |
txt += 'else \n' |
284 |
– |
txt += ' MonitorJobID=${NJob}_'+self.environment_unique_identifier+'\n' |
285 |
– |
txt += ' SyncGridJobId='+self.environment_unique_identifier+'\n' |
286 |
– |
txt += 'fi\n' |
287 |
– |
txt += 'MonitorID='+taskId+'\n' |
288 |
– |
txt += 'echo "MonitorJobID=$MonitorJobID" > $RUNTIME_AREA/$repo \n' |
289 |
– |
txt += 'echo "SyncGridJobId=$SyncGridJobId" >> $RUNTIME_AREA/$repo \n' |
290 |
– |
txt += 'echo "MonitorID=$MonitorID" >> $RUNTIME_AREA/$repo\n' |
291 |
– |
|
292 |
– |
txt += 'echo ">>> GridFlavour discovery: " \n' |
293 |
– |
txt += 'if [ $OSG_GRID ]; then \n' |
294 |
– |
txt += ' middleware=OSG \n' |
295 |
– |
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
296 |
– |
txt += ' SyncCE="$OSG_JOB_CONTACT"; \n' |
297 |
– |
txt += ' echo "SyncCE=$SyncCE" >> $RUNTIME_AREA/$repo ;\n' |
298 |
– |
txt += ' else\n' |
299 |
– |
txt += ' echo "not reporting SyncCE";\n' |
300 |
– |
txt += ' fi\n'; |
301 |
– |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
302 |
– |
txt += ' echo "source OSG GRID setup script" \n' |
303 |
– |
txt += ' source $OSG_GRID/setup.sh \n' |
304 |
– |
txt += 'elif [ $NORDUGRID_CE ]; then \n' # We look for $NORDUGRID_CE before $VO_CMS_SW_DIR, |
305 |
– |
txt += ' middleware=ARC \n' # because the latter is defined for ARC too |
306 |
– |
txt += ' echo "SyncCE=${NORDUGRID_CE}:2811/nordugrid-GE-${QUEUE:-queue}" >> $RUNTIME_AREA/$repo \n' |
307 |
– |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
308 |
– |
txt += 'elif [ $VO_CMS_SW_DIR ]; then \n' |
309 |
– |
txt += ' middleware=LCG \n' |
310 |
– |
txt += ' if [ $GLIDEIN_Gatekeeper ]; then \n' |
311 |
– |
txt += ' echo "SyncCE=`echo $GLIDEIN_Gatekeeper | sed -e s/:2119//`" >> $RUNTIME_AREA/$repo \n' |
312 |
– |
txt += ' else \n' |
313 |
– |
txt += ' echo "SyncCE=`glite-brokerinfo getCE`" >> $RUNTIME_AREA/$repo \n' |
314 |
– |
txt += ' fi \n' |
315 |
– |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
316 |
– |
txt += 'else \n' |
317 |
– |
txt += ' echo "ERROR ==> GridFlavour not identified" \n' |
318 |
– |
txt += ' job_exit_code=10030 \n' |
319 |
– |
txt += ' func_exit \n' |
320 |
– |
txt += 'fi \n' |
321 |
– |
|
322 |
– |
txt += 'dumpStatus $RUNTIME_AREA/$repo \n' |
323 |
– |
txt += '\n\n' |
324 |
– |
|
325 |
– |
|
326 |
– |
txt += 'export VO='+self.VO+'\n' |
327 |
– |
txt += 'if [ $middleware == LCG ]; then\n' |
328 |
– |
txt += ' if [ $GLIDEIN_Gatekeeper ]; then\n' |
329 |
– |
txt += ' CloseCEs=$GLIDEIN_Gatekeeper \n' |
330 |
– |
txt += ' else\n' |
331 |
– |
txt += ' CloseCEs=`glite-brokerinfo getCE`\n' |
332 |
– |
txt += ' fi\n' |
333 |
– |
txt += ' echo "CloseCEs = $CloseCEs"\n' |
334 |
– |
txt += ' CE=`echo $CloseCEs | sed -e "s/:.*//"`\n' |
335 |
– |
txt += ' echo "CE = $CE"\n' |
336 |
– |
txt += 'elif [ $middleware == OSG ]; then \n' |
337 |
– |
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
338 |
– |
txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n' |
339 |
– |
txt += ' else \n' |
340 |
– |
txt += ' echo "ERROR ==> OSG mode in setting CE name from OSG_JOB_CONTACT" \n' |
341 |
– |
txt += ' job_exit_code=10099\n' |
342 |
– |
txt += ' func_exit\n' |
343 |
– |
txt += ' fi \n' |
344 |
– |
txt += 'elif [ $middleware == ARC ]; then \n' |
345 |
– |
txt += ' echo "CE = $NORDUGRID_CE"\n' |
346 |
– |
txt += 'fi \n' |
347 |
– |
|
348 |
– |
return txt |
349 |
– |
""" |