Newer
Older
Lb2Ksppi-Bender / Phys / B2KShh / job / resubmit.py
@Elena Graverini Elena Graverini on 21 Jan 2016 976 bytes first commit
gridProxy.renew()

#myjobs = jobs.select(243, 260)
myjobs = jobs.select(261, 264)
stuckSubjobs = 0
failedSubjobs = 0
totalSubJobs = 0
#sitesToBan = ['LCG.GRIDKA.de', 'LCG.IN2P3.fr', 'LCG.PIC.es', 'LCG.NIKHEF.nl', 'LCG.SARA.nl', 'LCG.RAL.uk']
#sitesToBan = ['LCG.GRIDKA.de', 'LCG.IN2P3.fr', 'LCG.NIKHEF.nl']
sitesToBan = ['']
#sitesToBan = ['LCG.NIKHEF.nl', 'LCG.IN2P3.fr', 'LCG.CSCS.ch', 'LCG.GRIDKA.de', 'LCG.CNAF.it', 'LCG.RAL.uk', 'LCG.PIC.es']

for (index, j) in enumerate(myjobs):
    for sj in j.subjobs:
        totalSubJobs += 1
        if (sj.status == "new"):
            queues.add(sj.submit)
            stuckSubjobs += 1
        if (sj.status == "failed"):
            #sj.backend.reset()
            #sj.force_status('failed', force=True)
            sj.backend.settings['BannedSites'] = sitesToBan
            queues.add(sj.resubmit)
            failedSubjobs += 1

print '%s new subjobs submitted, %s failed subjobs resubmitted.' % (stuckSubjobs,failedSubjobs)