Newer
Older
Analysis / ganga / Lb2Lcmunu / resubmit.py
@Elena Graverini Elena Graverini on 18 Jan 2016 1009 bytes modified after ganga/dirac communication hiccup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Elena Graverini
# @Date:   2016-01-15 14:04:25
# @Last Modified by:   Elena Graverini
# @Last Modified time: 2016-01-18 17:52:12

gridProxy.renew()

myjobs = jobs.select(239, 242)
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 = ['']

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)